diff options
author | Allison Henderson <allison.henderson@oracle.com> | 2018-10-18 02:21:23 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2018-10-18 02:21:23 -0400 |
commit | 068f985a9e5ec70fde58d8f679994fdbbd093a36 (patch) | |
tree | e69bbfe65ad8232c1356818303847da98db2e8f7 /fs/xfs/libxfs | |
parent | 2f3cd8091963810d85e6a5dd6ed1247e10e9e6f2 (diff) |
xfs: Add attibute remove and helper functions
This patch adds xfs_attr_remove_args. These sub-routines remove
the attributes specified in @args. We will use this later for setting
parent pointers as a deferred attribute operation.
Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/libxfs')
-rw-r--r-- | fs/xfs/libxfs/xfs_attr.c | 36 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_attr.h | 1 |
2 files changed, 26 insertions, 11 deletions
diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 25431ddba1fa..844ed87b1900 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c | |||
@@ -289,6 +289,30 @@ xfs_attr_set_args( | |||
289 | return error; | 289 | return error; |
290 | } | 290 | } |
291 | 291 | ||
292 | /* | ||
293 | * Remove the attribute specified in @args. | ||
294 | */ | ||
295 | int | ||
296 | xfs_attr_remove_args( | ||
297 | struct xfs_da_args *args) | ||
298 | { | ||
299 | struct xfs_inode *dp = args->dp; | ||
300 | int error; | ||
301 | |||
302 | if (!xfs_inode_hasattr(dp)) { | ||
303 | error = -ENOATTR; | ||
304 | } else if (dp->i_d.di_aformat == XFS_DINODE_FMT_LOCAL) { | ||
305 | ASSERT(dp->i_afp->if_flags & XFS_IFINLINE); | ||
306 | error = xfs_attr_shortform_remove(args); | ||
307 | } else if (xfs_bmap_one_block(dp, XFS_ATTR_FORK)) { | ||
308 | error = xfs_attr_leaf_removename(args); | ||
309 | } else { | ||
310 | error = xfs_attr_node_removename(args); | ||
311 | } | ||
312 | |||
313 | return error; | ||
314 | } | ||
315 | |||
292 | int | 316 | int |
293 | xfs_attr_set( | 317 | xfs_attr_set( |
294 | struct xfs_inode *dp, | 318 | struct xfs_inode *dp, |
@@ -445,17 +469,7 @@ xfs_attr_remove( | |||
445 | */ | 469 | */ |
446 | xfs_trans_ijoin(args.trans, dp, 0); | 470 | xfs_trans_ijoin(args.trans, dp, 0); |
447 | 471 | ||
448 | if (!xfs_inode_hasattr(dp)) { | 472 | error = xfs_attr_remove_args(&args); |
449 | error = -ENOATTR; | ||
450 | } else if (dp->i_d.di_aformat == XFS_DINODE_FMT_LOCAL) { | ||
451 | ASSERT(dp->i_afp->if_flags & XFS_IFINLINE); | ||
452 | error = xfs_attr_shortform_remove(&args); | ||
453 | } else if (xfs_bmap_one_block(dp, XFS_ATTR_FORK)) { | ||
454 | error = xfs_attr_leaf_removename(&args); | ||
455 | } else { | ||
456 | error = xfs_attr_node_removename(&args); | ||
457 | } | ||
458 | |||
459 | if (error) | 473 | if (error) |
460 | goto out; | 474 | goto out; |
461 | 475 | ||
diff --git a/fs/xfs/libxfs/xfs_attr.h b/fs/xfs/libxfs/xfs_attr.h index f608ac8f306f..bdf52a333f3f 100644 --- a/fs/xfs/libxfs/xfs_attr.h +++ b/fs/xfs/libxfs/xfs_attr.h | |||
@@ -142,6 +142,7 @@ int xfs_attr_set(struct xfs_inode *dp, const unsigned char *name, | |||
142 | unsigned char *value, int valuelen, int flags); | 142 | unsigned char *value, int valuelen, int flags); |
143 | int xfs_attr_set_args(struct xfs_da_args *args, struct xfs_buf **leaf_bp); | 143 | int xfs_attr_set_args(struct xfs_da_args *args, struct xfs_buf **leaf_bp); |
144 | int xfs_attr_remove(struct xfs_inode *dp, const unsigned char *name, int flags); | 144 | int xfs_attr_remove(struct xfs_inode *dp, const unsigned char *name, int flags); |
145 | int xfs_attr_remove_args(struct xfs_da_args *args); | ||
145 | int xfs_attr_list(struct xfs_inode *dp, char *buffer, int bufsize, | 146 | int xfs_attr_list(struct xfs_inode *dp, char *buffer, int bufsize, |
146 | int flags, struct attrlist_cursor_kern *cursor); | 147 | int flags, struct attrlist_cursor_kern *cursor); |
147 | 148 | ||