Commit c0d82ceb authored by Niu Yawei's avatar Niu Yawei Committed by Greg Kroah-Hartman

staging: lustre: llite: refactor lustre.lov xattr handling

The function ll_xattr_set() contains special code to handle
the lustre specific xattr lustre.lov. Move all this code to
a new function ll_setstripe_ea().
Signed-off-by: default avatarBobi Jam <bobijam.xu@intel.com>
Signed-off-by: default avatarNiu Yawei <yawei.niu@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8998
Reviewed-on: https://review.whamcloud.com/24851Reviewed-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Reviewed-by: default avatarLai Siyao <lai.siyao@intel.com>
Reviewed-by: default avatarJinshan Xiong <jinshan.xiong@gmail.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 902b62c7
......@@ -186,25 +186,12 @@ static int get_hsm_state(struct inode *inode, u32 *hus_states)
return rc;
}
static int ll_xattr_set(const struct xattr_handler *handler,
struct dentry *dentry, struct inode *inode,
const char *name, const void *value, size_t size,
int flags)
static int ll_setstripe_ea(struct dentry *dentry, struct lov_user_md *lump,
size_t size)
{
LASSERT(inode);
LASSERT(name);
CDEBUG(D_VFSTRACE, "VFS Op:inode=" DFID "(%p), xattr %s\n",
PFID(ll_inode2fid(inode)), inode, name);
if (!strcmp(name, "lov")) {
struct lov_user_md *lump = (struct lov_user_md *)value;
int op_type = flags == XATTR_REPLACE ? LPROC_LL_REMOVEXATTR :
LPROC_LL_SETXATTR;
struct inode *inode = d_inode(dentry);
int rc = 0;
ll_stats_ops_tally(ll_i2sbi(inode), op_type, 1);
if (size != 0 && size < sizeof(struct lov_user_md))
return -EINVAL;
......@@ -255,8 +242,8 @@ static int ll_xattr_set(const struct xattr_handler *handler,
if (lum_size < 0 || size < lum_size)
return 0; /* b=10667: ignore error */
rc = ll_lov_setstripe_ea_info(inode, dentry, it_flags,
lump, lum_size);
rc = ll_lov_setstripe_ea_info(inode, dentry, it_flags, lump,
lum_size);
/* b=10667: rc always be 0 here for now */
rc = 0;
} else if (S_ISDIR(inode->i_mode)) {
......@@ -264,7 +251,27 @@ static int ll_xattr_set(const struct xattr_handler *handler,
}
return rc;
}
static int ll_xattr_set(const struct xattr_handler *handler,
struct dentry *dentry, struct inode *inode,
const char *name, const void *value, size_t size,
int flags)
{
LASSERT(inode);
LASSERT(name);
CDEBUG(D_VFSTRACE, "VFS Op:inode=" DFID "(%p), xattr %s\n",
PFID(ll_inode2fid(inode)), inode, name);
if (!strcmp(name, "lov")) {
int op_type = flags == XATTR_REPLACE ? LPROC_LL_REMOVEXATTR :
LPROC_LL_SETXATTR;
ll_stats_ops_tally(ll_i2sbi(inode), op_type, 1);
return ll_setstripe_ea(dentry, (struct lov_user_md *)value,
size);
} else if (!strcmp(name, "lma") || !strcmp(name, "link")) {
ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_SETXATTR, 1);
return 0;
......
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