This review is not for erofs specifically, but for all file systems using the same scheme. > +static const char *erofs_xattr_prefix(int xattr_index, struct dentry *dentry) > +{ > + const char *name = NULL; > + const struct xattr_handler *handler = NULL; > + > + switch (xattr_index) { > + case EROFS_XATTR_INDEX_USER: > + handler = &erofs_xattr_user_handler; > + break; > + case EROFS_XATTR_INDEX_TRUSTED: > + handler = &erofs_xattr_trusted_handler; > + break; > +#ifdef CONFIG_EROFS_FS_SECURITY > + case EROFS_XATTR_INDEX_SECURITY: > + handler = &erofs_xattr_security_handler; > + break; > +#endif > +#ifdef CONFIG_EROFS_FS_POSIX_ACL > + case EROFS_XATTR_INDEX_POSIX_ACL_ACCESS: > + if (posix_acl_dentry_list(dentry)) > + name = XATTR_NAME_POSIX_ACL_ACCESS; > + break; > + case EROFS_XATTR_INDEX_POSIX_ACL_DEFAULT: > + if (posix_acl_dentry_list(dentry)) > + name = XATTR_NAME_POSIX_ACL_DEFAULT; > + break; > +#endif > + default: > + return NULL; > + } > + > + if (xattr_dentry_list(handler, dentry)) > + name = xattr_prefix(handler); I'm not a huge fan of all this duplicate logic in the file systems that is more verbose and a bit confusing. Until we remove the xattr handlers entirely, I wonder if we just need to keep a special ->list for posix xattrs, just to be able to keep the old logic in all these file system. That is a ->list that works for xattr_dentry_list, but never actually lists anything. That would remove all this boiler plate for now without minimal core additions. Eventually we can hopefully remove first ->list and then the xattr handlers entirely, but until then this seems like a step backwards.