Commit 1321890a authored by Chandan Babu R's avatar Chandan Babu R

Merge tag 'shrink-dirattr-args-6.10_2024-04-23' of...

Merge tag 'shrink-dirattr-args-6.10_2024-04-23' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux into xfs-6.10-mergeC

xfs: shrink struct xfs_da_args

Let's clean out some unused flags and fields from struct xfs_da_args.
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarChandan Babu R <chandanbabu@kernel.org>

* tag 'shrink-dirattr-args-6.10_2024-04-23' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux:
  xfs: rearrange xfs_da_args a bit to use less space
  xfs: make attr removal an explicit operation
  xfs: remove xfs_da_args.attr_flags
  xfs: remove XFS_DA_OP_NOTIME
  xfs: remove XFS_DA_OP_REMOVE
parents 6a94b1ac cda60317
...@@ -365,7 +365,7 @@ xfs_attr_try_sf_addname( ...@@ -365,7 +365,7 @@ xfs_attr_try_sf_addname(
* Commit the shortform mods, and we're done. * Commit the shortform mods, and we're done.
* NOTE: this is also the error path (EEXIST, etc). * NOTE: this is also the error path (EEXIST, etc).
*/ */
if (!error && !(args->op_flags & XFS_DA_OP_NOTIME)) if (!error)
xfs_trans_ichgtime(args->trans, dp, XFS_ICHGTIME_CHG); xfs_trans_ichgtime(args->trans, dp, XFS_ICHGTIME_CHG);
if (xfs_has_wsync(dp->i_mount)) if (xfs_has_wsync(dp->i_mount))
...@@ -916,13 +916,10 @@ xfs_attr_defer_add( ...@@ -916,13 +916,10 @@ xfs_attr_defer_add(
trace_xfs_attr_defer_add(new->xattri_dela_state, args->dp); trace_xfs_attr_defer_add(new->xattri_dela_state, args->dp);
} }
/*
* Note: If args->value is NULL the attribute will be removed, just like the
* Linux ->setattr API.
*/
int int
xfs_attr_set( xfs_attr_set(
struct xfs_da_args *args) struct xfs_da_args *args,
enum xfs_attr_update op)
{ {
struct xfs_inode *dp = args->dp; struct xfs_inode *dp = args->dp;
struct xfs_mount *mp = dp->i_mount; struct xfs_mount *mp = dp->i_mount;
...@@ -954,7 +951,10 @@ xfs_attr_set( ...@@ -954,7 +951,10 @@ xfs_attr_set(
args->op_flags = XFS_DA_OP_OKNOENT | args->op_flags = XFS_DA_OP_OKNOENT |
(args->op_flags & XFS_DA_OP_LOGGED); (args->op_flags & XFS_DA_OP_LOGGED);
if (args->value) { switch (op) {
case XFS_ATTRUPDATE_UPSERT:
case XFS_ATTRUPDATE_CREATE:
case XFS_ATTRUPDATE_REPLACE:
XFS_STATS_INC(mp, xs_attr_set); XFS_STATS_INC(mp, xs_attr_set);
args->total = xfs_attr_calc_size(args, &local); args->total = xfs_attr_calc_size(args, &local);
...@@ -974,9 +974,11 @@ xfs_attr_set( ...@@ -974,9 +974,11 @@ xfs_attr_set(
if (!local) if (!local)
rmt_blks = xfs_attr3_rmt_blocks(mp, args->valuelen); rmt_blks = xfs_attr3_rmt_blocks(mp, args->valuelen);
} else { break;
case XFS_ATTRUPDATE_REMOVE:
XFS_STATS_INC(mp, xs_attr_remove); XFS_STATS_INC(mp, xs_attr_remove);
rmt_blks = xfs_attr3_rmt_blocks(mp, XFS_XATTR_SIZE_MAX); rmt_blks = xfs_attr3_rmt_blocks(mp, XFS_XATTR_SIZE_MAX);
break;
} }
/* /*
...@@ -988,7 +990,7 @@ xfs_attr_set( ...@@ -988,7 +990,7 @@ xfs_attr_set(
if (error) if (error)
return error; return error;
if (args->value || xfs_inode_hasattr(dp)) { if (op != XFS_ATTRUPDATE_REMOVE || xfs_inode_hasattr(dp)) {
error = xfs_iext_count_may_overflow(dp, XFS_ATTR_FORK, error = xfs_iext_count_may_overflow(dp, XFS_ATTR_FORK,
XFS_IEXT_ATTR_MANIP_CNT(rmt_blks)); XFS_IEXT_ATTR_MANIP_CNT(rmt_blks));
if (error == -EFBIG) if (error == -EFBIG)
...@@ -1001,24 +1003,24 @@ xfs_attr_set( ...@@ -1001,24 +1003,24 @@ xfs_attr_set(
error = xfs_attr_lookup(args); error = xfs_attr_lookup(args);
switch (error) { switch (error) {
case -EEXIST: case -EEXIST:
if (!args->value) { if (op == XFS_ATTRUPDATE_REMOVE) {
/* if no value, we are performing a remove operation */ /* if no value, we are performing a remove operation */
xfs_attr_defer_add(args, XFS_ATTRI_OP_FLAGS_REMOVE); xfs_attr_defer_add(args, XFS_ATTRI_OP_FLAGS_REMOVE);
break; break;
} }
/* Pure create fails if the attr already exists */ /* Pure create fails if the attr already exists */
if (args->attr_flags & XATTR_CREATE) if (op == XFS_ATTRUPDATE_CREATE)
goto out_trans_cancel; goto out_trans_cancel;
xfs_attr_defer_add(args, XFS_ATTRI_OP_FLAGS_REPLACE); xfs_attr_defer_add(args, XFS_ATTRI_OP_FLAGS_REPLACE);
break; break;
case -ENOATTR: case -ENOATTR:
/* Can't remove what isn't there. */ /* Can't remove what isn't there. */
if (!args->value) if (op == XFS_ATTRUPDATE_REMOVE)
goto out_trans_cancel; goto out_trans_cancel;
/* Pure replace fails if no existing attr to replace. */ /* Pure replace fails if no existing attr to replace. */
if (args->attr_flags & XATTR_REPLACE) if (op == XFS_ATTRUPDATE_REPLACE)
goto out_trans_cancel; goto out_trans_cancel;
xfs_attr_defer_add(args, XFS_ATTRI_OP_FLAGS_SET); xfs_attr_defer_add(args, XFS_ATTRI_OP_FLAGS_SET);
break; break;
...@@ -1033,8 +1035,7 @@ xfs_attr_set( ...@@ -1033,8 +1035,7 @@ xfs_attr_set(
if (xfs_has_wsync(mp)) if (xfs_has_wsync(mp))
xfs_trans_set_sync(args->trans); xfs_trans_set_sync(args->trans);
if (!(args->op_flags & XFS_DA_OP_NOTIME)) xfs_trans_ichgtime(args->trans, dp, XFS_ICHGTIME_CHG);
xfs_trans_ichgtime(args->trans, dp, XFS_ICHGTIME_CHG);
/* /*
* Commit the last in the sequence of transactions. * Commit the last in the sequence of transactions.
......
...@@ -544,7 +544,15 @@ int xfs_inode_hasattr(struct xfs_inode *ip); ...@@ -544,7 +544,15 @@ int xfs_inode_hasattr(struct xfs_inode *ip);
bool xfs_attr_is_leaf(struct xfs_inode *ip); bool xfs_attr_is_leaf(struct xfs_inode *ip);
int xfs_attr_get_ilocked(struct xfs_da_args *args); int xfs_attr_get_ilocked(struct xfs_da_args *args);
int xfs_attr_get(struct xfs_da_args *args); int xfs_attr_get(struct xfs_da_args *args);
int xfs_attr_set(struct xfs_da_args *args);
enum xfs_attr_update {
XFS_ATTRUPDATE_REMOVE, /* remove attr */
XFS_ATTRUPDATE_UPSERT, /* set value, replace any existing attr */
XFS_ATTRUPDATE_CREATE, /* set value, fail if attr already exists */
XFS_ATTRUPDATE_REPLACE, /* set value, fail if attr does not exist */
};
int xfs_attr_set(struct xfs_da_args *args, enum xfs_attr_update op);
int xfs_attr_set_iter(struct xfs_attr_intent *attr); int xfs_attr_set_iter(struct xfs_attr_intent *attr);
int xfs_attr_remove_iter(struct xfs_attr_intent *attr); int xfs_attr_remove_iter(struct xfs_attr_intent *attr);
bool xfs_attr_namecheck(const void *name, size_t length); bool xfs_attr_namecheck(const void *name, size_t length);
...@@ -590,7 +598,6 @@ xfs_attr_init_add_state(struct xfs_da_args *args) ...@@ -590,7 +598,6 @@ xfs_attr_init_add_state(struct xfs_da_args *args)
static inline enum xfs_delattr_state static inline enum xfs_delattr_state
xfs_attr_init_remove_state(struct xfs_da_args *args) xfs_attr_init_remove_state(struct xfs_da_args *args)
{ {
args->op_flags |= XFS_DA_OP_REMOVE;
if (xfs_attr_is_shortform(args->dp)) if (xfs_attr_is_shortform(args->dp))
return XFS_DAS_SF_REMOVE; return XFS_DAS_SF_REMOVE;
if (xfs_attr_is_leaf(args->dp)) if (xfs_attr_is_leaf(args->dp))
......
...@@ -54,17 +54,20 @@ enum xfs_dacmp { ...@@ -54,17 +54,20 @@ enum xfs_dacmp {
*/ */
typedef struct xfs_da_args { typedef struct xfs_da_args {
struct xfs_da_geometry *geo; /* da block geometry */ struct xfs_da_geometry *geo; /* da block geometry */
const uint8_t *name; /* string (maybe not NULL terminated) */ const uint8_t *name; /* string (maybe not NULL terminated) */
int namelen; /* length of string (maybe no NULL) */
uint8_t filetype; /* filetype of inode for directories */
void *value; /* set of bytes (maybe contain NULLs) */ void *value; /* set of bytes (maybe contain NULLs) */
int valuelen; /* length of value */
unsigned int attr_filter; /* XFS_ATTR_{ROOT,SECURE,INCOMPLETE} */
unsigned int attr_flags; /* XATTR_{CREATE,REPLACE} */
xfs_dahash_t hashval; /* hash value of name */
xfs_ino_t inumber; /* input/output inode number */
struct xfs_inode *dp; /* directory inode to manipulate */ struct xfs_inode *dp; /* directory inode to manipulate */
struct xfs_trans *trans; /* current trans (changes over time) */ struct xfs_trans *trans; /* current trans (changes over time) */
xfs_ino_t inumber; /* input/output inode number */
xfs_ino_t owner; /* inode that owns the dir/attr data */
int valuelen; /* length of value */
uint8_t filetype; /* filetype of inode for directories */
uint8_t op_flags; /* operation flags */
uint8_t attr_filter; /* XFS_ATTR_{ROOT,SECURE,INCOMPLETE} */
short namelen; /* length of string (maybe no NULL) */
xfs_dahash_t hashval; /* hash value of name */
xfs_extlen_t total; /* total blocks needed, for 1st bmap */ xfs_extlen_t total; /* total blocks needed, for 1st bmap */
int whichfork; /* data or attribute fork */ int whichfork; /* data or attribute fork */
xfs_dablk_t blkno; /* blkno of attr leaf of interest */ xfs_dablk_t blkno; /* blkno of attr leaf of interest */
...@@ -77,9 +80,7 @@ typedef struct xfs_da_args { ...@@ -77,9 +80,7 @@ typedef struct xfs_da_args {
xfs_dablk_t rmtblkno2; /* remote attr value starting blkno */ xfs_dablk_t rmtblkno2; /* remote attr value starting blkno */
int rmtblkcnt2; /* remote attr value block count */ int rmtblkcnt2; /* remote attr value block count */
int rmtvaluelen2; /* remote attr value length in bytes */ int rmtvaluelen2; /* remote attr value length in bytes */
uint32_t op_flags; /* operation flags */
enum xfs_dacmp cmpresult; /* name compare result for lookups */ enum xfs_dacmp cmpresult; /* name compare result for lookups */
xfs_ino_t owner; /* inode that owns the dir/attr data */
} xfs_da_args_t; } xfs_da_args_t;
/* /*
...@@ -90,10 +91,8 @@ typedef struct xfs_da_args { ...@@ -90,10 +91,8 @@ typedef struct xfs_da_args {
#define XFS_DA_OP_ADDNAME (1u << 2) /* this is an add operation */ #define XFS_DA_OP_ADDNAME (1u << 2) /* this is an add operation */
#define XFS_DA_OP_OKNOENT (1u << 3) /* lookup op, ENOENT ok, else die */ #define XFS_DA_OP_OKNOENT (1u << 3) /* lookup op, ENOENT ok, else die */
#define XFS_DA_OP_CILOOKUP (1u << 4) /* lookup returns CI name if found */ #define XFS_DA_OP_CILOOKUP (1u << 4) /* lookup returns CI name if found */
#define XFS_DA_OP_NOTIME (1u << 5) /* don't update inode timestamps */ #define XFS_DA_OP_RECOVERY (1u << 5) /* Log recovery operation */
#define XFS_DA_OP_REMOVE (1u << 6) /* this is a remove operation */ #define XFS_DA_OP_LOGGED (1u << 6) /* Use intent items to track op */
#define XFS_DA_OP_RECOVERY (1u << 7) /* Log recovery operation */
#define XFS_DA_OP_LOGGED (1u << 8) /* Use intent items to track op */
#define XFS_DA_OP_FLAGS \ #define XFS_DA_OP_FLAGS \
{ XFS_DA_OP_JUSTCHECK, "JUSTCHECK" }, \ { XFS_DA_OP_JUSTCHECK, "JUSTCHECK" }, \
...@@ -101,8 +100,6 @@ typedef struct xfs_da_args { ...@@ -101,8 +100,6 @@ typedef struct xfs_da_args {
{ XFS_DA_OP_ADDNAME, "ADDNAME" }, \ { XFS_DA_OP_ADDNAME, "ADDNAME" }, \
{ XFS_DA_OP_OKNOENT, "OKNOENT" }, \ { XFS_DA_OP_OKNOENT, "OKNOENT" }, \
{ XFS_DA_OP_CILOOKUP, "CILOOKUP" }, \ { XFS_DA_OP_CILOOKUP, "CILOOKUP" }, \
{ XFS_DA_OP_NOTIME, "NOTIME" }, \
{ XFS_DA_OP_REMOVE, "REMOVE" }, \
{ XFS_DA_OP_RECOVERY, "RECOVERY" }, \ { XFS_DA_OP_RECOVERY, "RECOVERY" }, \
{ XFS_DA_OP_LOGGED, "LOGGED" } { XFS_DA_OP_LOGGED, "LOGGED" }
......
...@@ -173,7 +173,6 @@ xchk_xattr_actor( ...@@ -173,7 +173,6 @@ xchk_xattr_actor(
void *priv) void *priv)
{ {
struct xfs_da_args args = { struct xfs_da_args args = {
.op_flags = XFS_DA_OP_NOTIME,
.attr_filter = attr_flags & XFS_ATTR_NSP_ONDISK_MASK, .attr_filter = attr_flags & XFS_ATTR_NSP_ONDISK_MASK,
.geo = sc->mp->m_attr_geo, .geo = sc->mp->m_attr_geo,
.whichfork = XFS_ATTR_FORK, .whichfork = XFS_ATTR_FORK,
......
...@@ -557,7 +557,6 @@ xrep_xattr_insert_rec( ...@@ -557,7 +557,6 @@ xrep_xattr_insert_rec(
struct xfs_da_args args = { struct xfs_da_args args = {
.dp = rx->sc->tempip, .dp = rx->sc->tempip,
.attr_filter = key->flags, .attr_filter = key->flags,
.attr_flags = XATTR_CREATE,
.namelen = key->namelen, .namelen = key->namelen,
.valuelen = key->valuelen, .valuelen = key->valuelen,
.owner = rx->sc->ip->i_ino, .owner = rx->sc->ip->i_ino,
...@@ -605,7 +604,7 @@ xrep_xattr_insert_rec( ...@@ -605,7 +604,7 @@ xrep_xattr_insert_rec(
* xfs_attr_set creates and commits its own transaction. If the attr * xfs_attr_set creates and commits its own transaction. If the attr
* already exists, we'll just drop it during the rebuild. * already exists, we'll just drop it during the rebuild.
*/ */
error = xfs_attr_set(&args); error = xfs_attr_set(&args, XFS_ATTRUPDATE_CREATE);
if (error == -EEXIST) if (error == -EEXIST)
error = 0; error = 0;
......
...@@ -201,16 +201,17 @@ __xfs_set_acl(struct inode *inode, struct posix_acl *acl, int type) ...@@ -201,16 +201,17 @@ __xfs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
if (!args.value) if (!args.value)
return -ENOMEM; return -ENOMEM;
xfs_acl_to_disk(args.value, acl); xfs_acl_to_disk(args.value, acl);
error = xfs_attr_change(&args, XFS_ATTRUPDATE_UPSERT);
kvfree(args.value);
} else {
error = xfs_attr_change(&args, XFS_ATTRUPDATE_REMOVE);
/*
* If the attribute didn't exist to start with that's fine.
*/
if (error == -ENOATTR)
error = 0;
} }
error = xfs_attr_change(&args);
kvfree(args.value);
/*
* If the attribute didn't exist to start with that's fine.
*/
if (!acl && error == -ENOATTR)
error = 0;
if (!error) if (!error)
set_cached_acl(inode, type, acl); set_cached_acl(inode, type, acl);
return error; return error;
......
...@@ -361,15 +361,18 @@ xfs_attr_filter( ...@@ -361,15 +361,18 @@ xfs_attr_filter(
return 0; return 0;
} }
static unsigned int static inline enum xfs_attr_update
xfs_attr_flags( xfs_xattr_flags(
u32 ioc_flags) u32 ioc_flags,
void *value)
{ {
if (!value)
return XFS_ATTRUPDATE_REMOVE;
if (ioc_flags & XFS_IOC_ATTR_CREATE) if (ioc_flags & XFS_IOC_ATTR_CREATE)
return XATTR_CREATE; return XFS_ATTRUPDATE_CREATE;
if (ioc_flags & XFS_IOC_ATTR_REPLACE) if (ioc_flags & XFS_IOC_ATTR_REPLACE)
return XATTR_REPLACE; return XFS_ATTRUPDATE_REPLACE;
return 0; return XFS_ATTRUPDATE_UPSERT;
} }
int int
...@@ -476,7 +479,6 @@ xfs_attrmulti_attr_get( ...@@ -476,7 +479,6 @@ xfs_attrmulti_attr_get(
struct xfs_da_args args = { struct xfs_da_args args = {
.dp = XFS_I(inode), .dp = XFS_I(inode),
.attr_filter = xfs_attr_filter(flags), .attr_filter = xfs_attr_filter(flags),
.attr_flags = xfs_attr_flags(flags),
.name = name, .name = name,
.namelen = strlen(name), .namelen = strlen(name),
.valuelen = *len, .valuelen = *len,
...@@ -510,7 +512,6 @@ xfs_attrmulti_attr_set( ...@@ -510,7 +512,6 @@ xfs_attrmulti_attr_set(
struct xfs_da_args args = { struct xfs_da_args args = {
.dp = XFS_I(inode), .dp = XFS_I(inode),
.attr_filter = xfs_attr_filter(flags), .attr_filter = xfs_attr_filter(flags),
.attr_flags = xfs_attr_flags(flags),
.name = name, .name = name,
.namelen = strlen(name), .namelen = strlen(name),
}; };
...@@ -528,7 +529,7 @@ xfs_attrmulti_attr_set( ...@@ -528,7 +529,7 @@ xfs_attrmulti_attr_set(
args.valuelen = len; args.valuelen = len;
} }
error = xfs_attr_change(&args); error = xfs_attr_change(&args, xfs_xattr_flags(flags, args.value));
if (!error && (flags & XFS_IOC_ATTR_ROOT)) if (!error && (flags & XFS_IOC_ATTR_ROOT))
xfs_forget_acl(inode, name); xfs_forget_acl(inode, name);
kfree(args.value); kfree(args.value);
......
...@@ -63,7 +63,7 @@ xfs_initxattrs( ...@@ -63,7 +63,7 @@ xfs_initxattrs(
.value = xattr->value, .value = xattr->value,
.valuelen = xattr->value_len, .valuelen = xattr->value_len,
}; };
error = xfs_attr_change(&args); error = xfs_attr_change(&args, XFS_ATTRUPDATE_UPSERT);
if (error < 0) if (error < 0)
break; break;
} }
......
...@@ -1999,7 +1999,6 @@ DECLARE_EVENT_CLASS(xfs_attr_class, ...@@ -1999,7 +1999,6 @@ DECLARE_EVENT_CLASS(xfs_attr_class,
__field(int, valuelen) __field(int, valuelen)
__field(xfs_dahash_t, hashval) __field(xfs_dahash_t, hashval)
__field(unsigned int, attr_filter) __field(unsigned int, attr_filter)
__field(unsigned int, attr_flags)
__field(uint32_t, op_flags) __field(uint32_t, op_flags)
), ),
TP_fast_assign( TP_fast_assign(
...@@ -2011,11 +2010,10 @@ DECLARE_EVENT_CLASS(xfs_attr_class, ...@@ -2011,11 +2010,10 @@ DECLARE_EVENT_CLASS(xfs_attr_class,
__entry->valuelen = args->valuelen; __entry->valuelen = args->valuelen;
__entry->hashval = args->hashval; __entry->hashval = args->hashval;
__entry->attr_filter = args->attr_filter; __entry->attr_filter = args->attr_filter;
__entry->attr_flags = args->attr_flags;
__entry->op_flags = args->op_flags; __entry->op_flags = args->op_flags;
), ),
TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d " TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
"hashval 0x%x filter %s flags %s op_flags %s", "hashval 0x%x filter %s op_flags %s",
MAJOR(__entry->dev), MINOR(__entry->dev), MAJOR(__entry->dev), MINOR(__entry->dev),
__entry->ino, __entry->ino,
__entry->namelen, __entry->namelen,
...@@ -2025,9 +2023,6 @@ DECLARE_EVENT_CLASS(xfs_attr_class, ...@@ -2025,9 +2023,6 @@ DECLARE_EVENT_CLASS(xfs_attr_class,
__entry->hashval, __entry->hashval,
__print_flags(__entry->attr_filter, "|", __print_flags(__entry->attr_filter, "|",
XFS_ATTR_FILTER_FLAGS), XFS_ATTR_FILTER_FLAGS),
__print_flags(__entry->attr_flags, "|",
{ XATTR_CREATE, "CREATE" },
{ XATTR_REPLACE, "REPLACE" }),
__print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS)) __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
) )
......
...@@ -73,7 +73,8 @@ xfs_attr_want_log_assist( ...@@ -73,7 +73,8 @@ xfs_attr_want_log_assist(
*/ */
int int
xfs_attr_change( xfs_attr_change(
struct xfs_da_args *args) struct xfs_da_args *args,
enum xfs_attr_update op)
{ {
struct xfs_mount *mp = args->dp->i_mount; struct xfs_mount *mp = args->dp->i_mount;
int error; int error;
...@@ -88,7 +89,7 @@ xfs_attr_change( ...@@ -88,7 +89,7 @@ xfs_attr_change(
args->op_flags |= XFS_DA_OP_LOGGED; args->op_flags |= XFS_DA_OP_LOGGED;
} }
return xfs_attr_set(args); return xfs_attr_set(args, op);
} }
...@@ -115,6 +116,20 @@ xfs_xattr_get(const struct xattr_handler *handler, struct dentry *unused, ...@@ -115,6 +116,20 @@ xfs_xattr_get(const struct xattr_handler *handler, struct dentry *unused,
return args.valuelen; return args.valuelen;
} }
static inline enum xfs_attr_update
xfs_xattr_flags_to_op(
int flags,
const void *value)
{
if (!value)
return XFS_ATTRUPDATE_REMOVE;
if (flags & XATTR_CREATE)
return XFS_ATTRUPDATE_CREATE;
if (flags & XATTR_REPLACE)
return XFS_ATTRUPDATE_REPLACE;
return XFS_ATTRUPDATE_UPSERT;
}
static int static int
xfs_xattr_set(const struct xattr_handler *handler, xfs_xattr_set(const struct xattr_handler *handler,
struct mnt_idmap *idmap, struct dentry *unused, struct mnt_idmap *idmap, struct dentry *unused,
...@@ -124,7 +139,6 @@ xfs_xattr_set(const struct xattr_handler *handler, ...@@ -124,7 +139,6 @@ xfs_xattr_set(const struct xattr_handler *handler,
struct xfs_da_args args = { struct xfs_da_args args = {
.dp = XFS_I(inode), .dp = XFS_I(inode),
.attr_filter = handler->flags, .attr_filter = handler->flags,
.attr_flags = flags,
.name = name, .name = name,
.namelen = strlen(name), .namelen = strlen(name),
.value = (void *)value, .value = (void *)value,
...@@ -132,7 +146,7 @@ xfs_xattr_set(const struct xattr_handler *handler, ...@@ -132,7 +146,7 @@ xfs_xattr_set(const struct xattr_handler *handler,
}; };
int error; int error;
error = xfs_attr_change(&args); error = xfs_attr_change(&args, xfs_xattr_flags_to_op(flags, value));
if (!error && (handler->flags & XFS_ATTR_ROOT)) if (!error && (handler->flags & XFS_ATTR_ROOT))
xfs_forget_acl(inode, name); xfs_forget_acl(inode, name);
return error; return error;
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
#ifndef __XFS_XATTR_H__ #ifndef __XFS_XATTR_H__
#define __XFS_XATTR_H__ #define __XFS_XATTR_H__
int xfs_attr_change(struct xfs_da_args *args); enum xfs_attr_update;
int xfs_attr_change(struct xfs_da_args *args, enum xfs_attr_update op);
extern const struct xattr_handler * const xfs_xattr_handlers[]; extern const struct xattr_handler * const xfs_xattr_handlers[];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment