Commit 6c346be9 authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Andrew Morton

nilfs2: convert nilfs_mdt_freeze_buffer to use a folio

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

Link: https://lkml.kernel.org/r/20231016201114.1928083-11-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 4064a0aa
...@@ -560,17 +560,19 @@ int nilfs_mdt_freeze_buffer(struct inode *inode, struct buffer_head *bh) ...@@ -560,17 +560,19 @@ int nilfs_mdt_freeze_buffer(struct inode *inode, struct buffer_head *bh)
{ {
struct nilfs_shadow_map *shadow = NILFS_MDT(inode)->mi_shadow; struct nilfs_shadow_map *shadow = NILFS_MDT(inode)->mi_shadow;
struct buffer_head *bh_frozen; struct buffer_head *bh_frozen;
struct page *page; struct folio *folio;
int blkbits = inode->i_blkbits; int blkbits = inode->i_blkbits;
page = grab_cache_page(shadow->inode->i_mapping, bh->b_folio->index); folio = filemap_grab_folio(shadow->inode->i_mapping,
if (!page) bh->b_folio->index);
return -ENOMEM; if (IS_ERR(folio))
return PTR_ERR(folio);
if (!page_has_buffers(page)) bh_frozen = folio_buffers(folio);
create_empty_buffers(page, 1 << blkbits, 0); if (!bh_frozen)
bh_frozen = folio_create_empty_buffers(folio, 1 << blkbits, 0);
bh_frozen = nilfs_page_get_nth_block(page, bh_offset(bh) >> blkbits); bh_frozen = get_nth_bh(bh_frozen, bh_offset(bh) >> blkbits);
if (!buffer_uptodate(bh_frozen)) if (!buffer_uptodate(bh_frozen))
nilfs_copy_buffer(bh_frozen, bh); nilfs_copy_buffer(bh_frozen, bh);
...@@ -582,8 +584,8 @@ int nilfs_mdt_freeze_buffer(struct inode *inode, struct buffer_head *bh) ...@@ -582,8 +584,8 @@ int nilfs_mdt_freeze_buffer(struct inode *inode, struct buffer_head *bh)
brelse(bh_frozen); /* already frozen */ brelse(bh_frozen); /* already frozen */
} }
unlock_page(page); folio_unlock(folio);
put_page(page); folio_put(folio);
return 0; return 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