f2fs: Pass a folio to f2fs_getxattr()

The one caller of __f2fs_get_acl() which passes a non-NULL page already
has a folio, so pass it in, then into f2fs_getxattr(), which lets us
pass it to lookup_all_xattrs().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
Matthew Wilcox (Oracle) 2025-03-31 21:12:15 +01:00 committed by Jaegeuk Kim
parent cdbe260d55
commit 39d20727d8
3 changed files with 12 additions and 12 deletions

View File

@ -166,7 +166,7 @@ fail:
} }
static struct posix_acl *__f2fs_get_acl(struct inode *inode, int type, static struct posix_acl *__f2fs_get_acl(struct inode *inode, int type,
struct page *dpage) struct folio *dfolio)
{ {
int name_index = F2FS_XATTR_INDEX_POSIX_ACL_DEFAULT; int name_index = F2FS_XATTR_INDEX_POSIX_ACL_DEFAULT;
void *value = NULL; void *value = NULL;
@ -176,13 +176,13 @@ static struct posix_acl *__f2fs_get_acl(struct inode *inode, int type,
if (type == ACL_TYPE_ACCESS) if (type == ACL_TYPE_ACCESS)
name_index = F2FS_XATTR_INDEX_POSIX_ACL_ACCESS; name_index = F2FS_XATTR_INDEX_POSIX_ACL_ACCESS;
retval = f2fs_getxattr(inode, name_index, "", NULL, 0, dpage); retval = f2fs_getxattr(inode, name_index, "", NULL, 0, dfolio);
if (retval > 0) { if (retval > 0) {
value = f2fs_kmalloc(F2FS_I_SB(inode), retval, GFP_F2FS_ZERO); value = f2fs_kmalloc(F2FS_I_SB(inode), retval, GFP_F2FS_ZERO);
if (!value) if (!value)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
retval = f2fs_getxattr(inode, name_index, "", value, retval = f2fs_getxattr(inode, name_index, "", value,
retval, dpage); retval, dfolio);
} }
if (retval > 0) if (retval > 0)
@ -371,7 +371,7 @@ static int f2fs_acl_create(struct inode *dir, umode_t *mode,
if (S_ISLNK(*mode) || !IS_POSIXACL(dir)) if (S_ISLNK(*mode) || !IS_POSIXACL(dir))
return 0; return 0;
p = __f2fs_get_acl(dir, ACL_TYPE_DEFAULT, &dfolio->page); p = __f2fs_get_acl(dir, ACL_TYPE_DEFAULT, dfolio);
if (!p || p == ERR_PTR(-EOPNOTSUPP)) { if (!p || p == ERR_PTR(-EOPNOTSUPP)) {
*mode &= ~current_umask(); *mode &= ~current_umask();
return 0; return 0;

View File

@ -314,7 +314,7 @@ static int read_xattr_block(struct inode *inode, void *txattr_addr)
return 0; return 0;
} }
static int lookup_all_xattrs(struct inode *inode, struct page *ipage, static int lookup_all_xattrs(struct inode *inode, struct folio *ifolio,
unsigned int index, unsigned int len, unsigned int index, unsigned int len,
const char *name, struct f2fs_xattr_entry **xe, const char *name, struct f2fs_xattr_entry **xe,
void **base_addr, int *base_size, void **base_addr, int *base_size,
@ -338,7 +338,7 @@ static int lookup_all_xattrs(struct inode *inode, struct page *ipage,
/* read from inline xattr */ /* read from inline xattr */
if (inline_size) { if (inline_size) {
err = read_inline_xattr(inode, ipage, txattr_addr); err = read_inline_xattr(inode, &ifolio->page, txattr_addr);
if (err) if (err)
goto out; goto out;
@ -512,7 +512,7 @@ in_page_out:
} }
int f2fs_getxattr(struct inode *inode, int index, const char *name, int f2fs_getxattr(struct inode *inode, int index, const char *name,
void *buffer, size_t buffer_size, struct page *ipage) void *buffer, size_t buffer_size, struct folio *ifolio)
{ {
struct f2fs_xattr_entry *entry = NULL; struct f2fs_xattr_entry *entry = NULL;
int error; int error;
@ -528,11 +528,11 @@ int f2fs_getxattr(struct inode *inode, int index, const char *name,
if (len > F2FS_NAME_LEN) if (len > F2FS_NAME_LEN)
return -ERANGE; return -ERANGE;
if (!ipage) if (!ifolio)
f2fs_down_read(&F2FS_I(inode)->i_xattr_sem); f2fs_down_read(&F2FS_I(inode)->i_xattr_sem);
error = lookup_all_xattrs(inode, ipage, index, len, name, error = lookup_all_xattrs(inode, ifolio, index, len, name,
&entry, &base_addr, &base_size, &is_inline); &entry, &base_addr, &base_size, &is_inline);
if (!ipage) if (!ifolio)
f2fs_up_read(&F2FS_I(inode)->i_xattr_sem); f2fs_up_read(&F2FS_I(inode)->i_xattr_sem);
if (error) if (error)
return error; return error;

View File

@ -130,7 +130,7 @@ extern const struct xattr_handler * const f2fs_xattr_handlers[];
int f2fs_setxattr(struct inode *, int, const char *, const void *, int f2fs_setxattr(struct inode *, int, const char *, const void *,
size_t, struct folio *, int); size_t, struct folio *, int);
int f2fs_getxattr(struct inode *, int, const char *, void *, int f2fs_getxattr(struct inode *, int, const char *, void *,
size_t, struct page *); size_t, struct folio *);
ssize_t f2fs_listxattr(struct dentry *, char *, size_t); ssize_t f2fs_listxattr(struct dentry *, char *, size_t);
int f2fs_init_xattr_caches(struct f2fs_sb_info *); int f2fs_init_xattr_caches(struct f2fs_sb_info *);
void f2fs_destroy_xattr_caches(struct f2fs_sb_info *); void f2fs_destroy_xattr_caches(struct f2fs_sb_info *);
@ -146,7 +146,7 @@ static inline int f2fs_setxattr(struct inode *inode, int index,
} }
static inline int f2fs_getxattr(struct inode *inode, int index, static inline int f2fs_getxattr(struct inode *inode, int index,
const char *name, void *buffer, const char *name, void *buffer,
size_t buffer_size, struct page *dpage) size_t buffer_size, struct folio *dfolio)
{ {
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }