f2fs: Pass folios to f2fs_init_acl()

The one caller already has folios, so pass them in, and further pass
them to __f2fs_set_acl() and f2fs_acl_create().  There should be
no change to the generated code for this commit.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
pull/1253/head
Matthew Wilcox (Oracle) 2025-03-31 21:12:08 +01:00 committed by Jaegeuk Kim
parent 802aa48dba
commit 9de27930c5
3 changed files with 19 additions and 20 deletions

View File

@ -227,7 +227,7 @@ static int f2fs_acl_update_mode(struct mnt_idmap *idmap,
static int __f2fs_set_acl(struct mnt_idmap *idmap, static int __f2fs_set_acl(struct mnt_idmap *idmap,
struct inode *inode, int type, struct inode *inode, int type,
struct posix_acl *acl, struct page *ipage) struct posix_acl *acl, struct folio *ifolio)
{ {
int name_index; int name_index;
void *value = NULL; void *value = NULL;
@ -238,9 +238,8 @@ static int __f2fs_set_acl(struct mnt_idmap *idmap,
switch (type) { switch (type) {
case ACL_TYPE_ACCESS: case ACL_TYPE_ACCESS:
name_index = F2FS_XATTR_INDEX_POSIX_ACL_ACCESS; name_index = F2FS_XATTR_INDEX_POSIX_ACL_ACCESS;
if (acl && !ipage) { if (acl && !ifolio) {
error = f2fs_acl_update_mode(idmap, inode, error = f2fs_acl_update_mode(idmap, inode, &mode, &acl);
&mode, &acl);
if (error) if (error)
return error; return error;
set_acl_inode(inode, mode); set_acl_inode(inode, mode);
@ -265,7 +264,7 @@ static int __f2fs_set_acl(struct mnt_idmap *idmap,
} }
} }
error = f2fs_setxattr(inode, name_index, "", value, size, ipage, 0); error = f2fs_setxattr(inode, name_index, "", value, size, &ifolio->page, 0);
kfree(value); kfree(value);
if (!error) if (!error)
@ -360,7 +359,7 @@ static int f2fs_acl_create_masq(struct posix_acl *acl, umode_t *mode_p)
static int f2fs_acl_create(struct inode *dir, umode_t *mode, static int f2fs_acl_create(struct inode *dir, umode_t *mode,
struct posix_acl **default_acl, struct posix_acl **acl, struct posix_acl **default_acl, struct posix_acl **acl,
struct page *dpage) struct folio *dfolio)
{ {
struct posix_acl *p; struct posix_acl *p;
struct posix_acl *clone; struct posix_acl *clone;
@ -372,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, dpage); p = __f2fs_get_acl(dir, ACL_TYPE_DEFAULT, &dfolio->page);
if (!p || p == ERR_PTR(-EOPNOTSUPP)) { if (!p || p == ERR_PTR(-EOPNOTSUPP)) {
*mode &= ~current_umask(); *mode &= ~current_umask();
return 0; return 0;
@ -409,29 +408,29 @@ release_acl:
return ret; return ret;
} }
int f2fs_init_acl(struct inode *inode, struct inode *dir, struct page *ipage, int f2fs_init_acl(struct inode *inode, struct inode *dir, struct folio *ifolio,
struct page *dpage) struct folio *dfolio)
{ {
struct posix_acl *default_acl = NULL, *acl = NULL; struct posix_acl *default_acl = NULL, *acl = NULL;
int error; int error;
error = f2fs_acl_create(dir, &inode->i_mode, &default_acl, &acl, dpage); error = f2fs_acl_create(dir, &inode->i_mode, &default_acl, &acl, dfolio);
if (error) if (error)
return error; return error;
f2fs_mark_inode_dirty_sync(inode, true); f2fs_mark_inode_dirty_sync(inode, true);
if (default_acl) { if (default_acl) {
error = __f2fs_set_acl(NULL, inode, ACL_TYPE_DEFAULT, default_acl, error = __f2fs_set_acl(NULL, inode, ACL_TYPE_DEFAULT,
ipage); default_acl, ifolio);
posix_acl_release(default_acl); posix_acl_release(default_acl);
} else { } else {
inode->i_default_acl = NULL; inode->i_default_acl = NULL;
} }
if (acl) { if (acl) {
if (!error) if (!error)
error = __f2fs_set_acl(NULL, inode, ACL_TYPE_ACCESS, acl, error = __f2fs_set_acl(NULL, inode, ACL_TYPE_ACCESS,
ipage); acl, ifolio);
posix_acl_release(acl); posix_acl_release(acl);
} else { } else {
inode->i_acl = NULL; inode->i_acl = NULL;

View File

@ -33,17 +33,17 @@ struct f2fs_acl_header {
#ifdef CONFIG_F2FS_FS_POSIX_ACL #ifdef CONFIG_F2FS_FS_POSIX_ACL
extern struct posix_acl *f2fs_get_acl(struct inode *, int, bool); struct posix_acl *f2fs_get_acl(struct inode *, int, bool);
extern int f2fs_set_acl(struct mnt_idmap *, struct dentry *, int f2fs_set_acl(struct mnt_idmap *, struct dentry *,
struct posix_acl *, int); struct posix_acl *, int);
extern int f2fs_init_acl(struct inode *, struct inode *, struct page *, int f2fs_init_acl(struct inode *, struct inode *, struct folio *ifolio,
struct page *); struct folio *dfolio);
#else #else
#define f2fs_get_acl NULL #define f2fs_get_acl NULL
#define f2fs_set_acl NULL #define f2fs_set_acl NULL
static inline int f2fs_init_acl(struct inode *inode, struct inode *dir, static inline int f2fs_init_acl(struct inode *inode, struct inode *dir,
struct page *ipage, struct page *dpage) struct folio *ifolio, struct folio *dfolio)
{ {
return 0; return 0;
} }

View File

@ -537,7 +537,7 @@ struct page *f2fs_init_inode_metadata(struct inode *inode, struct inode *dir,
folio_put(folio); folio_put(folio);
} }
err = f2fs_init_acl(inode, dir, &folio->page, &dfolio->page); err = f2fs_init_acl(inode, dir, folio, dfolio);
if (err) if (err)
goto put_error; goto put_error;