* [PATCH 1/2] bcachefs: drop unused posix acl handlers
@ 2024-08-15 8:57 Youling Tang
2024-08-15 8:57 ` [PATCH 2/2] bcachefs: Simplify bch2_xattr_emit() implementation Youling Tang
0 siblings, 1 reply; 2+ messages in thread
From: Youling Tang @ 2024-08-15 8:57 UTC (permalink / raw)
To: Kent Overstreet; +Cc: linux-bcachefs, linux-kernel, youling.tang, Youling Tang
From: Youling Tang <tangyouling@kylinos.cn>
Remove struct nop_posix_acl_{access,default} for bcachefs filesystem
that don't depend on the xattr handler in their inode->i_op->listxattr()
method in any way. There's nothing more to do than to simply remove the
handler. It's been effectively unused ever since we introduced the new
posix acl api. See [1] for details.
Link [1]: https://patchwork.kernel.org/project/linux-fsdevel/cover/20230125-fs-acl-remove-generic-xattr-handlers-v3-0-f760cc58967d@kernel.org/
Signed-off-by: Youling Tang <tangyouling@kylinos.cn>
---
fs/bcachefs/xattr.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/fs/bcachefs/xattr.c b/fs/bcachefs/xattr.c
index c11bf6dacc2c..9e77e949a29b 100644
--- a/fs/bcachefs/xattr.c
+++ b/fs/bcachefs/xattr.c
@@ -623,10 +623,6 @@ static const struct xattr_handler bch_xattr_bcachefs_effective_handler = {
const struct xattr_handler *bch2_xattr_handlers[] = {
&bch_xattr_user_handler,
-#ifdef CONFIG_BCACHEFS_POSIX_ACL
- &nop_posix_acl_access,
- &nop_posix_acl_default,
-#endif
&bch_xattr_trusted_handler,
&bch_xattr_security_handler,
#ifndef NO_BCACHEFS_FS
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] bcachefs: Simplify bch2_xattr_emit() implementation
2024-08-15 8:57 [PATCH 1/2] bcachefs: drop unused posix acl handlers Youling Tang
@ 2024-08-15 8:57 ` Youling Tang
0 siblings, 0 replies; 2+ messages in thread
From: Youling Tang @ 2024-08-15 8:57 UTC (permalink / raw)
To: Kent Overstreet; +Cc: linux-bcachefs, linux-kernel, youling.tang, Youling Tang
From: Youling Tang <tangyouling@kylinos.cn>
Use helper functions to make code more readable.
Similar to commit a5488f29835c ("fs: simplify ->listxattr() implementation")
Signed-off-by: Youling Tang <tangyouling@kylinos.cn>
---
fs/bcachefs/xattr.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/fs/bcachefs/xattr.c b/fs/bcachefs/xattr.c
index 9e77e949a29b..e64e2c47b6ca 100644
--- a/fs/bcachefs/xattr.c
+++ b/fs/bcachefs/xattr.c
@@ -251,17 +251,27 @@ static int __bch2_xattr_emit(const char *prefix,
return 0;
}
+static inline const char *bch2_xattr_prefix(unsigned type, struct dentry *dentry)
+{
+ const struct xattr_handler *handler = bch2_xattr_type_to_handler(type);
+
+ if (!xattr_handler_can_list(handler, dentry))
+ return NULL;
+
+ return xattr_prefix(handler);
+}
+
static int bch2_xattr_emit(struct dentry *dentry,
const struct bch_xattr *xattr,
struct xattr_buf *buf)
{
- const struct xattr_handler *handler =
- bch2_xattr_type_to_handler(xattr->x_type);
+ const char *prefix;
+
+ prefix = bch2_xattr_prefix(xattr->x_type, dentry);
+ if (!prefix)
+ return 0;
- return handler && (!handler->list || handler->list(dentry))
- ? __bch2_xattr_emit(handler->prefix ?: handler->name,
- xattr->x_name, xattr->x_name_len, buf)
- : 0;
+ return __bch2_xattr_emit(prefix, xattr->x_name, xattr->x_name_len, buf);
}
static int bch2_xattr_list_bcachefs(struct bch_fs *c,
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-08-15 8:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-15 8:57 [PATCH 1/2] bcachefs: drop unused posix acl handlers Youling Tang
2024-08-15 8:57 ` [PATCH 2/2] bcachefs: Simplify bch2_xattr_emit() implementation Youling Tang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox