mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-04 04:06:26 +00:00
fuse: convert readlink to use folios
Convert readlink requests to use a folio instead of a page. No functional changes. Signed-off-by: Joanne Koong <joannelkoong@gmail.com> Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
parent
ee80369a8a
commit
c1e4862b13
@ -1585,14 +1585,15 @@ static int fuse_permission(struct mnt_idmap *idmap,
|
||||
return err;
|
||||
}
|
||||
|
||||
static int fuse_readlink_page(struct inode *inode, struct page *page)
|
||||
static int fuse_readlink_page(struct inode *inode, struct folio *folio)
|
||||
{
|
||||
struct fuse_mount *fm = get_fuse_mount(inode);
|
||||
struct fuse_page_desc desc = { .length = PAGE_SIZE - 1 };
|
||||
struct fuse_folio_desc desc = { .length = PAGE_SIZE - 1 };
|
||||
struct fuse_args_pages ap = {
|
||||
.num_pages = 1,
|
||||
.pages = &page,
|
||||
.descs = &desc,
|
||||
.uses_folios = true,
|
||||
.num_folios = 1,
|
||||
.folios = &folio,
|
||||
.folio_descs = &desc,
|
||||
};
|
||||
char *link;
|
||||
ssize_t res;
|
||||
@ -1614,7 +1615,7 @@ static int fuse_readlink_page(struct inode *inode, struct page *page)
|
||||
if (WARN_ON(res >= PAGE_SIZE))
|
||||
return -EIO;
|
||||
|
||||
link = page_address(page);
|
||||
link = folio_address(folio);
|
||||
link[res] = '\0';
|
||||
|
||||
return 0;
|
||||
@ -1624,7 +1625,7 @@ static const char *fuse_get_link(struct dentry *dentry, struct inode *inode,
|
||||
struct delayed_call *callback)
|
||||
{
|
||||
struct fuse_conn *fc = get_fuse_conn(inode);
|
||||
struct page *page;
|
||||
struct folio *folio;
|
||||
int err;
|
||||
|
||||
err = -EIO;
|
||||
@ -1638,20 +1639,20 @@ static const char *fuse_get_link(struct dentry *dentry, struct inode *inode,
|
||||
if (!dentry)
|
||||
goto out_err;
|
||||
|
||||
page = alloc_page(GFP_KERNEL);
|
||||
folio = folio_alloc(GFP_KERNEL, 0);
|
||||
err = -ENOMEM;
|
||||
if (!page)
|
||||
if (!folio)
|
||||
goto out_err;
|
||||
|
||||
err = fuse_readlink_page(inode, page);
|
||||
err = fuse_readlink_page(inode, folio);
|
||||
if (err) {
|
||||
__free_page(page);
|
||||
folio_put(folio);
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
set_delayed_call(callback, page_put_link, page);
|
||||
set_delayed_call(callback, page_put_link, &folio->page);
|
||||
|
||||
return page_address(page);
|
||||
return folio_address(folio);
|
||||
|
||||
out_err:
|
||||
return ERR_PTR(err);
|
||||
@ -2231,7 +2232,7 @@ void fuse_init_dir(struct inode *inode)
|
||||
|
||||
static int fuse_symlink_read_folio(struct file *null, struct folio *folio)
|
||||
{
|
||||
int err = fuse_readlink_page(folio->mapping->host, &folio->page);
|
||||
int err = fuse_readlink_page(folio->mapping->host, folio);
|
||||
|
||||
if (!err)
|
||||
folio_mark_uptodate(folio);
|
||||
|
Loading…
Reference in New Issue
Block a user