Skip to content

Commit b39f7d7

Browse files
Matthew Wilcox (Oracle)brauner
authored andcommitted
fs: Remove three arguments from block_write_end()
block_write_end() looks like it can be used as a ->write_end() implementation. However, it can't as it does not unlock nor put the folio. Since it does not use the 'file', 'mapping' nor 'fsdata' arguments, remove them. Signed-off-by: "Matthew Wilcox (Oracle)" <willy@infradead.org> Link: https://lore.kernel.org/20250624132130.1590285-1-willy@infradead.org Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 06a7053 commit b39f7d7

10 files changed

Lines changed: 13 additions & 19 deletions

File tree

block/fops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ static int blkdev_write_end(struct file *file, struct address_space *mapping,
507507
void *fsdata)
508508
{
509509
int ret;
510-
ret = block_write_end(file, mapping, pos, len, copied, folio, fsdata);
510+
ret = block_write_end(pos, len, copied, folio);
511511

512512
folio_unlock(folio);
513513
folio_put(folio);

fs/buffer.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2270,9 +2270,8 @@ int block_write_begin(struct address_space *mapping, loff_t pos, unsigned len,
22702270
}
22712271
EXPORT_SYMBOL(block_write_begin);
22722272

2273-
int block_write_end(struct file *file, struct address_space *mapping,
2274-
loff_t pos, unsigned len, unsigned copied,
2275-
struct folio *folio, void *fsdata)
2273+
int block_write_end(loff_t pos, unsigned len, unsigned copied,
2274+
struct folio *folio)
22762275
{
22772276
size_t start = pos - folio_pos(folio);
22782277

@@ -2311,7 +2310,7 @@ int generic_write_end(struct file *file, struct address_space *mapping,
23112310
loff_t old_size = inode->i_size;
23122311
bool i_size_changed = false;
23132312

2314-
copied = block_write_end(file, mapping, pos, len, copied, folio, fsdata);
2313+
copied = block_write_end(pos, len, copied, folio);
23152314

23162315
/*
23172316
* No need to use i_size_read() here, the i_size cannot change under us

fs/ext2/dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static void ext2_commit_chunk(struct folio *folio, loff_t pos, unsigned len)
8787
struct inode *dir = mapping->host;
8888

8989
inode_inc_iversion(dir);
90-
block_write_end(NULL, mapping, pos, len, len, folio, NULL);
90+
block_write_end(pos, len, len, folio);
9191

9292
if (pos+len > dir->i_size) {
9393
i_size_write(dir, pos+len);

fs/ext4/inode.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,7 +1424,7 @@ static int ext4_write_end(struct file *file,
14241424
return ext4_write_inline_data_end(inode, pos, len, copied,
14251425
folio);
14261426

1427-
copied = block_write_end(file, mapping, pos, len, copied, folio, fsdata);
1427+
copied = block_write_end(pos, len, copied, folio);
14281428
/*
14291429
* it's important to update i_size while still holding folio lock:
14301430
* page writeout could otherwise come in and zero beyond i_size.
@@ -3144,8 +3144,7 @@ static int ext4_da_do_write_end(struct address_space *mapping,
31443144
* block_write_end() will mark the inode as dirty with I_DIRTY_PAGES
31453145
* flag, which all that's needed to trigger page writeback.
31463146
*/
3147-
copied = block_write_end(NULL, mapping, pos, len, copied,
3148-
folio, NULL);
3147+
copied = block_write_end(pos, len, copied, folio);
31493148
new_i_size = pos + copied;
31503149

31513150
/*

fs/iomap/buffered-io.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -923,8 +923,7 @@ static bool iomap_write_end(struct iomap_iter *iter, size_t len, size_t copied,
923923
if (srcmap->flags & IOMAP_F_BUFFER_HEAD) {
924924
size_t bh_written;
925925

926-
bh_written = block_write_end(NULL, iter->inode->i_mapping, pos,
927-
len, copied, folio, NULL);
926+
bh_written = block_write_end(pos, len, copied, folio);
928927
WARN_ON_ONCE(bh_written != copied && bh_written != 0);
929928
return bh_written == copied;
930929
}

fs/minix/dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static void dir_commit_chunk(struct folio *folio, loff_t pos, unsigned len)
4545
struct address_space *mapping = folio->mapping;
4646
struct inode *dir = mapping->host;
4747

48-
block_write_end(NULL, mapping, pos, len, len, folio, NULL);
48+
block_write_end(pos, len, len, folio);
4949

5050
if (pos+len > dir->i_size) {
5151
i_size_write(dir, pos+len);

fs/nilfs2/dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ static void nilfs_commit_chunk(struct folio *folio,
9696
int err;
9797

9898
nr_dirty = nilfs_page_count_clean_buffers(folio, from, to);
99-
copied = block_write_end(NULL, mapping, pos, len, len, folio, NULL);
99+
copied = block_write_end(pos, len, len, folio);
100100
if (pos + copied > dir->i_size)
101101
i_size_write(dir, pos + copied);
102102
if (IS_DIRSYNC(dir))

fs/nilfs2/recovery.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,8 +560,7 @@ static int nilfs_recover_dsync_blocks(struct the_nilfs *nilfs,
560560
if (unlikely(err))
561561
goto failed_folio;
562562

563-
block_write_end(NULL, inode->i_mapping, pos, blocksize,
564-
blocksize, folio, NULL);
563+
block_write_end(pos, blocksize, blocksize, folio);
565564

566565
folio_unlock(folio);
567566
folio_put(folio);

fs/ufs/dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static void ufs_commit_chunk(struct folio *folio, loff_t pos, unsigned len)
4848
struct inode *dir = mapping->host;
4949

5050
inode_inc_iversion(dir);
51-
block_write_end(NULL, mapping, pos, len, len, folio, NULL);
51+
block_write_end(pos, len, len, folio);
5252
if (pos+len > dir->i_size) {
5353
i_size_write(dir, pos+len);
5454
mark_inode_dirty(dir);

include/linux/buffer_head.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,7 @@ int block_write_begin(struct address_space *mapping, loff_t pos, unsigned len,
262262
struct folio **foliop, get_block_t *get_block);
263263
int __block_write_begin(struct folio *folio, loff_t pos, unsigned len,
264264
get_block_t *get_block);
265-
int block_write_end(struct file *, struct address_space *,
266-
loff_t, unsigned len, unsigned copied,
267-
struct folio *, void *);
265+
int block_write_end(loff_t pos, unsigned len, unsigned copied, struct folio *);
268266
int generic_write_end(struct file *, struct address_space *,
269267
loff_t, unsigned len, unsigned copied,
270268
struct folio *, void *);

0 commit comments

Comments
 (0)