Skip to content

Commit b05f30b

Browse files
lostjefflehsiangkao
authored andcommitted
erofs: simplify erofs_xattr_generic_get()
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>
1 parent 6020ffe commit b05f30b

1 file changed

Lines changed: 3 additions & 14 deletions

File tree

fs/erofs/xattr.c

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -432,20 +432,9 @@ static int erofs_xattr_generic_get(const struct xattr_handler *handler,
432432
struct dentry *unused, struct inode *inode,
433433
const char *name, void *buffer, size_t size)
434434
{
435-
struct erofs_sb_info *const sbi = EROFS_I_SB(inode);
436-
437-
switch (handler->flags) {
438-
case EROFS_XATTR_INDEX_USER:
439-
if (!test_opt(&sbi->opt, XATTR_USER))
440-
return -EOPNOTSUPP;
441-
break;
442-
case EROFS_XATTR_INDEX_TRUSTED:
443-
break;
444-
case EROFS_XATTR_INDEX_SECURITY:
445-
break;
446-
default:
447-
return -EINVAL;
448-
}
435+
if (handler->flags == EROFS_XATTR_INDEX_USER &&
436+
!test_opt(&EROFS_I_SB(inode)->opt, XATTR_USER))
437+
return -EOPNOTSUPP;
449438

450439
return erofs_getxattr(inode, handler->flags, name, buffer, size);
451440
}

0 commit comments

Comments
 (0)