Commit 0a88810d authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Andrew Morton

buffer: remove folio_create_empty_buffers()

With all users converted, remove the old create_empty_buffers() and rename
folio_create_empty_buffers() to create_empty_buffers().

Link: https://lkml.kernel.org/r/20231016201114.1928083-28-willy@infradead.orgSigned-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Cc: Andreas Gruenbacher <agruenba@redhat.com>
Cc: Pankaj Raghav <p.raghav@samsung.com>
Cc: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent c9f2480e
...@@ -1641,7 +1641,7 @@ EXPORT_SYMBOL(block_invalidate_folio); ...@@ -1641,7 +1641,7 @@ EXPORT_SYMBOL(block_invalidate_folio);
* block_dirty_folio() via private_lock. try_to_free_buffers * block_dirty_folio() via private_lock. try_to_free_buffers
* is already excluded via the folio lock. * is already excluded via the folio lock.
*/ */
struct buffer_head *folio_create_empty_buffers(struct folio *folio, struct buffer_head *create_empty_buffers(struct folio *folio,
unsigned long blocksize, unsigned long b_state) unsigned long blocksize, unsigned long b_state)
{ {
struct buffer_head *bh, *head, *tail; struct buffer_head *bh, *head, *tail;
...@@ -1672,13 +1672,6 @@ struct buffer_head *folio_create_empty_buffers(struct folio *folio, ...@@ -1672,13 +1672,6 @@ struct buffer_head *folio_create_empty_buffers(struct folio *folio,
return head; return head;
} }
EXPORT_SYMBOL(folio_create_empty_buffers);
void create_empty_buffers(struct page *page,
unsigned long blocksize, unsigned long b_state)
{
folio_create_empty_buffers(page_folio(page), blocksize, b_state);
}
EXPORT_SYMBOL(create_empty_buffers); EXPORT_SYMBOL(create_empty_buffers);
/** /**
...@@ -1778,7 +1771,7 @@ static struct buffer_head *folio_create_buffers(struct folio *folio, ...@@ -1778,7 +1771,7 @@ static struct buffer_head *folio_create_buffers(struct folio *folio,
bh = folio_buffers(folio); bh = folio_buffers(folio);
if (!bh) if (!bh)
bh = folio_create_empty_buffers(folio, bh = create_empty_buffers(folio,
1 << READ_ONCE(inode->i_blkbits), b_state); 1 << READ_ONCE(inode->i_blkbits), b_state);
return bh; return bh;
} }
...@@ -2681,7 +2674,7 @@ int block_truncate_page(struct address_space *mapping, ...@@ -2681,7 +2674,7 @@ int block_truncate_page(struct address_space *mapping,
bh = folio_buffers(folio); bh = folio_buffers(folio);
if (!bh) if (!bh)
bh = folio_create_empty_buffers(folio, blocksize, 0); bh = create_empty_buffers(folio, blocksize, 0);
/* Find the buffer that contains "offset" */ /* Find the buffer that contains "offset" */
offset = offset_in_folio(folio, from); offset = offset_in_folio(folio, from);
......
...@@ -1021,7 +1021,7 @@ static int ext4_block_write_begin(struct folio *folio, loff_t pos, unsigned len, ...@@ -1021,7 +1021,7 @@ static int ext4_block_write_begin(struct folio *folio, loff_t pos, unsigned len,
head = folio_buffers(folio); head = folio_buffers(folio);
if (!head) if (!head)
head = folio_create_empty_buffers(folio, blocksize, 0); head = create_empty_buffers(folio, blocksize, 0);
bbits = ilog2(blocksize); bbits = ilog2(blocksize);
block = (sector_t)folio->index << (PAGE_SHIFT - bbits); block = (sector_t)folio->index << (PAGE_SHIFT - bbits);
...@@ -1151,7 +1151,7 @@ static int ext4_write_begin(struct file *file, struct address_space *mapping, ...@@ -1151,7 +1151,7 @@ static int ext4_write_begin(struct file *file, struct address_space *mapping,
* starting the handle. * starting the handle.
*/ */
if (!folio_buffers(folio)) if (!folio_buffers(folio))
folio_create_empty_buffers(folio, inode->i_sb->s_blocksize, 0); create_empty_buffers(folio, inode->i_sb->s_blocksize, 0);
folio_unlock(folio); folio_unlock(folio);
...@@ -3642,7 +3642,7 @@ static int __ext4_block_zero_page_range(handle_t *handle, ...@@ -3642,7 +3642,7 @@ static int __ext4_block_zero_page_range(handle_t *handle,
bh = folio_buffers(folio); bh = folio_buffers(folio);
if (!bh) if (!bh)
bh = folio_create_empty_buffers(folio, blocksize, 0); bh = create_empty_buffers(folio, blocksize, 0);
/* Find the buffer that contains "offset" */ /* Find the buffer that contains "offset" */
pos = blocksize; pos = blocksize;
......
...@@ -184,7 +184,7 @@ mext_page_mkuptodate(struct folio *folio, unsigned from, unsigned to) ...@@ -184,7 +184,7 @@ mext_page_mkuptodate(struct folio *folio, unsigned from, unsigned to)
blocksize = i_blocksize(inode); blocksize = i_blocksize(inode);
head = folio_buffers(folio); head = folio_buffers(folio);
if (!head) if (!head)
head = folio_create_empty_buffers(folio, blocksize, 0); head = create_empty_buffers(folio, blocksize, 0);
block = (sector_t)folio->index << (PAGE_SHIFT - inode->i_blkbits); block = (sector_t)folio->index << (PAGE_SHIFT - inode->i_blkbits);
for (bh = head, block_start = 0; bh != head || !block_start; for (bh = head, block_start = 0; bh != head || !block_start;
...@@ -380,7 +380,7 @@ move_extent_per_page(struct file *o_filp, struct inode *donor_inode, ...@@ -380,7 +380,7 @@ move_extent_per_page(struct file *o_filp, struct inode *donor_inode,
* but keeping in mind that i_size will not change */ * but keeping in mind that i_size will not change */
bh = folio_buffers(folio[0]); bh = folio_buffers(folio[0]);
if (!bh) if (!bh)
bh = folio_create_empty_buffers(folio[0], bh = create_empty_buffers(folio[0],
1 << orig_inode->i_blkbits, 0); 1 << orig_inode->i_blkbits, 0);
for (i = 0; i < data_offset_in_page; i++) for (i = 0; i < data_offset_in_page; i++)
bh = bh->b_this_page; bh = bh->b_this_page;
......
...@@ -130,7 +130,7 @@ static int __gfs2_jdata_write_folio(struct folio *folio, ...@@ -130,7 +130,7 @@ static int __gfs2_jdata_write_folio(struct folio *folio,
if (folio_test_checked(folio)) { if (folio_test_checked(folio)) {
folio_clear_checked(folio); folio_clear_checked(folio);
if (!folio_buffers(folio)) { if (!folio_buffers(folio)) {
folio_create_empty_buffers(folio, create_empty_buffers(folio,
inode->i_sb->s_blocksize, inode->i_sb->s_blocksize,
BIT(BH_Dirty)|BIT(BH_Uptodate)); BIT(BH_Dirty)|BIT(BH_Uptodate));
} }
......
...@@ -71,7 +71,7 @@ static int gfs2_unstuffer_folio(struct gfs2_inode *ip, struct buffer_head *dibh, ...@@ -71,7 +71,7 @@ static int gfs2_unstuffer_folio(struct gfs2_inode *ip, struct buffer_head *dibh,
struct buffer_head *bh = folio_buffers(folio); struct buffer_head *bh = folio_buffers(folio);
if (!bh) if (!bh)
bh = folio_create_empty_buffers(folio, bh = create_empty_buffers(folio,
BIT(inode->i_blkbits), BIT(BH_Uptodate)); BIT(inode->i_blkbits), BIT(BH_Uptodate));
if (!buffer_mapped(bh)) if (!buffer_mapped(bh))
......
...@@ -134,7 +134,7 @@ struct buffer_head *gfs2_getbuf(struct gfs2_glock *gl, u64 blkno, int create) ...@@ -134,7 +134,7 @@ struct buffer_head *gfs2_getbuf(struct gfs2_glock *gl, u64 blkno, int create)
mapping_gfp_mask(mapping) | __GFP_NOFAIL); mapping_gfp_mask(mapping) | __GFP_NOFAIL);
bh = folio_buffers(folio); bh = folio_buffers(folio);
if (!bh) if (!bh)
bh = folio_create_empty_buffers(folio, bh = create_empty_buffers(folio,
sdp->sd_sb.sb_bsize, 0); sdp->sd_sb.sb_bsize, 0);
} else { } else {
folio = __filemap_get_folio(mapping, index, folio = __filemap_get_folio(mapping, index,
......
...@@ -763,7 +763,7 @@ static int gfs2_write_buf_to_page(struct gfs2_sbd *sdp, unsigned long index, ...@@ -763,7 +763,7 @@ static int gfs2_write_buf_to_page(struct gfs2_sbd *sdp, unsigned long index,
return PTR_ERR(folio); return PTR_ERR(folio);
bh = folio_buffers(folio); bh = folio_buffers(folio);
if (!bh) if (!bh)
bh = folio_create_empty_buffers(folio, bsize, 0); bh = create_empty_buffers(folio, bsize, 0);
for (;;) { for (;;) {
/* Find the beginning block within the folio */ /* Find the beginning block within the folio */
......
...@@ -119,7 +119,7 @@ static void map_buffer_to_folio(struct folio *folio, struct buffer_head *bh, ...@@ -119,7 +119,7 @@ static void map_buffer_to_folio(struct folio *folio, struct buffer_head *bh,
folio_mark_uptodate(folio); folio_mark_uptodate(folio);
return; return;
} }
head = folio_create_empty_buffers(folio, i_blocksize(inode), 0); head = create_empty_buffers(folio, i_blocksize(inode), 0);
} }
page_bh = head; page_bh = head;
......
...@@ -568,7 +568,7 @@ int nilfs_mdt_freeze_buffer(struct inode *inode, struct buffer_head *bh) ...@@ -568,7 +568,7 @@ int nilfs_mdt_freeze_buffer(struct inode *inode, struct buffer_head *bh)
bh_frozen = folio_buffers(folio); bh_frozen = folio_buffers(folio);
if (!bh_frozen) if (!bh_frozen)
bh_frozen = folio_create_empty_buffers(folio, 1 << blkbits, 0); bh_frozen = create_empty_buffers(folio, 1 << blkbits, 0);
bh_frozen = get_nth_bh(bh_frozen, bh_offset(bh) >> blkbits); bh_frozen = get_nth_bh(bh_frozen, bh_offset(bh) >> blkbits);
......
...@@ -34,7 +34,7 @@ static struct buffer_head *__nilfs_get_folio_block(struct folio *folio, ...@@ -34,7 +34,7 @@ static struct buffer_head *__nilfs_get_folio_block(struct folio *folio,
struct buffer_head *bh = folio_buffers(folio); struct buffer_head *bh = folio_buffers(folio);
if (!bh) if (!bh)
bh = folio_create_empty_buffers(folio, 1 << blkbits, b_state); bh = create_empty_buffers(folio, 1 << blkbits, b_state);
first_block = (unsigned long)index << (PAGE_SHIFT - blkbits); first_block = (unsigned long)index << (PAGE_SHIFT - blkbits);
bh = get_nth_bh(bh, block - first_block); bh = get_nth_bh(bh, block - first_block);
...@@ -204,7 +204,7 @@ static void nilfs_copy_folio(struct folio *dst, struct folio *src, ...@@ -204,7 +204,7 @@ static void nilfs_copy_folio(struct folio *dst, struct folio *src,
sbh = folio_buffers(src); sbh = folio_buffers(src);
dbh = folio_buffers(dst); dbh = folio_buffers(dst);
if (!dbh) if (!dbh)
dbh = folio_create_empty_buffers(dst, sbh->b_size, 0); dbh = create_empty_buffers(dst, sbh->b_size, 0);
if (copy_dirty) if (copy_dirty)
mask |= BIT(BH_Dirty); mask |= BIT(BH_Dirty);
......
...@@ -732,7 +732,7 @@ static size_t nilfs_lookup_dirty_data_buffers(struct inode *inode, ...@@ -732,7 +732,7 @@ static size_t nilfs_lookup_dirty_data_buffers(struct inode *inode,
} }
head = folio_buffers(folio); head = folio_buffers(folio);
if (!head) if (!head)
head = folio_create_empty_buffers(folio, head = create_empty_buffers(folio,
i_blocksize(inode), 0); i_blocksize(inode), 0);
folio_unlock(folio); folio_unlock(folio);
......
...@@ -189,7 +189,7 @@ static int ntfs_read_block(struct folio *folio) ...@@ -189,7 +189,7 @@ static int ntfs_read_block(struct folio *folio)
head = folio_buffers(folio); head = folio_buffers(folio);
if (!head) if (!head)
head = folio_create_empty_buffers(folio, blocksize, 0); head = create_empty_buffers(folio, blocksize, 0);
bh = head; bh = head;
/* /*
...@@ -555,7 +555,7 @@ static int ntfs_write_block(struct folio *folio, struct writeback_control *wbc) ...@@ -555,7 +555,7 @@ static int ntfs_write_block(struct folio *folio, struct writeback_control *wbc)
head = folio_buffers(folio); head = folio_buffers(folio);
if (!head) { if (!head) {
BUG_ON(!folio_test_uptodate(folio)); BUG_ON(!folio_test_uptodate(folio));
head = folio_create_empty_buffers(folio, blocksize, head = create_empty_buffers(folio, blocksize,
(1 << BH_Uptodate) | (1 << BH_Dirty)); (1 << BH_Uptodate) | (1 << BH_Dirty));
} }
bh = head; bh = head;
......
...@@ -625,7 +625,7 @@ static int ntfs_prepare_pages_for_non_resident_write(struct page **pages, ...@@ -625,7 +625,7 @@ static int ntfs_prepare_pages_for_non_resident_write(struct page **pages,
* create_empty_buffers() will create uptodate/dirty * create_empty_buffers() will create uptodate/dirty
* buffers if the folio is uptodate/dirty. * buffers if the folio is uptodate/dirty.
*/ */
head = folio_create_empty_buffers(folio, blocksize, 0); head = create_empty_buffers(folio, blocksize, 0);
bh = head; bh = head;
do { do {
VCN cdelta; VCN cdelta;
......
...@@ -203,7 +203,7 @@ static int ntfs_zero_range(struct inode *inode, u64 vbo, u64 vbo_to) ...@@ -203,7 +203,7 @@ static int ntfs_zero_range(struct inode *inode, u64 vbo, u64 vbo_to)
head = folio_buffers(folio); head = folio_buffers(folio);
if (!head) if (!head)
head = folio_create_empty_buffers(folio, blocksize, 0); head = create_empty_buffers(folio, blocksize, 0);
bh = head; bh = head;
bh_off = 0; bh_off = 0;
......
...@@ -601,7 +601,7 @@ int ocfs2_map_page_blocks(struct page *page, u64 *p_blkno, ...@@ -601,7 +601,7 @@ int ocfs2_map_page_blocks(struct page *page, u64 *p_blkno,
head = folio_buffers(folio); head = folio_buffers(folio);
if (!head) if (!head)
head = folio_create_empty_buffers(folio, bsize, 0); head = create_empty_buffers(folio, bsize, 0);
for (bh = head, block_start = 0; bh != head || !block_start; for (bh = head, block_start = 0; bh != head || !block_start;
bh = bh->b_this_page, block_start += bsize) { bh = bh->b_this_page, block_start += bsize) {
......
...@@ -2539,7 +2539,7 @@ static int reiserfs_write_full_folio(struct folio *folio, ...@@ -2539,7 +2539,7 @@ static int reiserfs_write_full_folio(struct folio *folio,
*/ */
head = folio_buffers(folio); head = folio_buffers(folio);
if (!head) if (!head)
head = folio_create_empty_buffers(folio, s->s_blocksize, head = create_empty_buffers(folio, s->s_blocksize,
(1 << BH_Dirty) | (1 << BH_Uptodate)); (1 << BH_Dirty) | (1 << BH_Uptodate));
/* /*
......
...@@ -264,6 +264,6 @@ struct folio *ufs_get_locked_folio(struct address_space *mapping, ...@@ -264,6 +264,6 @@ struct folio *ufs_get_locked_folio(struct address_space *mapping,
} }
} }
if (!folio_buffers(folio)) if (!folio_buffers(folio))
folio_create_empty_buffers(folio, 1 << inode->i_blkbits, 0); create_empty_buffers(folio, 1 << inode->i_blkbits, 0);
return folio; return folio;
} }
...@@ -201,9 +201,7 @@ struct buffer_head *folio_alloc_buffers(struct folio *folio, unsigned long size, ...@@ -201,9 +201,7 @@ struct buffer_head *folio_alloc_buffers(struct folio *folio, unsigned long size,
gfp_t gfp); gfp_t gfp);
struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size, struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size,
bool retry); bool retry);
void create_empty_buffers(struct page *, unsigned long, struct buffer_head *create_empty_buffers(struct folio *folio,
unsigned long b_state);
struct buffer_head *folio_create_empty_buffers(struct folio *folio,
unsigned long blocksize, unsigned long b_state); unsigned long blocksize, unsigned long b_state);
void end_buffer_read_sync(struct buffer_head *bh, int uptodate); void end_buffer_read_sync(struct buffer_head *bh, int uptodate);
void end_buffer_write_sync(struct buffer_head *bh, int uptodate); void end_buffer_write_sync(struct buffer_head *bh, int uptodate);
......
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