lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKFNMokf=ucSpitwt2sF-nBPJPfL02MmorwXvdcw_h1zEoB7BA@mail.gmail.com>
Date:   Wed, 20 Sep 2023 16:25:55 +0900
From:   Ryusuke Konishi <konishi.ryusuke@...il.com>
To:     "Matthew Wilcox (Oracle)" <willy@...radead.org>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        linux-fsdevel@...r.kernel.org, gfs2@...ts.linux.dev,
        linux-nilfs@...r.kernel.org, linux-ntfs-dev@...ts.sourceforge.net,
        ntfs3@...ts.linux.dev, ocfs2-devel@...ts.linux.dev,
        reiserfs-devel@...r.kernel.org, linux-ext4@...r.kernel.org,
        Pankaj Raghav <p.raghav@...sung.com>
Subject: Re: [PATCH 12/26] nilfs2: Convert nilfs_mdt_forget_block() to use a folio

On Tue, Sep 19, 2023 at 3:04 PM Matthew Wilcox (Oracle) wrote:
>
> Remove a number of folio->page->folio conversions.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@...radead.org>
> ---
>  fs/nilfs2/mdt.c | 30 ++++++++++++++----------------
>  1 file changed, 14 insertions(+), 16 deletions(-)
>
> diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c
> index db2260d6e44d..11b7cf4acc92 100644
> --- a/fs/nilfs2/mdt.c
> +++ b/fs/nilfs2/mdt.c
> @@ -356,30 +356,28 @@ int nilfs_mdt_delete_block(struct inode *inode, unsigned long block)
>   */
>  int nilfs_mdt_forget_block(struct inode *inode, unsigned long block)
>  {
> -       pgoff_t index = (pgoff_t)block >>
> -               (PAGE_SHIFT - inode->i_blkbits);
> -       struct page *page;
> -       unsigned long first_block;
> +       pgoff_t index = block >> (PAGE_SHIFT - inode->i_blkbits);
> +       struct folio *folio;
> +       struct buffer_head *bh;
>         int ret = 0;
>         int still_dirty;
>
> -       page = find_lock_page(inode->i_mapping, index);
> -       if (!page)
> +       folio = filemap_lock_folio(inode->i_mapping, index);
> +       if (IS_ERR(folio))
>                 return -ENOENT;
>
> -       wait_on_page_writeback(page);
> +       folio_wait_writeback(folio);
>
> -       first_block = (unsigned long)index <<
> -               (PAGE_SHIFT - inode->i_blkbits);
> -       if (page_has_buffers(page)) {
> -               struct buffer_head *bh;
> -
> -               bh = nilfs_page_get_nth_block(page, block - first_block);
> +       bh = folio_buffers(folio);
> +       if (bh) {
> +               unsigned long first_block = index <<
> +                               (PAGE_SHIFT - inode->i_blkbits);
> +               bh = get_nth_bh(bh, block - first_block);
>                 nilfs_forget_buffer(bh);
>         }
> -       still_dirty = PageDirty(page);
> -       unlock_page(page);
> -       put_page(page);
> +       still_dirty = folio_test_dirty(folio);
> +       folio_unlock(folio);
> +       folio_put(folio);
>
>         if (still_dirty ||
>             invalidate_inode_pages2_range(inode->i_mapping, index, index) != 0)
> --
> 2.40.1
>

Acked-by: Ryusuke Konishi <konishi.ryusuke@...il.com>

Looks good to me.

Thanks,
Ryusuke Konishi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ