Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fs: change write_begin/write_end interface to take struct kiocb *

Change the address_space_operations callbacks write_begin() and
write_end() to take struct kiocb * as the first argument instead of
struct file *.

Update all affected function prototypes, implementations, call sites,
and related documentation across VFS, filesystems, and block layer.

Part of a series refactoring address_space_operations write_begin and
write_end callbacks to use struct kiocb for passing write context and
flags.

Signed-off-by: Taotao Chen <chentaotao@didiglobal.com>
Link: https://lore.kernel.org/20250716093559.217344-4-chentaotao@didiglobal.com
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Taotao Chen and committed by
Christian Brauner
e9d8e2bf 048832a3

+267 -202
+2 -2
Documentation/filesystems/locking.rst
··· 253 253 int (*writepages)(struct address_space *, struct writeback_control *); 254 254 bool (*dirty_folio)(struct address_space *, struct folio *folio); 255 255 void (*readahead)(struct readahead_control *); 256 - int (*write_begin)(struct file *, struct address_space *mapping, 256 + int (*write_begin)(const struct kiocb *, struct address_space *mapping, 257 257 loff_t pos, unsigned len, 258 258 struct folio **foliop, void **fsdata); 259 - int (*write_end)(struct file *, struct address_space *mapping, 259 + int (*write_end)(const struct kiocb *, struct address_space *mapping, 260 260 loff_t pos, unsigned len, unsigned copied, 261 261 struct folio *folio, void *fsdata); 262 262 sector_t (*bmap)(struct address_space *, sector_t);
+3 -3
Documentation/filesystems/vfs.rst
··· 823 823 int (*writepages)(struct address_space *, struct writeback_control *); 824 824 bool (*dirty_folio)(struct address_space *, struct folio *); 825 825 void (*readahead)(struct readahead_control *); 826 - int (*write_begin)(struct file *, struct address_space *mapping, 826 + int (*write_begin)(const struct kiocb *, struct address_space *mapping, 827 827 loff_t pos, unsigned len, 828 - struct page **pagep, void **fsdata); 829 - int (*write_end)(struct file *, struct address_space *mapping, 828 + struct page **pagep, void **fsdata); 829 + int (*write_end)(const struct kiocb *, struct address_space *mapping, 830 830 loff_t pos, unsigned len, unsigned copied, 831 831 struct folio *folio, void *fsdata); 832 832 sector_t (*bmap)(struct address_space *, sector_t);
+8 -5
block/fops.c
··· 496 496 mpage_readahead(rac, blkdev_get_block); 497 497 } 498 498 499 - static int blkdev_write_begin(struct file *file, struct address_space *mapping, 500 - loff_t pos, unsigned len, struct folio **foliop, void **fsdata) 499 + static int blkdev_write_begin(const struct kiocb *iocb, 500 + struct address_space *mapping, loff_t pos, 501 + unsigned len, struct folio **foliop, 502 + void **fsdata) 501 503 { 502 504 return block_write_begin(mapping, pos, len, foliop, blkdev_get_block); 503 505 } 504 506 505 - static int blkdev_write_end(struct file *file, struct address_space *mapping, 506 - loff_t pos, unsigned len, unsigned copied, struct folio *folio, 507 - void *fsdata) 507 + static int blkdev_write_end(const struct kiocb *iocb, 508 + struct address_space *mapping, 509 + loff_t pos, unsigned len, unsigned copied, 510 + struct folio *folio, void *fsdata) 508 511 { 509 512 int ret; 510 513 ret = block_write_end(pos, len, copied, folio);
+5 -4
fs/adfs/inode.c
··· 53 53 truncate_pagecache(inode, inode->i_size); 54 54 } 55 55 56 - static int adfs_write_begin(struct file *file, struct address_space *mapping, 57 - loff_t pos, unsigned len, 58 - struct folio **foliop, void **fsdata) 56 + static int adfs_write_begin(const struct kiocb *iocb, 57 + struct address_space *mapping, 58 + loff_t pos, unsigned len, 59 + struct folio **foliop, void **fsdata) 59 60 { 60 61 int ret; 61 62 62 - ret = cont_write_begin(file, mapping, pos, len, foliop, fsdata, 63 + ret = cont_write_begin(iocb, mapping, pos, len, foliop, fsdata, 63 64 adfs_get_block, 64 65 &ADFS_I(mapping->host)->mmu_private); 65 66 if (unlikely(ret))
+15 -11
fs/affs/file.c
··· 415 415 return ret; 416 416 } 417 417 418 - static int affs_write_begin(struct file *file, struct address_space *mapping, 419 - loff_t pos, unsigned len, 420 - struct folio **foliop, void **fsdata) 418 + static int affs_write_begin(const struct kiocb *iocb, 419 + struct address_space *mapping, 420 + loff_t pos, unsigned len, 421 + struct folio **foliop, void **fsdata) 421 422 { 422 423 int ret; 423 424 424 - ret = cont_write_begin(file, mapping, pos, len, foliop, fsdata, 425 + ret = cont_write_begin(iocb, mapping, pos, len, foliop, fsdata, 425 426 affs_get_block, 426 427 &AFFS_I(mapping->host)->mmu_private); 427 428 if (unlikely(ret)) ··· 431 430 return ret; 432 431 } 433 432 434 - static int affs_write_end(struct file *file, struct address_space *mapping, 435 - loff_t pos, unsigned int len, unsigned int copied, 433 + static int affs_write_end(const struct kiocb *iocb, 434 + struct address_space *mapping, loff_t pos, 435 + unsigned int len, unsigned int copied, 436 436 struct folio *folio, void *fsdata) 437 437 { 438 438 struct inode *inode = mapping->host; 439 439 int ret; 440 440 441 - ret = generic_write_end(file, mapping, pos, len, copied, folio, fsdata); 441 + ret = generic_write_end(iocb, mapping, pos, len, copied, folio, fsdata); 442 442 443 443 /* Clear Archived bit on file writes, as AmigaOS would do */ 444 444 if (AFFS_I(inode)->i_protect & FIBF_ARCHIVED) { ··· 647 645 return err; 648 646 } 649 647 650 - static int affs_write_begin_ofs(struct file *file, struct address_space *mapping, 648 + static int affs_write_begin_ofs(const struct kiocb *iocb, 649 + struct address_space *mapping, 651 650 loff_t pos, unsigned len, 652 651 struct folio **foliop, void **fsdata) 653 652 { ··· 687 684 return err; 688 685 } 689 686 690 - static int affs_write_end_ofs(struct file *file, struct address_space *mapping, 691 - loff_t pos, unsigned len, unsigned copied, 692 - struct folio *folio, void *fsdata) 687 + static int affs_write_end_ofs(const struct kiocb *iocb, 688 + struct address_space *mapping, 689 + loff_t pos, unsigned len, unsigned copied, 690 + struct folio *folio, void *fsdata) 693 691 { 694 692 struct inode *inode = mapping->host; 695 693 struct super_block *sb = inode->i_sb;
+2 -2
fs/bcachefs/fs-io-buffered.c
··· 674 674 675 675 /* buffered writes: */ 676 676 677 - int bch2_write_begin(struct file *file, struct address_space *mapping, 677 + int bch2_write_begin(const struct kiocb *iocb, struct address_space *mapping, 678 678 loff_t pos, unsigned len, 679 679 struct folio **foliop, void **fsdata) 680 680 { ··· 757 757 return bch2_err_class(ret); 758 758 } 759 759 760 - int bch2_write_end(struct file *file, struct address_space *mapping, 760 + int bch2_write_end(const struct kiocb *iocb, struct address_space *mapping, 761 761 loff_t pos, unsigned len, unsigned copied, 762 762 struct folio *folio, void *fsdata) 763 763 {
+2 -2
fs/bcachefs/fs-io-buffered.h
··· 10 10 int bch2_writepages(struct address_space *, struct writeback_control *); 11 11 void bch2_readahead(struct readahead_control *); 12 12 13 - int bch2_write_begin(struct file *, struct address_space *, loff_t pos, 13 + int bch2_write_begin(const struct kiocb *, struct address_space *, loff_t pos, 14 14 unsigned len, struct folio **, void **); 15 - int bch2_write_end(struct file *, struct address_space *, loff_t, 15 + int bch2_write_end(const struct kiocb *, struct address_space *, loff_t, 16 16 unsigned len, unsigned copied, struct folio *, void *); 17 17 18 18 ssize_t bch2_write_iter(struct kiocb *, struct iov_iter *);
+4 -3
fs/bfs/file.c
··· 170 170 truncate_pagecache(inode, inode->i_size); 171 171 } 172 172 173 - static int bfs_write_begin(struct file *file, struct address_space *mapping, 174 - loff_t pos, unsigned len, 175 - struct folio **foliop, void **fsdata) 173 + static int bfs_write_begin(const struct kiocb *iocb, 174 + struct address_space *mapping, 175 + loff_t pos, unsigned len, 176 + struct folio **foliop, void **fsdata) 176 177 { 177 178 int ret; 178 179
+13 -13
fs/buffer.c
··· 2297 2297 } 2298 2298 EXPORT_SYMBOL(block_write_end); 2299 2299 2300 - int generic_write_end(struct file *file, struct address_space *mapping, 2301 - loff_t pos, unsigned len, unsigned copied, 2302 - struct folio *folio, void *fsdata) 2300 + int generic_write_end(const struct kiocb *iocb, struct address_space *mapping, 2301 + loff_t pos, unsigned len, unsigned copied, 2302 + struct folio *folio, void *fsdata) 2303 2303 { 2304 2304 struct inode *inode = mapping->host; 2305 2305 loff_t old_size = inode->i_size; ··· 2494 2494 } 2495 2495 EXPORT_SYMBOL(generic_cont_expand_simple); 2496 2496 2497 - static int cont_expand_zero(struct file *file, struct address_space *mapping, 2497 + static int cont_expand_zero(const struct kiocb *iocb, 2498 + struct address_space *mapping, 2498 2499 loff_t pos, loff_t *bytes) 2499 2500 { 2500 2501 struct inode *inode = mapping->host; ··· 2519 2518 } 2520 2519 len = PAGE_SIZE - zerofrom; 2521 2520 2522 - err = aops->write_begin(file, mapping, curpos, len, 2521 + err = aops->write_begin(iocb, mapping, curpos, len, 2523 2522 &folio, &fsdata); 2524 2523 if (err) 2525 2524 goto out; 2526 2525 folio_zero_range(folio, offset_in_folio(folio, curpos), len); 2527 - err = aops->write_end(file, mapping, curpos, len, len, 2526 + err = aops->write_end(iocb, mapping, curpos, len, len, 2528 2527 folio, fsdata); 2529 2528 if (err < 0) 2530 2529 goto out; ··· 2552 2551 } 2553 2552 len = offset - zerofrom; 2554 2553 2555 - err = aops->write_begin(file, mapping, curpos, len, 2554 + err = aops->write_begin(iocb, mapping, curpos, len, 2556 2555 &folio, &fsdata); 2557 2556 if (err) 2558 2557 goto out; 2559 2558 folio_zero_range(folio, offset_in_folio(folio, curpos), len); 2560 - err = aops->write_end(file, mapping, curpos, len, len, 2559 + err = aops->write_end(iocb, mapping, curpos, len, len, 2561 2560 folio, fsdata); 2562 2561 if (err < 0) 2563 2562 goto out; ··· 2572 2571 * For moronic filesystems that do not allow holes in file. 2573 2572 * We may have to extend the file. 2574 2573 */ 2575 - int cont_write_begin(struct file *file, struct address_space *mapping, 2576 - loff_t pos, unsigned len, 2577 - struct folio **foliop, void **fsdata, 2578 - get_block_t *get_block, loff_t *bytes) 2574 + int cont_write_begin(const struct kiocb *iocb, struct address_space *mapping, 2575 + loff_t pos, unsigned len, struct folio **foliop, 2576 + void **fsdata, get_block_t *get_block, loff_t *bytes) 2579 2577 { 2580 2578 struct inode *inode = mapping->host; 2581 2579 unsigned int blocksize = i_blocksize(inode); 2582 2580 unsigned int zerofrom; 2583 2581 int err; 2584 2582 2585 - err = cont_expand_zero(file, mapping, pos, bytes); 2583 + err = cont_expand_zero(iocb, mapping, pos, bytes); 2586 2584 if (err) 2587 2585 return err; 2588 2586
+7 -3
fs/ceph/addr.c
··· 1864 1864 * We are only allowed to write into/dirty the page if the page is 1865 1865 * clean, or already dirty within the same snap context. 1866 1866 */ 1867 - static int ceph_write_begin(struct file *file, struct address_space *mapping, 1867 + static int ceph_write_begin(const struct kiocb *iocb, 1868 + struct address_space *mapping, 1868 1869 loff_t pos, unsigned len, 1869 1870 struct folio **foliop, void **fsdata) 1870 1871 { 1872 + struct file *file = iocb->ki_filp; 1871 1873 struct inode *inode = file_inode(file); 1872 1874 struct ceph_inode_info *ci = ceph_inode(inode); 1873 1875 int r; ··· 1887 1885 * we don't do anything in here that simple_write_end doesn't do 1888 1886 * except adjust dirty page accounting 1889 1887 */ 1890 - static int ceph_write_end(struct file *file, struct address_space *mapping, 1891 - loff_t pos, unsigned len, unsigned copied, 1888 + static int ceph_write_end(const struct kiocb *iocb, 1889 + struct address_space *mapping, loff_t pos, 1890 + unsigned len, unsigned copied, 1892 1891 struct folio *folio, void *fsdata) 1893 1892 { 1893 + struct file *file = iocb->ki_filp; 1894 1894 struct inode *inode = file_inode(file); 1895 1895 struct ceph_client *cl = ceph_inode_to_client(inode); 1896 1896 bool check_cap = false;
+5 -5
fs/ecryptfs/mmap.c
··· 228 228 229 229 /** 230 230 * ecryptfs_write_begin 231 - * @file: The eCryptfs file 231 + * @iocb: I/O control block for the eCryptfs file 232 232 * @mapping: The eCryptfs object 233 233 * @pos: The file offset at which to start writing 234 234 * @len: Length of the write ··· 239 239 * 240 240 * Returns zero on success; non-zero otherwise 241 241 */ 242 - static int ecryptfs_write_begin(struct file *file, 242 + static int ecryptfs_write_begin(const struct kiocb *iocb, 243 243 struct address_space *mapping, 244 244 loff_t pos, unsigned len, 245 245 struct folio **foliop, void **fsdata) ··· 322 322 * Note, this will increase i_size. */ 323 323 if (index != 0) { 324 324 if (prev_page_end_size > i_size_read(mapping->host)) { 325 - rc = ecryptfs_truncate(file->f_path.dentry, 325 + rc = ecryptfs_truncate(iocb->ki_filp->f_path.dentry, 326 326 prev_page_end_size); 327 327 if (rc) { 328 328 printk(KERN_ERR "%s: Error on attempt to " ··· 429 429 430 430 /** 431 431 * ecryptfs_write_end 432 - * @file: The eCryptfs file object 432 + * @iocb: I/O control block for the eCryptfs file 433 433 * @mapping: The eCryptfs object 434 434 * @pos: The file position 435 435 * @len: The length of the data (unused) ··· 437 437 * @folio: The eCryptfs folio 438 438 * @fsdata: The fsdata (unused) 439 439 */ 440 - static int ecryptfs_write_end(struct file *file, 440 + static int ecryptfs_write_end(const struct kiocb *iocb, 441 441 struct address_space *mapping, 442 442 loff_t pos, unsigned len, unsigned copied, 443 443 struct folio *folio, void *fsdata)
+5 -6
fs/exfat/file.c
··· 532 532 return blkdev_issue_flush(inode->i_sb->s_bdev); 533 533 } 534 534 535 - static int exfat_extend_valid_size(struct file *file, loff_t new_valid_size) 535 + static int exfat_extend_valid_size(struct inode *inode, loff_t new_valid_size) 536 536 { 537 537 int err; 538 538 loff_t pos; 539 - struct inode *inode = file_inode(file); 540 539 struct exfat_inode_info *ei = EXFAT_I(inode); 541 540 struct address_space *mapping = inode->i_mapping; 542 541 const struct address_space_operations *ops = mapping->a_ops; ··· 550 551 if (pos + len > new_valid_size) 551 552 len = new_valid_size - pos; 552 553 553 - err = ops->write_begin(file, mapping, pos, len, &folio, NULL); 554 + err = ops->write_begin(NULL, mapping, pos, len, &folio, NULL); 554 555 if (err) 555 556 goto out; 556 557 557 558 off = offset_in_folio(folio, pos); 558 559 folio_zero_new_buffers(folio, off, off + len); 559 560 560 - err = ops->write_end(file, mapping, pos, len, len, folio, NULL); 561 + err = ops->write_end(NULL, mapping, pos, len, len, folio, NULL); 561 562 if (err < 0) 562 563 goto out; 563 564 pos += len; ··· 603 604 } 604 605 605 606 if (pos > valid_size) { 606 - ret = exfat_extend_valid_size(file, pos); 607 + ret = exfat_extend_valid_size(inode, pos); 607 608 if (ret < 0 && ret != -ENOSPC) { 608 609 exfat_err(inode->i_sb, 609 610 "write: fail to zero from %llu to %llu(%zd)", ··· 664 665 start + vma->vm_end - vma->vm_start); 665 666 666 667 if (ei->valid_size < end) { 667 - err = exfat_extend_valid_size(file, end); 668 + err = exfat_extend_valid_size(inode, end); 668 669 if (err < 0) { 669 670 inode_unlock(inode); 670 671 return vmf_fs_error(err);
+9 -7
fs/exfat/inode.c
··· 446 446 } 447 447 } 448 448 449 - static int exfat_write_begin(struct file *file, struct address_space *mapping, 450 - loff_t pos, unsigned int len, 451 - struct folio **foliop, void **fsdata) 449 + static int exfat_write_begin(const struct kiocb *iocb, 450 + struct address_space *mapping, 451 + loff_t pos, unsigned int len, 452 + struct folio **foliop, void **fsdata) 452 453 { 453 454 int ret; 454 455 ··· 464 463 return ret; 465 464 } 466 465 467 - static int exfat_write_end(struct file *file, struct address_space *mapping, 468 - loff_t pos, unsigned int len, unsigned int copied, 469 - struct folio *folio, void *fsdata) 466 + static int exfat_write_end(const struct kiocb *iocb, 467 + struct address_space *mapping, 468 + loff_t pos, unsigned int len, unsigned int copied, 469 + struct folio *folio, void *fsdata) 470 470 { 471 471 struct inode *inode = mapping->host; 472 472 struct exfat_inode_info *ei = EXFAT_I(inode); 473 473 int err; 474 474 475 - err = generic_write_end(file, mapping, pos, len, copied, folio, fsdata); 475 + err = generic_write_end(iocb, mapping, pos, len, copied, folio, fsdata); 476 476 if (err < len) 477 477 exfat_write_failed(mapping, pos+len); 478 478
+6 -5
fs/ext2/inode.c
··· 915 915 } 916 916 917 917 static int 918 - ext2_write_begin(struct file *file, struct address_space *mapping, 918 + ext2_write_begin(const struct kiocb *iocb, struct address_space *mapping, 919 919 loff_t pos, unsigned len, struct folio **foliop, void **fsdata) 920 920 { 921 921 int ret; ··· 926 926 return ret; 927 927 } 928 928 929 - static int ext2_write_end(struct file *file, struct address_space *mapping, 930 - loff_t pos, unsigned len, unsigned copied, 931 - struct folio *folio, void *fsdata) 929 + static int ext2_write_end(const struct kiocb *iocb, 930 + struct address_space *mapping, 931 + loff_t pos, unsigned len, unsigned copied, 932 + struct folio *folio, void *fsdata) 932 933 { 933 934 int ret; 934 935 935 - ret = generic_write_end(file, mapping, pos, len, copied, folio, fsdata); 936 + ret = generic_write_end(iocb, mapping, pos, len, copied, folio, fsdata); 936 937 if (ret < len) 937 938 ext2_write_failed(mapping, pos + len); 938 939 return ret;
+10 -8
fs/ext4/inode.c
··· 1252 1252 * and the ext4_write_end(). So doing the jbd2_journal_start at the start of 1253 1253 * ext4_write_begin() is the right place. 1254 1254 */ 1255 - static int ext4_write_begin(struct file *file, struct address_space *mapping, 1255 + static int ext4_write_begin(const struct kiocb *iocb, 1256 + struct address_space *mapping, 1256 1257 loff_t pos, unsigned len, 1257 1258 struct folio **foliop, void **fsdata) 1258 1259 { ··· 1401 1400 1402 1401 /* 1403 1402 * We need to pick up the new inode size which generic_commit_write gave us 1404 - * `file' can be NULL - eg, when called from page_symlink(). 1403 + * `iocb` can be NULL - eg, when called from page_symlink(). 1405 1404 * 1406 1405 * ext4 never places buffers on inode->i_mapping->i_private_list. metadata 1407 1406 * buffers are managed internally. 1408 1407 */ 1409 - static int ext4_write_end(struct file *file, 1408 + static int ext4_write_end(const struct kiocb *iocb, 1410 1409 struct address_space *mapping, 1411 1410 loff_t pos, unsigned len, unsigned copied, 1412 1411 struct folio *folio, void *fsdata) ··· 1511 1510 } while (bh != head); 1512 1511 } 1513 1512 1514 - static int ext4_journalled_write_end(struct file *file, 1513 + static int ext4_journalled_write_end(const struct kiocb *iocb, 1515 1514 struct address_space *mapping, 1516 1515 loff_t pos, unsigned len, unsigned copied, 1517 1516 struct folio *folio, void *fsdata) ··· 3037 3036 return 0; 3038 3037 } 3039 3038 3040 - static int ext4_da_write_begin(struct file *file, struct address_space *mapping, 3039 + static int ext4_da_write_begin(const struct kiocb *iocb, 3040 + struct address_space *mapping, 3041 3041 loff_t pos, unsigned len, 3042 3042 struct folio **foliop, void **fsdata) 3043 3043 { ··· 3056 3054 3057 3055 if (ext4_nonda_switch(inode->i_sb) || ext4_verity_in_progress(inode)) { 3058 3056 *fsdata = (void *)FALL_BACK_TO_NONDELALLOC; 3059 - return ext4_write_begin(file, mapping, pos, 3057 + return ext4_write_begin(iocb, mapping, pos, 3060 3058 len, foliop, fsdata); 3061 3059 } 3062 3060 *fsdata = (void *)0; ··· 3197 3195 return copied; 3198 3196 } 3199 3197 3200 - static int ext4_da_write_end(struct file *file, 3198 + static int ext4_da_write_end(const struct kiocb *iocb, 3201 3199 struct address_space *mapping, 3202 3200 loff_t pos, unsigned len, unsigned copied, 3203 3201 struct folio *folio, void *fsdata) ··· 3206 3204 int write_mode = (int)(unsigned long)fsdata; 3207 3205 3208 3206 if (write_mode == FALL_BACK_TO_NONDELALLOC) 3209 - return ext4_write_end(file, mapping, pos, 3207 + return ext4_write_end(iocb, mapping, pos, 3210 3208 len, copied, folio, fsdata); 3211 3209 3212 3210 trace_ext4_da_write_end(inode, pos, len, copied);
+5 -3
fs/f2fs/data.c
··· 3519 3519 return 0; 3520 3520 } 3521 3521 3522 - static int f2fs_write_begin(struct file *file, struct address_space *mapping, 3523 - loff_t pos, unsigned len, struct folio **foliop, void **fsdata) 3522 + static int f2fs_write_begin(const struct kiocb *iocb, 3523 + struct address_space *mapping, 3524 + loff_t pos, unsigned len, struct folio **foliop, 3525 + void **fsdata) 3524 3526 { 3525 3527 struct inode *inode = mapping->host; 3526 3528 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); ··· 3658 3656 return err; 3659 3657 } 3660 3658 3661 - static int f2fs_write_end(struct file *file, 3659 + static int f2fs_write_end(const struct kiocb *iocb, 3662 3660 struct address_space *mapping, 3663 3661 loff_t pos, unsigned len, unsigned copied, 3664 3662 struct folio *folio, void *fsdata)
+10 -8
fs/fat/inode.c
··· 219 219 } 220 220 } 221 221 222 - static int fat_write_begin(struct file *file, struct address_space *mapping, 223 - loff_t pos, unsigned len, 224 - struct folio **foliop, void **fsdata) 222 + static int fat_write_begin(const struct kiocb *iocb, 223 + struct address_space *mapping, 224 + loff_t pos, unsigned len, 225 + struct folio **foliop, void **fsdata) 225 226 { 226 227 int err; 227 228 228 - err = cont_write_begin(file, mapping, pos, len, 229 + err = cont_write_begin(iocb, mapping, pos, len, 229 230 foliop, fsdata, fat_get_block, 230 231 &MSDOS_I(mapping->host)->mmu_private); 231 232 if (err < 0) ··· 234 233 return err; 235 234 } 236 235 237 - static int fat_write_end(struct file *file, struct address_space *mapping, 238 - loff_t pos, unsigned len, unsigned copied, 239 - struct folio *folio, void *fsdata) 236 + static int fat_write_end(const struct kiocb *iocb, 237 + struct address_space *mapping, 238 + loff_t pos, unsigned len, unsigned copied, 239 + struct folio *folio, void *fsdata) 240 240 { 241 241 struct inode *inode = mapping->host; 242 242 int err; 243 - err = generic_write_end(file, mapping, pos, len, copied, folio, fsdata); 243 + err = generic_write_end(iocb, mapping, pos, len, copied, folio, fsdata); 244 244 if (err < len) 245 245 fat_write_failed(mapping, pos + len); 246 246 if (!(err < 0) && !(MSDOS_I(inode)->i_attrs & ATTR_ARCH)) {
+9 -5
fs/fuse/file.c
··· 2213 2213 * It's worthy to make sure that space is reserved on disk for the write, 2214 2214 * but how to implement it without killing performance need more thinking. 2215 2215 */ 2216 - static int fuse_write_begin(struct file *file, struct address_space *mapping, 2217 - loff_t pos, unsigned len, struct folio **foliop, void **fsdata) 2216 + static int fuse_write_begin(const struct kiocb *iocb, 2217 + struct address_space *mapping, 2218 + loff_t pos, unsigned len, struct folio **foliop, 2219 + void **fsdata) 2218 2220 { 2219 2221 pgoff_t index = pos >> PAGE_SHIFT; 2222 + struct file *file = iocb->ki_filp; 2220 2223 struct fuse_conn *fc = get_fuse_conn(file_inode(file)); 2221 2224 struct folio *folio; 2222 2225 loff_t fsize; ··· 2259 2256 return err; 2260 2257 } 2261 2258 2262 - static int fuse_write_end(struct file *file, struct address_space *mapping, 2263 - loff_t pos, unsigned len, unsigned copied, 2264 - struct folio *folio, void *fsdata) 2259 + static int fuse_write_end(const struct kiocb *iocb, 2260 + struct address_space *mapping, 2261 + loff_t pos, unsigned len, unsigned copied, 2262 + struct folio *folio, void *fsdata) 2265 2263 { 2266 2264 struct inode *inode = folio->mapping->host; 2267 2265
+1 -1
fs/hfs/hfs_fs.h
··· 201 201 extern const struct address_space_operations hfs_aops; 202 202 extern const struct address_space_operations hfs_btree_aops; 203 203 204 - int hfs_write_begin(struct file *file, struct address_space *mapping, 204 + int hfs_write_begin(const struct kiocb *iocb, struct address_space *mapping, 205 205 loff_t pos, unsigned len, struct folio **foliop, void **fsdata); 206 206 extern struct inode *hfs_new_inode(struct inode *, const struct qstr *, umode_t); 207 207 extern void hfs_inode_write_fork(struct inode *, struct hfs_extent *, __be32 *, __be32 *);
+2 -2
fs/hfs/inode.c
··· 44 44 } 45 45 } 46 46 47 - int hfs_write_begin(struct file *file, struct address_space *mapping, 47 + int hfs_write_begin(const struct kiocb *iocb, struct address_space *mapping, 48 48 loff_t pos, unsigned len, struct folio **foliop, void **fsdata) 49 49 { 50 50 int ret; 51 51 52 - ret = cont_write_begin(file, mapping, pos, len, foliop, fsdata, 52 + ret = cont_write_begin(iocb, mapping, pos, len, foliop, fsdata, 53 53 hfs_get_block, 54 54 &HFS_I(mapping->host)->phys_size); 55 55 if (unlikely(ret))
+4 -2
fs/hfsplus/hfsplus_fs.h
··· 473 473 extern const struct address_space_operations hfsplus_btree_aops; 474 474 extern const struct dentry_operations hfsplus_dentry_operations; 475 475 476 - int hfsplus_write_begin(struct file *file, struct address_space *mapping, 477 - loff_t pos, unsigned len, struct folio **foliop, void **fsdata); 476 + int hfsplus_write_begin(const struct kiocb *iocb, 477 + struct address_space *mapping, 478 + loff_t pos, unsigned len, struct folio **foliop, 479 + void **fsdata); 478 480 struct inode *hfsplus_new_inode(struct super_block *sb, struct inode *dir, 479 481 umode_t mode); 480 482 void hfsplus_delete_inode(struct inode *inode);
+5 -3
fs/hfsplus/inode.c
··· 38 38 } 39 39 } 40 40 41 - int hfsplus_write_begin(struct file *file, struct address_space *mapping, 42 - loff_t pos, unsigned len, struct folio **foliop, void **fsdata) 41 + int hfsplus_write_begin(const struct kiocb *iocb, 42 + struct address_space *mapping, loff_t pos, 43 + unsigned len, struct folio **foliop, 44 + void **fsdata) 43 45 { 44 46 int ret; 45 47 46 - ret = cont_write_begin(file, mapping, pos, len, foliop, fsdata, 48 + ret = cont_write_begin(iocb, mapping, pos, len, foliop, fsdata, 47 49 hfsplus_get_block, 48 50 &HFSPLUS_I(mapping->host)->phys_size); 49 51 if (unlikely(ret))
+5 -3
fs/hostfs/hostfs_kern.c
··· 445 445 return ret; 446 446 } 447 447 448 - static int hostfs_write_begin(struct file *file, struct address_space *mapping, 448 + static int hostfs_write_begin(const struct kiocb *iocb, 449 + struct address_space *mapping, 449 450 loff_t pos, unsigned len, 450 451 struct folio **foliop, void **fsdata) 451 452 { ··· 459 458 return 0; 460 459 } 461 460 462 - static int hostfs_write_end(struct file *file, struct address_space *mapping, 461 + static int hostfs_write_end(const struct kiocb *iocb, 462 + struct address_space *mapping, 463 463 loff_t pos, unsigned len, unsigned copied, 464 464 struct folio *folio, void *fsdata) 465 465 { ··· 470 468 int err; 471 469 472 470 buffer = kmap_local_folio(folio, from); 473 - err = write_file(FILE_HOSTFS_I(file)->fd, &pos, buffer, copied); 471 + err = write_file(FILE_HOSTFS_I(iocb->ki_filp)->fd, &pos, buffer, copied); 474 472 kunmap_local(buffer); 475 473 476 474 if (!folio_test_uptodate(folio) && err == folio_size(folio))
+10 -8
fs/hpfs/file.c
··· 188 188 hpfs_unlock(inode->i_sb); 189 189 } 190 190 191 - static int hpfs_write_begin(struct file *file, struct address_space *mapping, 192 - loff_t pos, unsigned len, 193 - struct folio **foliop, void **fsdata) 191 + static int hpfs_write_begin(const struct kiocb *iocb, 192 + struct address_space *mapping, 193 + loff_t pos, unsigned len, 194 + struct folio **foliop, void **fsdata) 194 195 { 195 196 int ret; 196 197 197 - ret = cont_write_begin(file, mapping, pos, len, foliop, fsdata, 198 + ret = cont_write_begin(iocb, mapping, pos, len, foliop, fsdata, 198 199 hpfs_get_block, 199 200 &hpfs_i(mapping->host)->mmu_private); 200 201 if (unlikely(ret)) ··· 204 203 return ret; 205 204 } 206 205 207 - static int hpfs_write_end(struct file *file, struct address_space *mapping, 208 - loff_t pos, unsigned len, unsigned copied, 209 - struct folio *folio, void *fsdata) 206 + static int hpfs_write_end(const struct kiocb *iocb, 207 + struct address_space *mapping, 208 + loff_t pos, unsigned len, unsigned copied, 209 + struct folio *folio, void *fsdata) 210 210 { 211 211 struct inode *inode = mapping->host; 212 212 int err; 213 - err = generic_write_end(file, mapping, pos, len, copied, folio, fsdata); 213 + err = generic_write_end(iocb, mapping, pos, len, copied, folio, fsdata); 214 214 if (err < len) 215 215 hpfs_write_failed(mapping, pos + len); 216 216 if (!(err < 0)) {
+5 -4
fs/hugetlbfs/inode.c
··· 311 311 return retval; 312 312 } 313 313 314 - static int hugetlbfs_write_begin(struct file *file, 314 + static int hugetlbfs_write_begin(const struct kiocb *iocb, 315 315 struct address_space *mapping, 316 316 loff_t pos, unsigned len, 317 317 struct folio **foliop, void **fsdata) ··· 319 319 return -EINVAL; 320 320 } 321 321 322 - static int hugetlbfs_write_end(struct file *file, struct address_space *mapping, 323 - loff_t pos, unsigned len, unsigned copied, 324 - struct folio *folio, void *fsdata) 322 + static int hugetlbfs_write_end(const struct kiocb *iocb, 323 + struct address_space *mapping, 324 + loff_t pos, unsigned len, unsigned copied, 325 + struct folio *folio, void *fsdata) 325 326 { 326 327 BUG(); 327 328 return -EINVAL;
+16 -12
fs/jffs2/file.c
··· 21 21 #include <linux/jffs2.h> 22 22 #include "nodelist.h" 23 23 24 - static int jffs2_write_end(struct file *filp, struct address_space *mapping, 25 - loff_t pos, unsigned len, unsigned copied, 26 - struct folio *folio, void *fsdata); 27 - static int jffs2_write_begin(struct file *filp, struct address_space *mapping, 28 - loff_t pos, unsigned len, 29 - struct folio **foliop, void **fsdata); 24 + static int jffs2_write_end(const struct kiocb *iocb, 25 + struct address_space *mapping, 26 + loff_t pos, unsigned len, unsigned copied, 27 + struct folio *folio, void *fsdata); 28 + static int jffs2_write_begin(const struct kiocb *iocb, 29 + struct address_space *mapping, 30 + loff_t pos, unsigned len, 31 + struct folio **foliop, void **fsdata); 30 32 static int jffs2_read_folio(struct file *filp, struct folio *folio); 31 33 32 34 int jffs2_fsync(struct file *filp, loff_t start, loff_t end, int datasync) ··· 123 121 return ret; 124 122 } 125 123 126 - static int jffs2_write_begin(struct file *filp, struct address_space *mapping, 127 - loff_t pos, unsigned len, 128 - struct folio **foliop, void **fsdata) 124 + static int jffs2_write_begin(const struct kiocb *iocb, 125 + struct address_space *mapping, 126 + loff_t pos, unsigned len, 127 + struct folio **foliop, void **fsdata) 129 128 { 130 129 struct folio *folio; 131 130 struct inode *inode = mapping->host; ··· 238 235 return ret; 239 236 } 240 237 241 - static int jffs2_write_end(struct file *filp, struct address_space *mapping, 242 - loff_t pos, unsigned len, unsigned copied, 243 - struct folio *folio, void *fsdata) 238 + static int jffs2_write_end(const struct kiocb *iocb, 239 + struct address_space *mapping, 240 + loff_t pos, unsigned len, unsigned copied, 241 + struct folio *folio, void *fsdata) 244 242 { 245 243 /* Actually commit the write from the page cache page we're looking at. 246 244 * For now, we write the full page out each time. It sucks, but it's simple
+9 -7
fs/jfs/inode.c
··· 290 290 } 291 291 } 292 292 293 - static int jfs_write_begin(struct file *file, struct address_space *mapping, 294 - loff_t pos, unsigned len, 295 - struct folio **foliop, void **fsdata) 293 + static int jfs_write_begin(const struct kiocb *iocb, 294 + struct address_space *mapping, 295 + loff_t pos, unsigned len, 296 + struct folio **foliop, void **fsdata) 296 297 { 297 298 int ret; 298 299 ··· 304 303 return ret; 305 304 } 306 305 307 - static int jfs_write_end(struct file *file, struct address_space *mapping, 308 - loff_t pos, unsigned len, unsigned copied, struct folio *folio, 309 - void *fsdata) 306 + static int jfs_write_end(const struct kiocb *iocb, 307 + struct address_space *mapping, 308 + loff_t pos, unsigned len, unsigned copied, 309 + struct folio *folio, void *fsdata) 310 310 { 311 311 int ret; 312 312 313 - ret = generic_write_end(file, mapping, pos, len, copied, folio, fsdata); 313 + ret = generic_write_end(iocb, mapping, pos, len, copied, folio, fsdata); 314 314 if (ret < len) 315 315 jfs_write_failed(mapping, pos + len); 316 316 return ret;
+6 -5
fs/libfs.c
··· 910 910 return 0; 911 911 } 912 912 913 - int simple_write_begin(struct file *file, struct address_space *mapping, 913 + int simple_write_begin(const struct kiocb *iocb, struct address_space *mapping, 914 914 loff_t pos, unsigned len, 915 915 struct folio **foliop, void **fsdata) 916 916 { ··· 935 935 936 936 /** 937 937 * simple_write_end - .write_end helper for non-block-device FSes 938 - * @file: See .write_end of address_space_operations 938 + * @iocb: kernel I/O control block 939 939 * @mapping: " 940 940 * @pos: " 941 941 * @len: " ··· 956 956 * 957 957 * Use *ONLY* with simple_read_folio() 958 958 */ 959 - static int simple_write_end(struct file *file, struct address_space *mapping, 960 - loff_t pos, unsigned len, unsigned copied, 961 - struct folio *folio, void *fsdata) 959 + static int simple_write_end(const struct kiocb *iocb, 960 + struct address_space *mapping, 961 + loff_t pos, unsigned len, unsigned copied, 962 + struct folio *folio, void *fsdata) 962 963 { 963 964 struct inode *inode = folio->mapping->host; 964 965 loff_t last_pos = pos + copied;
+4 -3
fs/minix/inode.c
··· 442 442 } 443 443 } 444 444 445 - static int minix_write_begin(struct file *file, struct address_space *mapping, 446 - loff_t pos, unsigned len, 447 - struct folio **foliop, void **fsdata) 445 + static int minix_write_begin(const struct kiocb *iocb, 446 + struct address_space *mapping, 447 + loff_t pos, unsigned len, 448 + struct folio **foliop, void **fsdata) 448 449 { 449 450 int ret; 450 451
+6 -2
fs/nfs/file.c
··· 342 342 * If the writer ends up delaying the write, the writer needs to 343 343 * increment the page use counts until he is done with the page. 344 344 */ 345 - static int nfs_write_begin(struct file *file, struct address_space *mapping, 345 + static int nfs_write_begin(const struct kiocb *iocb, 346 + struct address_space *mapping, 346 347 loff_t pos, unsigned len, struct folio **foliop, 347 348 void **fsdata) 348 349 { 349 350 fgf_t fgp = FGP_WRITEBEGIN; 350 351 struct folio *folio; 352 + struct file *file = iocb->ki_filp; 351 353 int once_thru = 0; 352 354 int ret; 353 355 ··· 379 377 return ret; 380 378 } 381 379 382 - static int nfs_write_end(struct file *file, struct address_space *mapping, 380 + static int nfs_write_end(const struct kiocb *iocb, 381 + struct address_space *mapping, 383 382 loff_t pos, unsigned len, unsigned copied, 384 383 struct folio *folio, void *fsdata) 385 384 { 385 + struct file *file = iocb->ki_filp; 386 386 struct nfs_open_context *ctx = nfs_file_open_context(file); 387 387 unsigned offset = offset_in_folio(folio, pos); 388 388 int status;
+5 -3
fs/nilfs2/inode.c
··· 218 218 } 219 219 } 220 220 221 - static int nilfs_write_begin(struct file *file, struct address_space *mapping, 221 + static int nilfs_write_begin(const struct kiocb *iocb, 222 + struct address_space *mapping, 222 223 loff_t pos, unsigned len, 223 224 struct folio **foliop, void **fsdata) 224 225 ··· 238 237 return err; 239 238 } 240 239 241 - static int nilfs_write_end(struct file *file, struct address_space *mapping, 240 + static int nilfs_write_end(const struct kiocb *iocb, 241 + struct address_space *mapping, 242 242 loff_t pos, unsigned len, unsigned copied, 243 243 struct folio *folio, void *fsdata) 244 244 { ··· 250 248 251 249 nr_dirty = nilfs_page_count_clean_buffers(folio, start, 252 250 start + copied); 253 - copied = generic_write_end(file, mapping, pos, len, copied, folio, 251 + copied = generic_write_end(iocb, mapping, pos, len, copied, folio, 254 252 fsdata); 255 253 nilfs_set_file_dirty(inode, nr_dirty); 256 254 err = nilfs_transaction_commit(inode->i_sb);
+2 -2
fs/ntfs3/file.c
··· 154 154 if (pos + len > new_valid) 155 155 len = new_valid - pos; 156 156 157 - err = ntfs_write_begin(file, mapping, pos, len, &folio, NULL); 157 + err = ntfs_write_begin(NULL, mapping, pos, len, &folio, NULL); 158 158 if (err) 159 159 goto out; 160 160 161 161 folio_zero_range(folio, zerofrom, folio_size(folio) - zerofrom); 162 162 163 - err = ntfs_write_end(file, mapping, pos, len, len, folio, NULL); 163 + err = ntfs_write_end(NULL, mapping, pos, len, len, folio, NULL); 164 164 if (err < 0) 165 165 goto out; 166 166 pos += len;
+4 -3
fs/ntfs3/inode.c
··· 912 912 bh_result, create, GET_BLOCK_WRITE_BEGIN); 913 913 } 914 914 915 - int ntfs_write_begin(struct file *file, struct address_space *mapping, 915 + int ntfs_write_begin(const struct kiocb *iocb, struct address_space *mapping, 916 916 loff_t pos, u32 len, struct folio **foliop, void **fsdata) 917 917 { 918 918 int err; ··· 957 957 /* 958 958 * ntfs_write_end - Address_space_operations::write_end. 959 959 */ 960 - int ntfs_write_end(struct file *file, struct address_space *mapping, loff_t pos, 960 + int ntfs_write_end(const struct kiocb *iocb, 961 + struct address_space *mapping, loff_t pos, 961 962 u32 len, u32 copied, struct folio *folio, void *fsdata) 962 963 { 963 964 struct inode *inode = mapping->host; ··· 990 989 folio_unlock(folio); 991 990 folio_put(folio); 992 991 } else { 993 - err = generic_write_end(file, mapping, pos, len, copied, folio, 992 + err = generic_write_end(iocb, mapping, pos, len, copied, folio, 994 993 fsdata); 995 994 } 996 995
+6 -4
fs/ntfs3/ntfs_fs.h
··· 702 702 int ntfs_set_size(struct inode *inode, u64 new_size); 703 703 int ntfs_get_block(struct inode *inode, sector_t vbn, 704 704 struct buffer_head *bh_result, int create); 705 - int ntfs_write_begin(struct file *file, struct address_space *mapping, 706 - loff_t pos, u32 len, struct folio **foliop, void **fsdata); 707 - int ntfs_write_end(struct file *file, struct address_space *mapping, loff_t pos, 708 - u32 len, u32 copied, struct folio *folio, void *fsdata); 705 + int ntfs_write_begin(const struct kiocb *iocb, struct address_space *mapping, 706 + loff_t pos, u32 len, struct folio **foliop, 707 + void **fsdata); 708 + int ntfs_write_end(const struct kiocb *iocb, struct address_space *mapping, 709 + loff_t pos, u32 len, u32 copied, struct folio *folio, 710 + void *fsdata); 709 711 int ntfs3_write_inode(struct inode *inode, struct writeback_control *wbc); 710 712 int ntfs_sync_inode(struct inode *inode); 711 713 int inode_read_data(struct inode *inode, void *data, size_t bytes);
+4 -2
fs/ocfs2/aops.c
··· 1856 1856 return ret; 1857 1857 } 1858 1858 1859 - static int ocfs2_write_begin(struct file *file, struct address_space *mapping, 1859 + static int ocfs2_write_begin(const struct kiocb *iocb, 1860 + struct address_space *mapping, 1860 1861 loff_t pos, unsigned len, 1861 1862 struct folio **foliop, void **fsdata) 1862 1863 { ··· 2048 2047 return copied; 2049 2048 } 2050 2049 2051 - static int ocfs2_write_end(struct file *file, struct address_space *mapping, 2050 + static int ocfs2_write_end(const struct kiocb *iocb, 2051 + struct address_space *mapping, 2052 2052 loff_t pos, unsigned len, unsigned copied, 2053 2053 struct folio *folio, void *fsdata) 2054 2054 {
+4 -3
fs/omfs/file.c
··· 310 310 } 311 311 } 312 312 313 - static int omfs_write_begin(struct file *file, struct address_space *mapping, 314 - loff_t pos, unsigned len, 315 - struct folio **foliop, void **fsdata) 313 + static int omfs_write_begin(const struct kiocb *iocb, 314 + struct address_space *mapping, 315 + loff_t pos, unsigned len, 316 + struct folio **foliop, void **fsdata) 316 317 { 317 318 int ret; 318 319
+9 -7
fs/orangefs/inode.c
··· 285 285 return ret; 286 286 } 287 287 288 - static int orangefs_write_begin(struct file *file, 289 - struct address_space *mapping, loff_t pos, unsigned len, 290 - struct folio **foliop, void **fsdata) 288 + static int orangefs_write_begin(const struct kiocb *iocb, 289 + struct address_space *mapping, loff_t pos, 290 + unsigned len, struct folio **foliop, 291 + void **fsdata) 291 292 { 292 293 struct orangefs_write_range *wr; 293 294 struct folio *folio; ··· 341 340 return 0; 342 341 } 343 342 344 - static int orangefs_write_end(struct file *file, struct address_space *mapping, 345 - loff_t pos, unsigned len, unsigned copied, struct folio *folio, 346 - void *fsdata) 343 + static int orangefs_write_end(const struct kiocb *iocb, 344 + struct address_space *mapping, 345 + loff_t pos, unsigned len, unsigned copied, 346 + struct folio *folio, void *fsdata) 347 347 { 348 348 struct inode *inode = folio->mapping->host; 349 349 loff_t last_pos = pos + copied; ··· 374 372 folio_unlock(folio); 375 373 folio_put(folio); 376 374 377 - mark_inode_dirty_sync(file_inode(file)); 375 + mark_inode_dirty_sync(file_inode(iocb->ki_filp)); 378 376 return copied; 379 377 } 380 378
+5 -3
fs/ubifs/file.c
··· 404 404 * there is a plenty of flash space and the budget will be acquired quickly, 405 405 * without forcing write-back. The slow path does not make this assumption. 406 406 */ 407 - static int ubifs_write_begin(struct file *file, struct address_space *mapping, 407 + static int ubifs_write_begin(const struct kiocb *iocb, 408 + struct address_space *mapping, 408 409 loff_t pos, unsigned len, 409 410 struct folio **foliop, void **fsdata) 410 411 { ··· 515 514 } 516 515 } 517 516 518 - static int ubifs_write_end(struct file *file, struct address_space *mapping, 519 - loff_t pos, unsigned len, unsigned copied, 517 + static int ubifs_write_end(const struct kiocb *iocb, 518 + struct address_space *mapping, loff_t pos, 519 + unsigned len, unsigned copied, 520 520 struct folio *folio, void *fsdata) 521 521 { 522 522 struct inode *inode = mapping->host;
+7 -4
fs/udf/inode.c
··· 244 244 mpage_readahead(rac, udf_get_block); 245 245 } 246 246 247 - static int udf_write_begin(struct file *file, struct address_space *mapping, 247 + static int udf_write_begin(const struct kiocb *iocb, 248 + struct address_space *mapping, 248 249 loff_t pos, unsigned len, 249 250 struct folio **foliop, void **fsdata) 250 251 { 252 + struct file *file = iocb->ki_filp; 251 253 struct udf_inode_info *iinfo = UDF_I(file_inode(file)); 252 254 struct folio *folio; 253 255 int ret; ··· 273 271 return 0; 274 272 } 275 273 276 - static int udf_write_end(struct file *file, struct address_space *mapping, 274 + static int udf_write_end(const struct kiocb *iocb, 275 + struct address_space *mapping, 277 276 loff_t pos, unsigned len, unsigned copied, 278 277 struct folio *folio, void *fsdata) 279 278 { 280 - struct inode *inode = file_inode(file); 279 + struct inode *inode = file_inode(iocb->ki_filp); 281 280 loff_t last_pos; 282 281 283 282 if (UDF_I(inode)->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) 284 - return generic_write_end(file, mapping, pos, len, copied, folio, 283 + return generic_write_end(iocb, mapping, pos, len, copied, folio, 285 284 fsdata); 286 285 last_pos = pos + copied; 287 286 if (last_pos > inode->i_size)
+9 -7
fs/ufs/inode.c
··· 474 474 } 475 475 } 476 476 477 - static int ufs_write_begin(struct file *file, struct address_space *mapping, 478 - loff_t pos, unsigned len, 479 - struct folio **foliop, void **fsdata) 477 + static int ufs_write_begin(const struct kiocb *iocb, 478 + struct address_space *mapping, 479 + loff_t pos, unsigned len, 480 + struct folio **foliop, void **fsdata) 480 481 { 481 482 int ret; 482 483 ··· 488 487 return ret; 489 488 } 490 489 491 - static int ufs_write_end(struct file *file, struct address_space *mapping, 492 - loff_t pos, unsigned len, unsigned copied, 493 - struct folio *folio, void *fsdata) 490 + static int ufs_write_end(const struct kiocb *iocb, 491 + struct address_space *mapping, 492 + loff_t pos, unsigned len, unsigned copied, 493 + struct folio *folio, void *fsdata) 494 494 { 495 495 int ret; 496 496 497 - ret = generic_write_end(file, mapping, pos, len, copied, folio, fsdata); 497 + ret = generic_write_end(iocb, mapping, pos, len, copied, folio, fsdata); 498 498 if (ret < len) 499 499 ufs_write_failed(mapping, pos + len); 500 500 return ret;
+3 -2
fs/vboxsf/file.c
··· 300 300 return error; 301 301 } 302 302 303 - static int vboxsf_write_end(struct file *file, struct address_space *mapping, 303 + static int vboxsf_write_end(const struct kiocb *iocb, 304 + struct address_space *mapping, 304 305 loff_t pos, unsigned int len, unsigned int copied, 305 306 struct folio *folio, void *fsdata) 306 307 { 307 308 struct inode *inode = mapping->host; 308 - struct vboxsf_handle *sf_handle = file->private_data; 309 + struct vboxsf_handle *sf_handle = iocb->ki_filp->private_data; 309 310 size_t from = offset_in_folio(folio, pos); 310 311 u32 nwritten = len; 311 312 u8 *buf;
+2 -2
include/linux/buffer_head.h
··· 263 263 int __block_write_begin(struct folio *folio, loff_t pos, unsigned len, 264 264 get_block_t *get_block); 265 265 int block_write_end(loff_t pos, unsigned len, unsigned copied, struct folio *); 266 - int generic_write_end(struct file *, struct address_space *, 266 + int generic_write_end(const struct kiocb *, struct address_space *, 267 267 loff_t, unsigned len, unsigned copied, 268 268 struct folio *, void *); 269 269 void folio_zero_new_buffers(struct folio *folio, size_t from, size_t to); 270 - int cont_write_begin(struct file *, struct address_space *, loff_t, 270 + int cont_write_begin(const struct kiocb *, struct address_space *, loff_t, 271 271 unsigned, struct folio **, void **, 272 272 get_block_t *, loff_t *); 273 273 int generic_cont_expand_simple(struct inode *inode, loff_t size);
+6 -5
include/linux/fs.h
··· 444 444 445 445 void (*readahead)(struct readahead_control *); 446 446 447 - int (*write_begin)(struct file *, struct address_space *mapping, 447 + int (*write_begin)(const struct kiocb *, struct address_space *mapping, 448 448 loff_t pos, unsigned len, 449 449 struct folio **foliop, void **fsdata); 450 - int (*write_end)(struct file *, struct address_space *mapping, 450 + int (*write_end)(const struct kiocb *, struct address_space *mapping, 451 451 loff_t pos, unsigned len, unsigned copied, 452 452 struct folio *folio, void *fsdata); 453 453 ··· 3598 3598 extern int noop_fsync(struct file *, loff_t, loff_t, int); 3599 3599 extern ssize_t noop_direct_IO(struct kiocb *iocb, struct iov_iter *iter); 3600 3600 extern int simple_empty(struct dentry *); 3601 - extern int simple_write_begin(struct file *file, struct address_space *mapping, 3602 - loff_t pos, unsigned len, 3603 - struct folio **foliop, void **fsdata); 3601 + extern int simple_write_begin(const struct kiocb *iocb, 3602 + struct address_space *mapping, 3603 + loff_t pos, unsigned len, 3604 + struct folio **foliop, void **fsdata); 3604 3605 extern const struct address_space_operations ram_aops; 3605 3606 extern int always_delete_dentry(const struct dentry *); 3606 3607 extern struct inode *alloc_anon_inode(struct super_block *);
+2 -2
mm/filemap.c
··· 4109 4109 break; 4110 4110 } 4111 4111 4112 - status = a_ops->write_begin(file, mapping, pos, bytes, 4112 + status = a_ops->write_begin(iocb, mapping, pos, bytes, 4113 4113 &folio, &fsdata); 4114 4114 if (unlikely(status < 0)) 4115 4115 break; ··· 4130 4130 copied = copy_folio_from_iter_atomic(folio, offset, bytes, i); 4131 4131 flush_dcache_folio(folio); 4132 4132 4133 - status = a_ops->write_end(file, mapping, pos, bytes, copied, 4133 + status = a_ops->write_end(iocb, mapping, pos, bytes, copied, 4134 4134 folio, fsdata); 4135 4135 if (unlikely(status != copied)) { 4136 4136 iov_iter_revert(i, copied - max(status, 0L));
+6 -6
mm/shmem.c
··· 3266 3266 static const struct inode_operations shmem_short_symlink_operations; 3267 3267 3268 3268 static int 3269 - shmem_write_begin(struct file *file, struct address_space *mapping, 3270 - loff_t pos, unsigned len, 3271 - struct folio **foliop, void **fsdata) 3269 + shmem_write_begin(const struct kiocb *iocb, struct address_space *mapping, 3270 + loff_t pos, unsigned len, 3271 + struct folio **foliop, void **fsdata) 3272 3272 { 3273 3273 struct inode *inode = mapping->host; 3274 3274 struct shmem_inode_info *info = SHMEM_I(inode); ··· 3300 3300 } 3301 3301 3302 3302 static int 3303 - shmem_write_end(struct file *file, struct address_space *mapping, 3304 - loff_t pos, unsigned len, unsigned copied, 3305 - struct folio *folio, void *fsdata) 3303 + shmem_write_end(const struct kiocb *iocb, struct address_space *mapping, 3304 + loff_t pos, unsigned len, unsigned copied, 3305 + struct folio *folio, void *fsdata) 3306 3306 { 3307 3307 struct inode *inode = mapping->host; 3308 3308