Re: [PATCH 1/2] fuse: Use a folio in fuse_add_dirent_to_cache()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 13, 2025 at 9:46 AM Matthew Wilcox (Oracle)
<willy@xxxxxxxxxxxxx> wrote:
>
> Retrieve a folio from the page cache and use it throughout.
> Removes three hidden calls to compound_head().
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>

Reviewed-by: Joanne Koong <joannelkoong@xxxxxxxxx>

> ---
>  fs/fuse/readdir.c | 23 ++++++++++++-----------
>  1 file changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/fs/fuse/readdir.c b/fs/fuse/readdir.c
> index c2aae2eef086..09bed488ee35 100644
> --- a/fs/fuse/readdir.c
> +++ b/fs/fuse/readdir.c
> @@ -35,7 +35,7 @@ static void fuse_add_dirent_to_cache(struct file *file,
>         struct fuse_inode *fi = get_fuse_inode(file_inode(file));
>         size_t reclen = FUSE_DIRENT_SIZE(dirent);
>         pgoff_t index;
> -       struct page *page;
> +       struct folio *folio;
>         loff_t size;
>         u64 version;
>         unsigned int offset;
> @@ -62,12 +62,13 @@ static void fuse_add_dirent_to_cache(struct file *file,
>         spin_unlock(&fi->rdc.lock);
>
>         if (offset) {
> -               page = find_lock_page(file->f_mapping, index);
> +               folio = filemap_lock_folio(file->f_mapping, index);
>         } else {
> -               page = find_or_create_page(file->f_mapping, index,
> -                                          mapping_gfp_mask(file->f_mapping));
> +               folio = __filemap_get_folio(file->f_mapping, index,
> +                               FGP_LOCK | FGP_ACCESSED | FGP_CREAT,
> +                               mapping_gfp_mask(file->f_mapping));

nit: in the fuse codebase, the convention for line breaks is for the
next line to have the same indentation as where the previous line's
args start

>         }
> -       if (!page)
> +       if (!folio)
>                 return;





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux