Commit 1a846bf3 authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Andrew Morton

nilfs2: convert nilfs_mdt_forget_block() to use a folio

Remove a number of folio->page->folio conversions.

Link: https://lkml.kernel.org/r/20231016201114.1928083-14-willy@infradead.orgSigned-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
Cc: Andreas Gruenbacher <agruenba@redhat.com>
Cc: Pankaj Raghav <p.raghav@samsung.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 4093602d
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment