Skip to content

Commit 63a2384

Browse files
Matthew Wilcox (Oracle)akpm00
authored andcommitted
fs: convert block_commit_write() to take a folio
All callers now have a folio, so pass it in instead of converting folio->page->folio. Link: https://lkml.kernel.org/r/20250217192009.437916-1-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent fcd807a commit 63a2384

File tree

8 files changed

+12
-18
lines changed

8 files changed

+12
-18
lines changed

fs/buffer.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2166,7 +2166,7 @@ int __block_write_begin(struct folio *folio, loff_t pos, unsigned len,
21662166
}
21672167
EXPORT_SYMBOL(__block_write_begin);
21682168

2169-
static void __block_commit_write(struct folio *folio, size_t from, size_t to)
2169+
void block_commit_write(struct folio *folio, size_t from, size_t to)
21702170
{
21712171
size_t block_start, block_end;
21722172
bool partial = false;
@@ -2204,6 +2204,7 @@ static void __block_commit_write(struct folio *folio, size_t from, size_t to)
22042204
if (!partial)
22052205
folio_mark_uptodate(folio);
22062206
}
2207+
EXPORT_SYMBOL(block_commit_write);
22072208

22082209
/*
22092210
* block_write_begin takes care of the basic task of block allocation and
@@ -2262,7 +2263,7 @@ int block_write_end(struct file *file, struct address_space *mapping,
22622263
flush_dcache_folio(folio);
22632264

22642265
/* This could be a short (even 0-length) commit */
2265-
__block_commit_write(folio, start, start + copied);
2266+
block_commit_write(folio, start, start + copied);
22662267

22672268
return copied;
22682269
}
@@ -2578,13 +2579,6 @@ int cont_write_begin(struct file *file, struct address_space *mapping,
25782579
}
25792580
EXPORT_SYMBOL(cont_write_begin);
25802581

2581-
void block_commit_write(struct page *page, unsigned from, unsigned to)
2582-
{
2583-
struct folio *folio = page_folio(page);
2584-
__block_commit_write(folio, from, to);
2585-
}
2586-
EXPORT_SYMBOL(block_commit_write);
2587-
25882582
/*
25892583
* block_page_mkwrite() is not allowed to change the file size as it gets
25902584
* called from a page fault handler when a page is first dirtied. Hence we must
@@ -2630,7 +2624,7 @@ int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
26302624
if (unlikely(ret))
26312625
goto out_unlock;
26322626

2633-
__block_commit_write(folio, 0, end);
2627+
block_commit_write(folio, 0, end);
26342628

26352629
folio_mark_dirty(folio);
26362630
folio_wait_stable(folio);

fs/ext4/inline.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ static int ext4_convert_inline_data_to_extent(struct address_space *mapping,
637637
goto retry;
638638

639639
if (folio)
640-
block_commit_write(&folio->page, from, to);
640+
block_commit_write(folio, from, to);
641641
out:
642642
if (folio) {
643643
folio_unlock(folio);

fs/ext4/move_extent.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ move_extent_per_page(struct file *o_filp, struct inode *donor_inode,
399399
bh = bh->b_this_page;
400400
}
401401

402-
block_commit_write(&folio[0]->page, from, from + replaced_size);
402+
block_commit_write(folio[0], from, from + replaced_size);
403403

404404
/* Even in case of data=writeback it is reasonable to pin
405405
* inode to transaction, to prevent unexpected data loss */

fs/iomap/buffered-io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1484,7 +1484,7 @@ static loff_t iomap_folio_mkwrite_iter(struct iomap_iter *iter,
14841484
&iter->iomap);
14851485
if (ret)
14861486
return ret;
1487-
block_commit_write(&folio->page, 0, length);
1487+
block_commit_write(folio, 0, length);
14881488
} else {
14891489
WARN_ON_ONCE(!folio_test_uptodate(folio));
14901490
folio_mark_dirty(folio);

fs/ocfs2/aops.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ static void ocfs2_write_failure(struct inode *inode,
920920
ocfs2_jbd2_inode_add_write(wc->w_handle, inode,
921921
user_pos, user_len);
922922

923-
block_commit_write(&folio->page, from, to);
923+
block_commit_write(folio, from, to);
924924
}
925925
}
926926
}
@@ -2012,7 +2012,7 @@ int ocfs2_write_end_nolock(struct address_space *mapping, loff_t pos,
20122012
ocfs2_jbd2_inode_add_write(handle, inode,
20132013
start_byte, length);
20142014
}
2015-
block_commit_write(&folio->page, from, to);
2015+
block_commit_write(folio, from, to);
20162016
}
20172017
}
20182018

fs/ocfs2/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from,
813813

814814

815815
/* must not update i_size! */
816-
block_commit_write(&folio->page, block_start + 1, block_start + 1);
816+
block_commit_write(folio, block_start + 1, block_start + 1);
817817
}
818818

819819
/*

fs/udf/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static vm_fault_t udf_page_mkwrite(struct vm_fault *vmf)
6969
goto out_unlock;
7070
}
7171

72-
block_commit_write(&folio->page, 0, end);
72+
block_commit_write(folio, 0, end);
7373
out_dirty:
7474
folio_mark_dirty(folio);
7575
folio_wait_stable(folio);

include/linux/buffer_head.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ int cont_write_begin(struct file *, struct address_space *, loff_t,
271271
unsigned, struct folio **, void **,
272272
get_block_t *, loff_t *);
273273
int generic_cont_expand_simple(struct inode *inode, loff_t size);
274-
void block_commit_write(struct page *page, unsigned int from, unsigned int to);
274+
void block_commit_write(struct folio *folio, size_t from, size_t to);
275275
int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
276276
get_block_t get_block);
277277
sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *);

0 commit comments

Comments
 (0)