Skip to content

Commit

Permalink
erofs: simplify erofs_xattr_generic_get()
Browse files Browse the repository at this point in the history
erofs_xattr_generic_get() won't be called from xattr handlers other than
user/trusted/security xattr handler, and thus there's no need of extra
checking.

Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>
Link: https://lore.kernel.org/r/20230330082910.125374-4-jefflexu@linux.alibaba.com
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Reviewed-by: Yue Hu <huyue2@coolpad.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
  • Loading branch information
Jingbo Xu authored and Gao Xiang committed Apr 16, 2023
1 parent 6020ffe commit b05f30b
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions fs/erofs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,20 +432,9 @@ static int erofs_xattr_generic_get(const struct xattr_handler *handler,
struct dentry *unused, struct inode *inode,
const char *name, void *buffer, size_t size)
{
struct erofs_sb_info *const sbi = EROFS_I_SB(inode);

switch (handler->flags) {
case EROFS_XATTR_INDEX_USER:
if (!test_opt(&sbi->opt, XATTR_USER))
return -EOPNOTSUPP;
break;
case EROFS_XATTR_INDEX_TRUSTED:
break;
case EROFS_XATTR_INDEX_SECURITY:
break;
default:
return -EINVAL;
}
if (handler->flags == EROFS_XATTR_INDEX_USER &&
!test_opt(&EROFS_I_SB(inode)->opt, XATTR_USER))
return -EOPNOTSUPP;

return erofs_getxattr(inode, handler->flags, name, buffer, size);
}
Expand Down

0 comments on commit b05f30b

Please sign in to comment.