Skip to content

Commit

Permalink
btrfs: send: Change process_all_new_xattr -> process_all_xattr
Browse files Browse the repository at this point in the history
Along side the function rename, add a new iterate_dir_item_t function to work
as a filter, to process the inode as desired by the called. This change
will be used by the next patch.

Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
  • Loading branch information
marcosps committed May 4, 2020
1 parent 8640203 commit 022687d
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions fs/btrfs/send.c
Original file line number Diff line number Diff line change
Expand Up @@ -4738,7 +4738,22 @@ static int process_changed_xattr(struct send_ctx *sctx)
return ret;
}

static int process_all_new_xattrs(struct send_ctx *sctx)
/*
* process_all_xattrs() - Iterate over all xattrs of an inode
* @sctx: Send context, containing the data of the inode
* @filter: Function to be called to all found xattr related to the inode
*
* Basically this function iterates over all xattr of an inode, then calling
* @filter to process the xattr as desired.
*
* The @filter function can be any function obeying the iterate_dir_item_t
* function pointer definition.
*
* Returns 0 for success and <0 if something went wrong with the @filter
* function.
*/
static int process_all_xattrs(struct send_ctx *sctx,
iterate_dir_item_t filter)
{
int ret;
struct btrfs_root *root;
Expand Down Expand Up @@ -4782,7 +4797,7 @@ static int process_all_new_xattrs(struct send_ctx *sctx)
goto out;
}

ret = iterate_dir_item(root, path, __process_new_xattr, sctx);
ret = iterate_dir_item(root, path, filter, sctx);
if (ret < 0)
goto out;

Expand Down Expand Up @@ -6280,7 +6295,7 @@ static int changed_inode(struct send_ctx *sctx,
ret = process_all_extents(sctx);
if (ret < 0)
goto out;
ret = process_all_new_xattrs(sctx);
ret = process_all_xattrs(sctx, __process_new_xattr);
if (ret < 0)
goto out;
} else {
Expand Down

0 comments on commit 022687d

Please sign in to comment.