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

fs: Convert aops->write_end to take a folio

Most callers have a folio, and most implementations operate on a folio,
so remove the conversion from folio->page->folio to fit through this
interface.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Matthew Wilcox (Oracle) and committed by
Christian Brauner
a225800f 3e5d37c5

+80 -102
+1 -1
Documentation/filesystems/locking.rst
··· 254 254 struct page **pagep, void **fsdata); 255 255 int (*write_end)(struct file *, struct address_space *mapping, 256 256 loff_t pos, unsigned len, unsigned copied, 257 - struct page *page, void *fsdata); 257 + struct folio *folio, void *fsdata); 258 258 sector_t (*bmap)(struct address_space *, sector_t); 259 259 void (*invalidate_folio) (struct folio *, size_t start, size_t len); 260 260 bool (*release_folio)(struct folio *, gfp_t);
+3 -3
Documentation/filesystems/vfs.rst
··· 810 810 struct page **pagep, void **fsdata); 811 811 int (*write_end)(struct file *, struct address_space *mapping, 812 812 loff_t pos, unsigned len, unsigned copied, 813 - struct page *page, void *fsdata); 813 + struct folio *folio, void *fsdata); 814 814 sector_t (*bmap)(struct address_space *, sector_t); 815 815 void (*invalidate_folio) (struct folio *, size_t start, size_t len); 816 816 bool (*release_folio)(struct folio *, gfp_t); ··· 944 944 called. len is the original len passed to write_begin, and 945 945 copied is the amount that was able to be copied. 946 946 947 - The filesystem must take care of unlocking the page and 948 - releasing it refcount, and updating i_size. 947 + The filesystem must take care of unlocking the folio, 948 + decrementing its refcount, and updating i_size. 949 949 950 950 Returns < 0 on failure, otherwise the number of bytes (<= 951 951 'copied') that were able to be copied into pagecache.
+1 -2
block/fops.c
··· 457 457 } 458 458 459 459 static int blkdev_write_end(struct file *file, struct address_space *mapping, 460 - loff_t pos, unsigned len, unsigned copied, struct page *page, 460 + loff_t pos, unsigned len, unsigned copied, struct folio *folio, 461 461 void *fsdata) 462 462 { 463 - struct folio *folio = page_folio(page); 464 463 int ret; 465 464 ret = block_write_end(file, mapping, pos, len, copied, folio, fsdata); 466 465
+2 -2
drivers/gpu/drm/i915/gem/i915_gem_shmem.c
··· 494 494 kunmap_local(vaddr); 495 495 496 496 err = aops->write_end(obj->base.filp, mapping, offset, len, 497 - len - unwritten, page, data); 497 + len - unwritten, page_folio(page), data); 498 498 if (err < 0) 499 499 return err; 500 500 ··· 688 688 kunmap(page); 689 689 690 690 err = aops->write_end(file, file->f_mapping, offset, len, len, 691 - page, pgdata); 691 + page_folio(page), pgdata); 692 692 if (err < 0) 693 693 goto fail; 694 694
+4 -5
fs/affs/file.c
··· 433 433 434 434 static int affs_write_end(struct file *file, struct address_space *mapping, 435 435 loff_t pos, unsigned int len, unsigned int copied, 436 - struct page *page, void *fsdata) 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, page, fsdata); 441 + ret = generic_write_end(file, 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) { ··· 687 687 688 688 static int affs_write_end_ofs(struct file *file, struct address_space *mapping, 689 689 loff_t pos, unsigned len, unsigned copied, 690 - struct page *page, void *fsdata) 690 + struct folio *folio, void *fsdata) 691 691 { 692 - struct folio *folio = page_folio(page); 693 692 struct inode *inode = mapping->host; 694 693 struct super_block *sb = inode->i_sb; 695 694 struct buffer_head *bh, *prev_bh; ··· 888 889 889 890 res = mapping->a_ops->write_begin(NULL, mapping, isize, 0, &page, &fsdata); 890 891 if (!res) 891 - res = mapping->a_ops->write_end(NULL, mapping, isize, 0, 0, page, fsdata); 892 + res = mapping->a_ops->write_end(NULL, mapping, isize, 0, 0, page_folio(page), fsdata); 892 893 else 893 894 inode->i_size = AFFS_I(inode)->mmu_private; 894 895 mark_inode_dirty(inode);
+1 -2
fs/bcachefs/fs-io-buffered.c
··· 743 743 744 744 int bch2_write_end(struct file *file, struct address_space *mapping, 745 745 loff_t pos, unsigned len, unsigned copied, 746 - struct page *page, void *fsdata) 746 + struct folio *folio, void *fsdata) 747 747 { 748 748 struct bch_inode_info *inode = to_bch_ei(mapping->host); 749 749 struct bch_fs *c = inode->v.i_sb->s_fs_info; 750 750 struct bch2_folio_reservation *res = fsdata; 751 - struct folio *folio = page_folio(page); 752 751 unsigned offset = pos - folio_pos(folio); 753 752 754 753 lockdep_assert_held(&inode->v.i_rwsem);
+1 -1
fs/bcachefs/fs-io-buffered.h
··· 13 13 int bch2_write_begin(struct file *, struct address_space *, loff_t, 14 14 unsigned, struct page **, void **); 15 15 int bch2_write_end(struct file *, struct address_space *, loff_t, 16 - unsigned, unsigned, struct page *, void *); 16 + unsigned len, unsigned copied, struct folio *, void *); 17 17 18 18 ssize_t bch2_write_iter(struct kiocb *, struct iov_iter *); 19 19
+4 -5
fs/buffer.c
··· 2280 2280 2281 2281 int generic_write_end(struct file *file, struct address_space *mapping, 2282 2282 loff_t pos, unsigned len, unsigned copied, 2283 - struct page *page, void *fsdata) 2283 + struct folio *folio, void *fsdata) 2284 2284 { 2285 - struct folio *folio = page_folio(page); 2286 2285 struct inode *inode = mapping->host; 2287 2286 loff_t old_size = inode->i_size; 2288 2287 bool i_size_changed = false; ··· 2479 2480 if (err) 2480 2481 goto out; 2481 2482 2482 - err = aops->write_end(NULL, mapping, size, 0, 0, page, fsdata); 2483 + err = aops->write_end(NULL, mapping, size, 0, 0, page_folio(page), fsdata); 2483 2484 BUG_ON(err > 0); 2484 2485 2485 2486 out: ··· 2517 2518 goto out; 2518 2519 zero_user(page, zerofrom, len); 2519 2520 err = aops->write_end(file, mapping, curpos, len, len, 2520 - page, fsdata); 2521 + page_folio(page), fsdata); 2521 2522 if (err < 0) 2522 2523 goto out; 2523 2524 BUG_ON(err != len); ··· 2550 2551 goto out; 2551 2552 zero_user(page, zerofrom, len); 2552 2553 err = aops->write_end(file, mapping, curpos, len, len, 2553 - page, fsdata); 2554 + page_folio(page), fsdata); 2554 2555 if (err < 0) 2555 2556 goto out; 2556 2557 BUG_ON(err != len);
+1 -2
fs/ceph/addr.c
··· 1509 1509 */ 1510 1510 static int ceph_write_end(struct file *file, struct address_space *mapping, 1511 1511 loff_t pos, unsigned len, unsigned copied, 1512 - struct page *subpage, void *fsdata) 1512 + struct folio *folio, void *fsdata) 1513 1513 { 1514 - struct folio *folio = page_folio(subpage); 1515 1514 struct inode *inode = file_inode(file); 1516 1515 struct ceph_client *cl = ceph_inode_to_client(inode); 1517 1516 bool check_cap = false;
+2 -3
fs/ecryptfs/mmap.c
··· 458 458 * @pos: The file position 459 459 * @len: The length of the data (unused) 460 460 * @copied: The amount of data copied 461 - * @page: The eCryptfs page 461 + * @folio: The eCryptfs folio 462 462 * @fsdata: The fsdata (unused) 463 463 */ 464 464 static int ecryptfs_write_end(struct file *file, 465 465 struct address_space *mapping, 466 466 loff_t pos, unsigned len, unsigned copied, 467 - struct page *page, void *fsdata) 467 + struct folio *folio, void *fsdata) 468 468 { 469 - struct folio *folio = page_folio(page); 470 469 pgoff_t index = pos >> PAGE_SHIFT; 471 470 unsigned from = pos & (PAGE_SIZE - 1); 472 471 unsigned to = from + copied;
+1 -1
fs/exfat/file.c
··· 548 548 549 549 zero_user_segment(page, zerofrom, zerofrom + len); 550 550 551 - err = ops->write_end(file, mapping, start, len, len, page, NULL); 551 + err = ops->write_end(file, mapping, start, len, len, page_folio(page), NULL); 552 552 if (err < 0) 553 553 goto out; 554 554 start += len;
+2 -2
fs/exfat/inode.c
··· 463 463 464 464 static int exfat_write_end(struct file *file, struct address_space *mapping, 465 465 loff_t pos, unsigned int len, unsigned int copied, 466 - struct page *pagep, void *fsdata) 466 + struct folio *folio, void *fsdata) 467 467 { 468 468 struct inode *inode = mapping->host; 469 469 struct exfat_inode_info *ei = EXFAT_I(inode); 470 470 int err; 471 471 472 - err = generic_write_end(file, mapping, pos, len, copied, pagep, fsdata); 472 + err = generic_write_end(file, mapping, pos, len, copied, folio, fsdata); 473 473 474 474 if (ei->i_size_aligned < i_size_read(inode)) { 475 475 exfat_fs_error(inode->i_sb,
+2 -2
fs/ext2/inode.c
··· 928 928 929 929 static int ext2_write_end(struct file *file, struct address_space *mapping, 930 930 loff_t pos, unsigned len, unsigned copied, 931 - struct page *page, void *fsdata) 931 + struct folio *folio, void *fsdata) 932 932 { 933 933 int ret; 934 934 935 - ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata); 935 + ret = generic_write_end(file, mapping, pos, len, copied, folio, fsdata); 936 936 if (ret < len) 937 937 ext2_write_failed(mapping, pos + len); 938 938 return ret;
+4 -7
fs/ext4/inode.c
··· 1298 1298 static int ext4_write_end(struct file *file, 1299 1299 struct address_space *mapping, 1300 1300 loff_t pos, unsigned len, unsigned copied, 1301 - struct page *page, void *fsdata) 1301 + struct folio *folio, void *fsdata) 1302 1302 { 1303 - struct folio *folio = page_folio(page); 1304 1303 handle_t *handle = ext4_journal_current_handle(); 1305 1304 struct inode *inode = mapping->host; 1306 1305 loff_t old_size = inode->i_size; ··· 1401 1402 static int ext4_journalled_write_end(struct file *file, 1402 1403 struct address_space *mapping, 1403 1404 loff_t pos, unsigned len, unsigned copied, 1404 - struct page *page, void *fsdata) 1405 + struct folio *folio, void *fsdata) 1405 1406 { 1406 - struct folio *folio = page_folio(page); 1407 1407 handle_t *handle = ext4_journal_current_handle(); 1408 1408 struct inode *inode = mapping->host; 1409 1409 loff_t old_size = inode->i_size; ··· 3078 3080 static int ext4_da_write_end(struct file *file, 3079 3081 struct address_space *mapping, 3080 3082 loff_t pos, unsigned len, unsigned copied, 3081 - struct page *page, void *fsdata) 3083 + struct folio *folio, void *fsdata) 3082 3084 { 3083 3085 struct inode *inode = mapping->host; 3084 3086 int write_mode = (int)(unsigned long)fsdata; 3085 - struct folio *folio = page_folio(page); 3086 3087 3087 3088 if (write_mode == FALL_BACK_TO_NONDELALLOC) 3088 3089 return ext4_write_end(file, mapping, pos, 3089 - len, copied, &folio->page, fsdata); 3090 + len, copied, folio, fsdata); 3090 3091 3091 3092 trace_ext4_da_write_end(inode, pos, len, copied); 3092 3093
+1 -1
fs/ext4/verity.c
··· 86 86 87 87 memcpy_to_page(page, offset_in_page(pos), buf, n); 88 88 89 - res = aops->write_end(NULL, mapping, pos, n, n, page, fsdata); 89 + res = aops->write_end(NULL, mapping, pos, n, n, page_folio(page), fsdata); 90 90 if (res < 0) 91 91 return res; 92 92 if (res != n)
+1 -2
fs/f2fs/data.c
··· 3689 3689 static int f2fs_write_end(struct file *file, 3690 3690 struct address_space *mapping, 3691 3691 loff_t pos, unsigned len, unsigned copied, 3692 - struct page *page, void *fsdata) 3692 + struct folio *folio, void *fsdata) 3693 3693 { 3694 - struct folio *folio = page_folio(page); 3695 3694 struct inode *inode = folio->mapping->host; 3696 3695 3697 3696 trace_f2fs_write_end(inode, pos, len, copied);
+1 -1
fs/f2fs/super.c
··· 2700 2700 memcpy_to_page(page, offset, data, tocopy); 2701 2701 2702 2702 a_ops->write_end(NULL, mapping, off, tocopy, tocopy, 2703 - page, fsdata); 2703 + page_folio(page), fsdata); 2704 2704 offset = 0; 2705 2705 towrite -= tocopy; 2706 2706 off += tocopy;
+1 -1
fs/f2fs/verity.c
··· 90 90 91 91 memcpy_to_page(page, offset_in_page(pos), buf, n); 92 92 93 - res = aops->write_end(NULL, mapping, pos, n, n, page, fsdata); 93 + res = aops->write_end(NULL, mapping, pos, n, n, page_folio(page), fsdata); 94 94 if (res < 0) 95 95 return res; 96 96 if (res != n)
+2 -2
fs/fat/inode.c
··· 236 236 237 237 static int fat_write_end(struct file *file, struct address_space *mapping, 238 238 loff_t pos, unsigned len, unsigned copied, 239 - struct page *pagep, void *fsdata) 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, pagep, fsdata); 243 + err = generic_write_end(file, 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)) {
+1 -2
fs/fuse/file.c
··· 2433 2433 2434 2434 static int fuse_write_end(struct file *file, struct address_space *mapping, 2435 2435 loff_t pos, unsigned len, unsigned copied, 2436 - struct page *page, void *fsdata) 2436 + struct folio *folio, void *fsdata) 2437 2437 { 2438 - struct folio *folio = page_folio(page); 2439 2438 struct inode *inode = folio->mapping->host; 2440 2439 2441 2440 /* Haven't copied anything? Skip zeroing, size extending, dirtying. */
+1 -1
fs/hfs/extent.c
··· 495 495 &fsdata); 496 496 if (!res) { 497 497 res = generic_write_end(NULL, mapping, size + 1, 0, 0, 498 - page, fsdata); 498 + page_folio(page), fsdata); 499 499 } 500 500 if (res) 501 501 inode->i_size = HFS_I(inode)->phys_size;
+1 -1
fs/hfsplus/extents.c
··· 563 563 if (res) 564 564 return; 565 565 res = generic_write_end(NULL, mapping, size, 0, 0, 566 - page, fsdata); 566 + page_folio(page), fsdata); 567 567 if (res < 0) 568 568 return; 569 569 mark_inode_dirty(inode);
+1 -2
fs/hostfs/hostfs_kern.c
··· 477 477 478 478 static int hostfs_write_end(struct file *file, struct address_space *mapping, 479 479 loff_t pos, unsigned len, unsigned copied, 480 - struct page *page, void *fsdata) 480 + struct folio *folio, void *fsdata) 481 481 { 482 - struct folio *folio = page_folio(page); 483 482 struct inode *inode = mapping->host; 484 483 void *buffer; 485 484 size_t from = offset_in_folio(folio, pos);
+2 -2
fs/hpfs/file.c
··· 206 206 207 207 static int hpfs_write_end(struct file *file, struct address_space *mapping, 208 208 loff_t pos, unsigned len, unsigned copied, 209 - struct page *pagep, void *fsdata) 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, pagep, fsdata); 213 + err = generic_write_end(file, mapping, pos, len, copied, folio, fsdata); 214 214 if (err < len) 215 215 hpfs_write_failed(mapping, pos + len); 216 216 if (!(err < 0)) {
+1 -1
fs/hugetlbfs/inode.c
··· 395 395 396 396 static int hugetlbfs_write_end(struct file *file, struct address_space *mapping, 397 397 loff_t pos, unsigned len, unsigned copied, 398 - struct page *page, void *fsdata) 398 + struct folio *folio, void *fsdata) 399 399 { 400 400 BUG(); 401 401 return -EINVAL;
+2 -3
fs/jffs2/file.c
··· 23 23 24 24 static int jffs2_write_end(struct file *filp, struct address_space *mapping, 25 25 loff_t pos, unsigned len, unsigned copied, 26 - struct page *pg, void *fsdata); 26 + struct folio *folio, void *fsdata); 27 27 static int jffs2_write_begin(struct file *filp, struct address_space *mapping, 28 28 loff_t pos, unsigned len, 29 29 struct page **pagep, void **fsdata); ··· 239 239 240 240 static int jffs2_write_end(struct file *filp, struct address_space *mapping, 241 241 loff_t pos, unsigned len, unsigned copied, 242 - struct page *pg, void *fsdata) 242 + struct folio *folio, void *fsdata) 243 243 { 244 - struct folio *folio = page_folio(pg); 245 244 /* Actually commit the write from the page cache page we're looking at. 246 245 * For now, we write the full page out each time. It sucks, but it's simple 247 246 */
+2 -2
fs/jfs/inode.c
··· 304 304 } 305 305 306 306 static int jfs_write_end(struct file *file, struct address_space *mapping, 307 - loff_t pos, unsigned len, unsigned copied, struct page *page, 307 + loff_t pos, unsigned len, unsigned copied, struct folio *folio, 308 308 void *fsdata) 309 309 { 310 310 int ret; 311 311 312 - ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata); 312 + ret = generic_write_end(file, mapping, pos, len, copied, folio, fsdata); 313 313 if (ret < len) 314 314 jfs_write_failed(mapping, pos + len); 315 315 return ret;
+4 -5
fs/libfs.c
··· 929 929 * @pos: " 930 930 * @len: " 931 931 * @copied: " 932 - * @page: " 932 + * @folio: " 933 933 * @fsdata: " 934 934 * 935 - * simple_write_end does the minimum needed for updating a page after writing is 936 - * done. It has the same API signature as the .write_end of 935 + * simple_write_end does the minimum needed for updating a folio after 936 + * writing is done. It has the same API signature as the .write_end of 937 937 * address_space_operations vector. So it can just be set onto .write_end for 938 938 * FSes that don't need any other processing. i_mutex is assumed to be held. 939 939 * Block based filesystems should use generic_write_end(). ··· 946 946 */ 947 947 static int simple_write_end(struct file *file, struct address_space *mapping, 948 948 loff_t pos, unsigned len, unsigned copied, 949 - struct page *page, void *fsdata) 949 + struct folio *folio, void *fsdata) 950 950 { 951 - struct folio *folio = page_folio(page); 952 951 struct inode *inode = folio->mapping->host; 953 952 loff_t last_pos = pos + copied; 954 953
+1 -1
fs/namei.c
··· 5321 5321 memcpy(page_address(page), symname, len-1); 5322 5322 5323 5323 err = aops->write_end(NULL, mapping, 0, len-1, len-1, 5324 - page, fsdata); 5324 + page_folio(page), fsdata); 5325 5325 if (err < 0) 5326 5326 goto fail; 5327 5327 if (err < len-1)
+1 -2
fs/nfs/file.c
··· 372 372 373 373 static int nfs_write_end(struct file *file, struct address_space *mapping, 374 374 loff_t pos, unsigned len, unsigned copied, 375 - struct page *page, void *fsdata) 375 + struct folio *folio, void *fsdata) 376 376 { 377 377 struct nfs_open_context *ctx = nfs_file_open_context(file); 378 - struct folio *folio = page_folio(page); 379 378 unsigned offset = offset_in_folio(folio, pos); 380 379 int status; 381 380
+3 -3
fs/nilfs2/inode.c
··· 269 269 270 270 static int nilfs_write_end(struct file *file, struct address_space *mapping, 271 271 loff_t pos, unsigned len, unsigned copied, 272 - struct page *page, void *fsdata) 272 + struct folio *folio, void *fsdata) 273 273 { 274 274 struct inode *inode = mapping->host; 275 275 unsigned int start = pos & (PAGE_SIZE - 1); 276 276 unsigned int nr_dirty; 277 277 int err; 278 278 279 - nr_dirty = nilfs_page_count_clean_buffers(page, start, 279 + nr_dirty = nilfs_page_count_clean_buffers(&folio->page, start, 280 280 start + copied); 281 - copied = generic_write_end(file, mapping, pos, len, copied, page, 281 + copied = generic_write_end(file, mapping, pos, len, copied, folio, 282 282 fsdata); 283 283 nilfs_set_file_dirty(inode, nr_dirty); 284 284 err = nilfs_transaction_commit(inode->i_sb);
+1 -1
fs/ntfs3/file.c
··· 215 215 zero_user_segment(page, zerofrom, PAGE_SIZE); 216 216 217 217 /* This function in any case puts page. */ 218 - err = ntfs_write_end(file, mapping, pos, len, len, page, NULL); 218 + err = ntfs_write_end(file, mapping, pos, len, len, page_folio(page), NULL); 219 219 if (err < 0) 220 220 goto out; 221 221 pos += len;
+2 -3
fs/ntfs3/inode.c
··· 947 947 * ntfs_write_end - Address_space_operations::write_end. 948 948 */ 949 949 int ntfs_write_end(struct file *file, struct address_space *mapping, loff_t pos, 950 - u32 len, u32 copied, struct page *page, void *fsdata) 950 + u32 len, u32 copied, struct folio *folio, void *fsdata) 951 951 { 952 - struct folio *folio = page_folio(page); 953 952 struct inode *inode = mapping->host; 954 953 struct ntfs_inode *ni = ntfs_i(inode); 955 954 u64 valid = ni->i_valid; ··· 978 979 folio_unlock(folio); 979 980 folio_put(folio); 980 981 } else { 981 - err = generic_write_end(file, mapping, pos, len, copied, page, 982 + err = generic_write_end(file, mapping, pos, len, copied, folio, 982 983 fsdata); 983 984 } 984 985
+1 -1
fs/ntfs3/ntfs_fs.h
··· 713 713 int ntfs_write_begin(struct file *file, struct address_space *mapping, 714 714 loff_t pos, u32 len, struct page **pagep, void **fsdata); 715 715 int ntfs_write_end(struct file *file, struct address_space *mapping, loff_t pos, 716 - u32 len, u32 copied, struct page *page, void *fsdata); 716 + u32 len, u32 copied, struct folio *folio, void *fsdata); 717 717 int ntfs3_write_inode(struct inode *inode, struct writeback_control *wbc); 718 718 int ntfs_sync_inode(struct inode *inode); 719 719 int ntfs_flush_inodes(struct super_block *sb, struct inode *i1,
+1 -1
fs/ocfs2/aops.c
··· 2076 2076 2077 2077 static int ocfs2_write_end(struct file *file, struct address_space *mapping, 2078 2078 loff_t pos, unsigned len, unsigned copied, 2079 - struct page *page, void *fsdata) 2079 + struct folio *folio, void *fsdata) 2080 2080 { 2081 2081 int ret; 2082 2082 struct inode *inode = mapping->host;
+2 -2
fs/orangefs/inode.c
··· 361 361 } 362 362 363 363 static int orangefs_write_end(struct file *file, struct address_space *mapping, 364 - loff_t pos, unsigned len, unsigned copied, struct page *page, void *fsdata) 364 + loff_t pos, unsigned len, unsigned copied, struct folio *folio, 365 + void *fsdata) 365 366 { 366 - struct folio *folio = page_folio(page); 367 367 struct inode *inode = folio->mapping->host; 368 368 loff_t last_pos = pos + copied; 369 369
+5 -6
fs/reiserfs/inode.c
··· 2862 2862 2863 2863 static int reiserfs_write_end(struct file *file, struct address_space *mapping, 2864 2864 loff_t pos, unsigned len, unsigned copied, 2865 - struct page *page, void *fsdata) 2865 + struct folio *folio, void *fsdata) 2866 2866 { 2867 - struct folio *folio = page_folio(page); 2868 - struct inode *inode = page->mapping->host; 2867 + struct inode *inode = folio->mapping->host; 2869 2868 int ret = 0; 2870 2869 int update_sd = 0; 2871 2870 struct reiserfs_transaction_handle *th; ··· 2886 2887 } 2887 2888 flush_dcache_folio(folio); 2888 2889 2889 - reiserfs_commit_page(inode, page, start, start + copied); 2890 + reiserfs_commit_page(inode, &folio->page, start, start + copied); 2890 2891 2891 2892 /* 2892 2893 * generic_commit_write does this for us, but does not update the ··· 2941 2942 out: 2942 2943 if (locked) 2943 2944 reiserfs_write_unlock(inode->i_sb); 2944 - unlock_page(page); 2945 - put_page(page); 2945 + folio_unlock(folio); 2946 + folio_put(folio); 2946 2947 2947 2948 if (pos + len > inode->i_size) 2948 2949 reiserfs_truncate_failed_write(inode);
+1 -2
fs/ubifs/file.c
··· 524 524 525 525 static int ubifs_write_end(struct file *file, struct address_space *mapping, 526 526 loff_t pos, unsigned len, unsigned copied, 527 - struct page *page, void *fsdata) 527 + struct folio *folio, void *fsdata) 528 528 { 529 - struct folio *folio = page_folio(page); 530 529 struct inode *inode = mapping->host; 531 530 struct ubifs_inode *ui = ubifs_inode(inode); 532 531 struct ubifs_info *c = inode->i_sb->s_fs_info;
+2 -4
fs/udf/inode.c
··· 273 273 274 274 static int udf_write_end(struct file *file, struct address_space *mapping, 275 275 loff_t pos, unsigned len, unsigned copied, 276 - struct page *page, void *fsdata) 276 + struct folio *folio, void *fsdata) 277 277 { 278 278 struct inode *inode = file_inode(file); 279 - struct folio *folio; 280 279 loff_t last_pos; 281 280 282 281 if (UDF_I(inode)->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) 283 - return generic_write_end(file, mapping, pos, len, copied, page, 282 + return generic_write_end(file, mapping, pos, len, copied, folio, 284 283 fsdata); 285 - folio = page_folio(page); 286 284 last_pos = pos + copied; 287 285 if (last_pos > inode->i_size) 288 286 i_size_write(inode, last_pos);
+2 -2
fs/ufs/inode.c
··· 511 511 512 512 static int ufs_write_end(struct file *file, struct address_space *mapping, 513 513 loff_t pos, unsigned len, unsigned copied, 514 - struct page *page, void *fsdata) 514 + struct folio *folio, void *fsdata) 515 515 { 516 516 int ret; 517 517 518 - ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata); 518 + ret = generic_write_end(file, mapping, pos, len, copied, folio, fsdata); 519 519 if (ret < len) 520 520 ufs_write_failed(mapping, pos + len); 521 521 return ret;
+3 -4
fs/vboxsf/file.c
··· 300 300 301 301 static int vboxsf_write_end(struct file *file, struct address_space *mapping, 302 302 loff_t pos, unsigned int len, unsigned int copied, 303 - struct page *page, void *fsdata) 303 + struct folio *folio, void *fsdata) 304 304 { 305 - struct folio *folio = page_folio(page); 306 305 struct inode *inode = mapping->host; 307 306 struct vboxsf_handle *sf_handle = file->private_data; 308 307 size_t from = offset_in_folio(folio, pos); ··· 313 314 if (!folio_test_uptodate(folio) && copied < len) 314 315 folio_zero_range(folio, from + copied, len - copied); 315 316 316 - buf = kmap(page); 317 + buf = kmap(&folio->page); 317 318 err = vboxsf_write(sf_handle->root, sf_handle->handle, 318 319 pos, &nwritten, buf + from); 319 - kunmap(page); 320 + kunmap(&folio->page); 320 321 321 322 if (err) { 322 323 nwritten = 0;
+2 -2
include/linux/buffer_head.h
··· 265 265 loff_t, unsigned len, unsigned copied, 266 266 struct folio *, void *); 267 267 int generic_write_end(struct file *, struct address_space *, 268 - loff_t, unsigned, unsigned, 269 - struct page *, void *); 268 + loff_t, unsigned len, unsigned copied, 269 + struct folio *, void *); 270 270 void folio_zero_new_buffers(struct folio *folio, size_t from, size_t to); 271 271 int cont_write_begin(struct file *, struct address_space *, loff_t, 272 272 unsigned, struct page **, void **,
+1 -1
include/linux/fs.h
··· 411 411 struct page **pagep, void **fsdata); 412 412 int (*write_end)(struct file *, struct address_space *mapping, 413 413 loff_t pos, unsigned len, unsigned copied, 414 - struct page *page, void *fsdata); 414 + struct folio *folio, void *fsdata); 415 415 416 416 /* Unfortunately this kludge is needed for FIBMAP. Don't use it */ 417 417 sector_t (*bmap)(struct address_space *, sector_t);
+1 -1
mm/filemap.c
··· 4033 4033 flush_dcache_folio(folio); 4034 4034 4035 4035 status = a_ops->write_end(file, mapping, pos, bytes, copied, 4036 - page, fsdata); 4036 + folio, fsdata); 4037 4037 if (unlikely(status != copied)) { 4038 4038 iov_iter_revert(i, copied - max(status, 0L)); 4039 4039 if (unlikely(status < 0))
+1 -2
mm/shmem.c
··· 2917 2917 static int 2918 2918 shmem_write_end(struct file *file, struct address_space *mapping, 2919 2919 loff_t pos, unsigned len, unsigned copied, 2920 - struct page *page, void *fsdata) 2920 + struct folio *folio, void *fsdata) 2921 2921 { 2922 - struct folio *folio = page_folio(page); 2923 2922 struct inode *inode = mapping->host; 2924 2923 2925 2924 if (pos + copied > inode->i_size)