From: Jingbo Xu <jefflexu@linux.alibaba.com>
To: xiang@kernel.org, chao@kernel.org, huyue2@coolpad.com,
linux-erofs@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH v2 3/8] erofs: simplify erofs_xattr_generic_get()
Date: Thu, 30 Mar 2023 16:29:05 +0800 [thread overview]
Message-ID: <20230330082910.125374-4-jefflexu@linux.alibaba.com> (raw)
In-Reply-To: <20230330082910.125374-1-jefflexu@linux.alibaba.com>
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>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
fs/erofs/xattr.c | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/fs/erofs/xattr.c b/fs/erofs/xattr.c
index dc36a0c0919c..d76b74ece2e5 100644
--- a/fs/erofs/xattr.c
+++ b/fs/erofs/xattr.c
@@ -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);
}
--
2.19.1.6.gb485710b
next prev parent reply other threads:[~2023-03-30 8:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-30 8:29 [PATCH v2 0/8] erofs: cleanup of xattr handling Jingbo Xu
2023-03-30 8:29 ` [PATCH v2 1/8] erofs: move several xattr helpers into xattr.c Jingbo Xu
2023-03-30 9:34 ` Gao Xiang
2023-03-31 3:59 ` Yue Hu
2023-04-16 14:21 ` Chao Yu
2023-03-30 8:29 ` [PATCH v2 2/8] erofs: rename init_inode_xattrs with erofs_ prefix Jingbo Xu
2023-03-31 6:11 ` Yue Hu
2023-04-16 14:21 ` Chao Yu
2023-03-30 8:29 ` Jingbo Xu [this message]
2023-03-31 2:43 ` [PATCH v2 3/8] erofs: simplify erofs_xattr_generic_get() Gao Xiang
2023-03-31 6:24 ` Yue Hu
2023-04-16 14:29 ` Chao Yu
2023-03-30 8:29 ` [PATCH v2 4/8] erofs: introduce erofs_xattr_iter_fixup_aligned() helper Jingbo Xu
2023-03-30 8:29 ` [PATCH v2 5/8] erofs: unify xattr_iter structures Jingbo Xu
2023-03-30 8:29 ` [PATCH v2 6/8] erofs: make the size of read data stored in buffer_ofs Jingbo Xu
2023-03-30 8:29 ` [PATCH v2 7/8] erofs: unify inline/share xattr iterators for listxattr/getxattr Jingbo Xu
2023-03-30 8:29 ` [PATCH v2 8/8] erofs: use separate xattr parsers " Jingbo Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230330082910.125374-4-jefflexu@linux.alibaba.com \
--to=jefflexu@linux.alibaba.com \
--cc=chao@kernel.org \
--cc=huyue2@coolpad.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xiang@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox