]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fs: Convert aops->write_end to take a folio
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 10 Jul 2024 19:45:32 +0000 (15:45 -0400)
committerChristian Brauner <brauner@kernel.org>
Wed, 7 Aug 2024 09:32:02 +0000 (11:32 +0200)
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>
45 files changed:
Documentation/filesystems/locking.rst
Documentation/filesystems/vfs.rst
block/fops.c
drivers/gpu/drm/i915/gem/i915_gem_shmem.c
fs/affs/file.c
fs/bcachefs/fs-io-buffered.c
fs/bcachefs/fs-io-buffered.h
fs/buffer.c
fs/ceph/addr.c
fs/ecryptfs/mmap.c
fs/exfat/file.c
fs/exfat/inode.c
fs/ext2/inode.c
fs/ext4/inode.c
fs/ext4/verity.c
fs/f2fs/data.c
fs/f2fs/super.c
fs/f2fs/verity.c
fs/fat/inode.c
fs/fuse/file.c
fs/hfs/extent.c
fs/hfsplus/extents.c
fs/hostfs/hostfs_kern.c
fs/hpfs/file.c
fs/hugetlbfs/inode.c
fs/jffs2/file.c
fs/jfs/inode.c
fs/libfs.c
fs/namei.c
fs/nfs/file.c
fs/nilfs2/inode.c
fs/ntfs3/file.c
fs/ntfs3/inode.c
fs/ntfs3/ntfs_fs.h
fs/ocfs2/aops.c
fs/orangefs/inode.c
fs/reiserfs/inode.c
fs/ubifs/file.c
fs/udf/inode.c
fs/ufs/inode.c
fs/vboxsf/file.c
include/linux/buffer_head.h
include/linux/fs.h
mm/filemap.c
mm/shmem.c

index e664061ed55dc1bdc6d7d16c086f3050c32909d6..827fb5a073b7d7ba1cbe0c4ec40ac4f32b50abe9 100644 (file)
@@ -254,7 +254,7 @@ prototypes::
                                struct page **pagep, void **fsdata);
        int (*write_end)(struct file *, struct address_space *mapping,
                                loff_t pos, unsigned len, unsigned copied,
-                               struct page *page, void *fsdata);
+                               struct folio *folio, void *fsdata);
        sector_t (*bmap)(struct address_space *, sector_t);
        void (*invalidate_folio) (struct folio *, size_t start, size_t len);
        bool (*release_folio)(struct folio *, gfp_t);
index 6e903a903f8f691d55af7f3ae200f959fc7978a2..0e24f770c568b486a3dafb5ecaebb233cdb87414 100644 (file)
@@ -810,7 +810,7 @@ cache in your filesystem.  The following members are defined:
                                struct page **pagep, void **fsdata);
                int (*write_end)(struct file *, struct address_space *mapping,
                                 loff_t pos, unsigned len, unsigned copied,
-                                struct page *page, void *fsdata);
+                                struct folio *folio, void *fsdata);
                sector_t (*bmap)(struct address_space *, sector_t);
                void (*invalidate_folio) (struct folio *, size_t start, size_t len);
                bool (*release_folio)(struct folio *, gfp_t);
@@ -944,8 +944,8 @@ cache in your filesystem.  The following members are defined:
        called.  len is the original len passed to write_begin, and
        copied is the amount that was able to be copied.
 
-       The filesystem must take care of unlocking the page and
-       releasing it refcount, and updating i_size.
+       The filesystem must take care of unlocking the folio,
+       decrementing its refcount, and updating i_size.
 
        Returns < 0 on failure, otherwise the number of bytes (<=
        'copied') that were able to be copied into pagecache.
index df0e762cf397ba57666d2591d735196c4c62dae1..cd96a6f171191ad07a932f600558415710012608 100644 (file)
@@ -457,10 +457,9 @@ static int blkdev_write_begin(struct file *file, struct address_space *mapping,
 }
 
 static int blkdev_write_end(struct file *file, struct address_space *mapping,
-               loff_t pos, unsigned len, unsigned copied, struct page *page,
+               loff_t pos, unsigned len, unsigned copied, struct folio *folio,
                void *fsdata)
 {
-       struct folio *folio = page_folio(page);
        int ret;
        ret = block_write_end(file, mapping, pos, len, copied, folio, fsdata);
 
index c5e1c718a6d2620cc839dec2ef41d4bf623e90fa..3513165a29645c237840a8ab9343e855be180045 100644 (file)
@@ -494,7 +494,7 @@ shmem_pwrite(struct drm_i915_gem_object *obj,
                kunmap_local(vaddr);
 
                err = aops->write_end(obj->base.filp, mapping, offset, len,
-                                     len - unwritten, page, data);
+                                     len - unwritten, page_folio(page), data);
                if (err < 0)
                        return err;
 
@@ -688,7 +688,7 @@ i915_gem_object_create_shmem_from_data(struct drm_i915_private *i915,
                kunmap(page);
 
                err = aops->write_end(file, file->f_mapping, offset, len, len,
-                                     page, pgdata);
+                                     page_folio(page), pgdata);
                if (err < 0)
                        goto fail;
 
index 04c018e196028e7a392823688ccf95c2fb269126..6a6c5bc41b8f046f515a62f27447ddb7939f7da1 100644 (file)
@@ -433,12 +433,12 @@ static int affs_write_begin(struct file *file, struct address_space *mapping,
 
 static int affs_write_end(struct file *file, struct address_space *mapping,
                          loff_t pos, unsigned int len, unsigned int copied,
-                         struct page *page, void *fsdata)
+                         struct folio *folio, void *fsdata)
 {
        struct inode *inode = mapping->host;
        int ret;
 
-       ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata);
+       ret = generic_write_end(file, mapping, pos, len, copied, folio, fsdata);
 
        /* Clear Archived bit on file writes, as AmigaOS would do */
        if (AFFS_I(inode)->i_protect & FIBF_ARCHIVED) {
@@ -687,9 +687,8 @@ static int affs_write_begin_ofs(struct file *file, struct address_space *mapping
 
 static int affs_write_end_ofs(struct file *file, struct address_space *mapping,
                                loff_t pos, unsigned len, unsigned copied,
-                               struct page *page, void *fsdata)
+                               struct folio *folio, void *fsdata)
 {
-       struct folio *folio = page_folio(page);
        struct inode *inode = mapping->host;
        struct super_block *sb = inode->i_sb;
        struct buffer_head *bh, *prev_bh;
@@ -889,7 +888,7 @@ affs_truncate(struct inode *inode)
 
                res = mapping->a_ops->write_begin(NULL, mapping, isize, 0, &page, &fsdata);
                if (!res)
-                       res = mapping->a_ops->write_end(NULL, mapping, isize, 0, 0, page, fsdata);
+                       res = mapping->a_ops->write_end(NULL, mapping, isize, 0, 0, page_folio(page), fsdata);
                else
                        inode->i_size = AFFS_I(inode)->mmu_private;
                mark_inode_dirty(inode);
index cc33d763f7221d21c39bed6b66f4ccb9f95e5cd5..46ae9ef3589ab8d40e07e4b4e6bca36c1e9eb1cd 100644 (file)
@@ -743,12 +743,11 @@ err_unlock:
 
 int bch2_write_end(struct file *file, struct address_space *mapping,
                   loff_t pos, unsigned len, unsigned copied,
-                  struct page *page, void *fsdata)
+                  struct folio *folio, void *fsdata)
 {
        struct bch_inode_info *inode = to_bch_ei(mapping->host);
        struct bch_fs *c = inode->v.i_sb->s_fs_info;
        struct bch2_folio_reservation *res = fsdata;
-       struct folio *folio = page_folio(page);
        unsigned offset = pos - folio_pos(folio);
 
        lockdep_assert_held(&inode->v.i_rwsem);
index a6126ff790e62b92e70aed650b3b88a84de24e9f..16569b9874e0c149e99b5b92b906af3069c08eec 100644 (file)
@@ -13,7 +13,7 @@ void bch2_readahead(struct readahead_control *);
 int bch2_write_begin(struct file *, struct address_space *, loff_t,
                     unsigned, struct page **, void **);
 int bch2_write_end(struct file *, struct address_space *, loff_t,
-                  unsigned, unsigned, struct page *, void *);
+                  unsigned len, unsigned copied, struct folio *, void *);
 
 ssize_t bch2_write_iter(struct kiocb *, struct iov_iter *);
 
index acba3dfe55d8f9f3dc5fef4ab6592459bc70c4d1..1a0f2f65e8909976ab269b976542f28d9f379559 100644 (file)
@@ -2280,9 +2280,8 @@ EXPORT_SYMBOL(block_write_end);
 
 int generic_write_end(struct file *file, struct address_space *mapping,
                        loff_t pos, unsigned len, unsigned copied,
-                       struct page *page, void *fsdata)
+                       struct folio *folio, void *fsdata)
 {
-       struct folio *folio = page_folio(page);
        struct inode *inode = mapping->host;
        loff_t old_size = inode->i_size;
        bool i_size_changed = false;
@@ -2480,7 +2479,7 @@ int generic_cont_expand_simple(struct inode *inode, loff_t size)
        if (err)
                goto out;
 
-       err = aops->write_end(NULL, mapping, size, 0, 0, page, fsdata);
+       err = aops->write_end(NULL, mapping, size, 0, 0, page_folio(page), fsdata);
        BUG_ON(err > 0);
 
 out:
@@ -2518,7 +2517,7 @@ static int cont_expand_zero(struct file *file, struct address_space *mapping,
                        goto out;
                zero_user(page, zerofrom, len);
                err = aops->write_end(file, mapping, curpos, len, len,
-                                               page, fsdata);
+                                               page_folio(page), fsdata);
                if (err < 0)
                        goto out;
                BUG_ON(err != len);
@@ -2551,7 +2550,7 @@ static int cont_expand_zero(struct file *file, struct address_space *mapping,
                        goto out;
                zero_user(page, zerofrom, len);
                err = aops->write_end(file, mapping, curpos, len, len,
-                                               page, fsdata);
+                                               page_folio(page), fsdata);
                if (err < 0)
                        goto out;
                BUG_ON(err != len);
index 8c16bc5250ef56cb8d0864d3b4b054466d57f250..87369e2659c798c97365597a2104d92905de0605 100644 (file)
@@ -1509,9 +1509,8 @@ static int ceph_write_begin(struct file *file, struct address_space *mapping,
  */
 static int ceph_write_end(struct file *file, struct address_space *mapping,
                          loff_t pos, unsigned len, unsigned copied,
-                         struct page *subpage, void *fsdata)
+                         struct folio *folio, void *fsdata)
 {
-       struct folio *folio = page_folio(subpage);
        struct inode *inode = file_inode(file);
        struct ceph_client *cl = ceph_inode_to_client(inode);
        bool check_cap = false;
index 75ce28d757b7e50449687aef0adbe5fb1cdb8d90..f43e42ede75ea76795326502de3ea16d0a6802c9 100644 (file)
@@ -458,15 +458,14 @@ int ecryptfs_write_inode_size_to_metadata(struct inode *ecryptfs_inode)
  * @pos: The file position
  * @len: The length of the data (unused)
  * @copied: The amount of data copied
- * @page: The eCryptfs page
+ * @folio: The eCryptfs folio
  * @fsdata: The fsdata (unused)
  */
 static int ecryptfs_write_end(struct file *file,
                        struct address_space *mapping,
                        loff_t pos, unsigned len, unsigned copied,
-                       struct page *page, void *fsdata)
+                       struct folio *folio, void *fsdata)
 {
-       struct folio *folio = page_folio(page);
        pgoff_t index = pos >> PAGE_SHIFT;
        unsigned from = pos & (PAGE_SIZE - 1);
        unsigned to = from + copied;
index 64c31867bc7615b55f8d9c524b8fb13a9b99f706..7144472d092ec779e817ec74e42597c6c848bcf5 100644 (file)
@@ -548,7 +548,7 @@ static int exfat_file_zeroed_range(struct file *file, loff_t start, loff_t end)
 
                zero_user_segment(page, zerofrom, zerofrom + len);
 
-               err = ops->write_end(file, mapping, start, len, len, page, NULL);
+               err = ops->write_end(file, mapping, start, len, len, page_folio(page), NULL);
                if (err < 0)
                        goto out;
                start += len;
index dd894e558c9144a2eed57c90822eca166f127c9b..871e9e3e407e573a401869181fead71c787b1d4c 100644 (file)
@@ -463,13 +463,13 @@ static int exfat_write_begin(struct file *file, struct address_space *mapping,
 
 static int exfat_write_end(struct file *file, struct address_space *mapping,
                loff_t pos, unsigned int len, unsigned int copied,
-               struct page *pagep, void *fsdata)
+               struct folio *folio, void *fsdata)
 {
        struct inode *inode = mapping->host;
        struct exfat_inode_info *ei = EXFAT_I(inode);
        int err;
 
-       err = generic_write_end(file, mapping, pos, len, copied, pagep, fsdata);
+       err = generic_write_end(file, mapping, pos, len, copied, folio, fsdata);
 
        if (ei->i_size_aligned < i_size_read(inode)) {
                exfat_fs_error(inode->i_sb,
index 0caa1650cee87593c7bd2c560efe63886df322a2..aba41f6150e5fb70dbbfaf220d9e7cb70c937651 100644 (file)
@@ -928,11 +928,11 @@ ext2_write_begin(struct file *file, struct address_space *mapping,
 
 static int ext2_write_end(struct file *file, struct address_space *mapping,
                        loff_t pos, unsigned len, unsigned copied,
-                       struct page *page, void *fsdata)
+                       struct folio *folio, void *fsdata)
 {
        int ret;
 
-       ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata);
+       ret = generic_write_end(file, mapping, pos, len, copied, folio, fsdata);
        if (ret < len)
                ext2_write_failed(mapping, pos + len);
        return ret;
index 1e4831d83adcb9f0654d75951755f811dd782796..e19ac0a82bdc6d28fc6d8cdbe3467f49d4edc59d 100644 (file)
@@ -1298,9 +1298,8 @@ static int write_end_fn(handle_t *handle, struct inode *inode,
 static int ext4_write_end(struct file *file,
                          struct address_space *mapping,
                          loff_t pos, unsigned len, unsigned copied,
-                         struct page *page, void *fsdata)
+                         struct folio *folio, void *fsdata)
 {
-       struct folio *folio = page_folio(page);
        handle_t *handle = ext4_journal_current_handle();
        struct inode *inode = mapping->host;
        loff_t old_size = inode->i_size;
@@ -1402,9 +1401,8 @@ static void ext4_journalled_zero_new_buffers(handle_t *handle,
 static int ext4_journalled_write_end(struct file *file,
                                     struct address_space *mapping,
                                     loff_t pos, unsigned len, unsigned copied,
-                                    struct page *page, void *fsdata)
+                                    struct folio *folio, void *fsdata)
 {
-       struct folio *folio = page_folio(page);
        handle_t *handle = ext4_journal_current_handle();
        struct inode *inode = mapping->host;
        loff_t old_size = inode->i_size;
@@ -3080,15 +3078,14 @@ static int ext4_da_do_write_end(struct address_space *mapping,
 static int ext4_da_write_end(struct file *file,
                             struct address_space *mapping,
                             loff_t pos, unsigned len, unsigned copied,
-                            struct page *page, void *fsdata)
+                            struct folio *folio, void *fsdata)
 {
        struct inode *inode = mapping->host;
        int write_mode = (int)(unsigned long)fsdata;
-       struct folio *folio = page_folio(page);
 
        if (write_mode == FALL_BACK_TO_NONDELALLOC)
                return ext4_write_end(file, mapping, pos,
-                                     len, copied, &folio->page, fsdata);
+                                     len, copied, folio, fsdata);
 
        trace_ext4_da_write_end(inode, pos, len, copied);
 
index 2f37e1ea395510ea08af5f14f7e07337a155ca2d..86ef272296ab9c9f0df3d3da41bec36e9f7ec961 100644 (file)
@@ -86,7 +86,7 @@ static int pagecache_write(struct inode *inode, const void *buf, size_t count,
 
                memcpy_to_page(page, offset_in_page(pos), buf, n);
 
-               res = aops->write_end(NULL, mapping, pos, n, n, page, fsdata);
+               res = aops->write_end(NULL, mapping, pos, n, n, page_folio(page), fsdata);
                if (res < 0)
                        return res;
                if (res != n)
index 9a45f9fb8a6414ece52a8ecf7e46db44cc7d1170..4c32e2cfc403a53b19c8d7556a55c075a79e5c80 100644 (file)
@@ -3689,9 +3689,8 @@ fail:
 static int f2fs_write_end(struct file *file,
                        struct address_space *mapping,
                        loff_t pos, unsigned len, unsigned copied,
-                       struct page *page, void *fsdata)
+                       struct folio *folio, void *fsdata)
 {
-       struct folio *folio = page_folio(page);
        struct inode *inode = folio->mapping->host;
 
        trace_f2fs_write_end(inode, pos, len, copied);
index 3959fd137cc9b1befb79849659bf4870f2706e64..cfd38cd4f82cdf288a7e20fc889e5159ba65eb12 100644 (file)
@@ -2700,7 +2700,7 @@ retry:
                memcpy_to_page(page, offset, data, tocopy);
 
                a_ops->write_end(NULL, mapping, off, tocopy, tocopy,
-                                               page, fsdata);
+                                               page_folio(page), fsdata);
                offset = 0;
                towrite -= tocopy;
                off += tocopy;
index f7bb0c54502c8d57981ffe9f41850b5c196e9f2c..486512144bf140fca74f08a1dc5629a281513d4f 100644 (file)
@@ -90,7 +90,7 @@ static int pagecache_write(struct inode *inode, const void *buf, size_t count,
 
                memcpy_to_page(page, offset_in_page(pos), buf, n);
 
-               res = aops->write_end(NULL, mapping, pos, n, n, page, fsdata);
+               res = aops->write_end(NULL, mapping, pos, n, n, page_folio(page), fsdata);
                if (res < 0)
                        return res;
                if (res != n)
index 19115fd2d2a4bdc79fcf4676938b1456eadf9f74..8ed02b17d591f56f6b5f79d959d3780a295cce18 100644 (file)
@@ -236,11 +236,11 @@ static int fat_write_begin(struct file *file, struct address_space *mapping,
 
 static int fat_write_end(struct file *file, struct address_space *mapping,
                        loff_t pos, unsigned len, unsigned copied,
-                       struct page *pagep, void *fsdata)
+                       struct folio *folio, void *fsdata)
 {
        struct inode *inode = mapping->host;
        int err;
-       err = generic_write_end(file, mapping, pos, len, copied, pagep, fsdata);
+       err = generic_write_end(file, mapping, pos, len, copied, folio, fsdata);
        if (err < len)
                fat_write_failed(mapping, pos + len);
        if (!(err < 0) && !(MSDOS_I(inode)->i_attrs & ATTR_ARCH)) {
index 137485999d3d1b0277a9e692cfcceda908955ecf..a5cd6e4f9b2b0e9e00f1547c82daaf9ca6cc24f6 100644 (file)
@@ -2433,9 +2433,8 @@ error:
 
 static int fuse_write_end(struct file *file, struct address_space *mapping,
                loff_t pos, unsigned len, unsigned copied,
-               struct page *page, void *fsdata)
+               struct folio *folio, void *fsdata)
 {
-       struct folio *folio = page_folio(page);
        struct inode *inode = folio->mapping->host;
 
        /* Haven't copied anything?  Skip zeroing, size extending, dirtying. */
index 6d1878b99b3058beb91929d60b65db6beff10db6..30512dbb79f08b156af90c8bcf28edf2b6373c7f 100644 (file)
@@ -495,7 +495,7 @@ void hfs_file_truncate(struct inode *inode)
                                &fsdata);
                if (!res) {
                        res = generic_write_end(NULL, mapping, size + 1, 0, 0,
-                                       page, fsdata);
+                                       page_folio(page), fsdata);
                }
                if (res)
                        inode->i_size = HFS_I(inode)->phys_size;
index 9c51867dddc51f94c7b6467a50bfc615153b4d77..776c0ea722cb2a2276278d71614d646573f53b84 100644 (file)
@@ -563,7 +563,7 @@ void hfsplus_file_truncate(struct inode *inode)
                if (res)
                        return;
                res = generic_write_end(NULL, mapping, size, 0, 0,
-                                       page, fsdata);
+                                       page_folio(page), fsdata);
                if (res < 0)
                        return;
                mark_inode_dirty(inode);
index 805cfe39c40f4c0b95bd07c9a017314e261ea471..d0cbc5ece952131f433bdc66184c2d20b8fe9db8 100644 (file)
@@ -477,9 +477,8 @@ static int hostfs_write_begin(struct file *file, struct address_space *mapping,
 
 static int hostfs_write_end(struct file *file, struct address_space *mapping,
                            loff_t pos, unsigned len, unsigned copied,
-                           struct page *page, void *fsdata)
+                           struct folio *folio, void *fsdata)
 {
-       struct folio *folio = page_folio(page);
        struct inode *inode = mapping->host;
        void *buffer;
        size_t from = offset_in_folio(folio, pos);
index 1bb8d97cd9aef611ff8b9f8da658f1139b65aae9..11e2d9e612ac1d2d15886672220372ebf31309b6 100644 (file)
@@ -206,11 +206,11 @@ static int hpfs_write_begin(struct file *file, struct address_space *mapping,
 
 static int hpfs_write_end(struct file *file, struct address_space *mapping,
                        loff_t pos, unsigned len, unsigned copied,
-                       struct page *pagep, void *fsdata)
+                       struct folio *folio, void *fsdata)
 {
        struct inode *inode = mapping->host;
        int err;
-       err = generic_write_end(file, mapping, pos, len, copied, pagep, fsdata);
+       err = generic_write_end(file, mapping, pos, len, copied, folio, fsdata);
        if (err < len)
                hpfs_write_failed(mapping, pos + len);
        if (!(err < 0)) {
index 9f6cff356796c27de85318c0ae77928beaeda6a2..b7a30055e6f40824ddc6b3ad56fca7e576189c60 100644 (file)
@@ -395,7 +395,7 @@ static int hugetlbfs_write_begin(struct file *file,
 
 static int hugetlbfs_write_end(struct file *file, struct address_space *mapping,
                        loff_t pos, unsigned len, unsigned copied,
-                       struct page *page, void *fsdata)
+                       struct folio *folio, void *fsdata)
 {
        BUG();
        return -EINVAL;
index ee8f7f029b459b4ab35f93a64ad80fcbe28991c6..b6fe1f1e8ea9724280daa158a3e1155ffad7d6ce 100644 (file)
@@ -23,7 +23,7 @@
 
 static int jffs2_write_end(struct file *filp, struct address_space *mapping,
                        loff_t pos, unsigned len, unsigned copied,
-                       struct page *pg, void *fsdata);
+                       struct folio *folio, void *fsdata);
 static int jffs2_write_begin(struct file *filp, struct address_space *mapping,
                        loff_t pos, unsigned len,
                        struct page **pagep, void **fsdata);
@@ -239,9 +239,8 @@ out_err:
 
 static int jffs2_write_end(struct file *filp, struct address_space *mapping,
                        loff_t pos, unsigned len, unsigned copied,
-                       struct page *pg, void *fsdata)
+                       struct folio *folio, void *fsdata)
 {
-       struct folio *folio = page_folio(pg);
        /* Actually commit the write from the page cache page we're looking at.
         * For now, we write the full page out each time. It sucks, but it's simple
         */
index 1a6b5921d17a13109b154a02b8c2ed06f504bd6a..d634941825486c8f31df78a0c11b3ddc00999916 100644 (file)
@@ -304,12 +304,12 @@ static int jfs_write_begin(struct file *file, struct address_space *mapping,
 }
 
 static int jfs_write_end(struct file *file, struct address_space *mapping,
-               loff_t pos, unsigned len, unsigned copied, struct page *page,
+               loff_t pos, unsigned len, unsigned copied, struct folio *folio,
                void *fsdata)
 {
        int ret;
 
-       ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata);
+       ret = generic_write_end(file, mapping, pos, len, copied, folio, fsdata);
        if (ret < len)
                jfs_write_failed(mapping, pos + len);
        return ret;
index 8aa34870449fe18ce5d44ec525dd8e666de95a23..4581be1d5b32b392d5046666caa597479f759299 100644 (file)
@@ -929,11 +929,11 @@ EXPORT_SYMBOL(simple_write_begin);
  * @pos:               "
  * @len:               "
  * @copied:            "
- * @page:              "
+ * @folio:             "
  * @fsdata:            "
  *
- * simple_write_end does the minimum needed for updating a page after writing is
- * done. It has the same API signature as the .write_end of
+ * simple_write_end does the minimum needed for updating a folio after
+ * writing is done. It has the same API signature as the .write_end of
  * address_space_operations vector. So it can just be set onto .write_end for
  * FSes that don't need any other processing. i_mutex is assumed to be held.
  * Block based filesystems should use generic_write_end().
@@ -946,9 +946,8 @@ EXPORT_SYMBOL(simple_write_begin);
  */
 static int simple_write_end(struct file *file, struct address_space *mapping,
                        loff_t pos, unsigned len, unsigned copied,
-                       struct page *page, void *fsdata)
+                       struct folio *folio, void *fsdata)
 {
-       struct folio *folio = page_folio(page);
        struct inode *inode = folio->mapping->host;
        loff_t last_pos = pos + copied;
 
index 5512cb10fa897168cca5623cd8c91fbc98983343..fb7055245e68395e3b3ea13cbf812a8bb9a33ec2 100644 (file)
@@ -5321,7 +5321,7 @@ retry:
        memcpy(page_address(page), symname, len-1);
 
        err = aops->write_end(NULL, mapping, 0, len-1, len-1,
-                                                       page, fsdata);
+                                               page_folio(page), fsdata);
        if (err < 0)
                goto fail;
        if (err < len-1)
index 61a8cdb9f1e1fa6a0f3618fdef649bc8dfd0426f..fe583dbebe540dde1fc3a411b518525babf539f7 100644 (file)
@@ -372,10 +372,9 @@ start:
 
 static int nfs_write_end(struct file *file, struct address_space *mapping,
                         loff_t pos, unsigned len, unsigned copied,
-                        struct page *page, void *fsdata)
+                        struct folio *folio, void *fsdata)
 {
        struct nfs_open_context *ctx = nfs_file_open_context(file);
-       struct folio *folio = page_folio(page);
        unsigned offset = offset_in_folio(folio, pos);
        int status;
 
index 7340a01d80e1fddaebee1b0267d24b11bf0f1b54..25841b75415ad9c7dd3601e72ced95270f24f419 100644 (file)
@@ -269,16 +269,16 @@ static int nilfs_write_begin(struct file *file, struct address_space *mapping,
 
 static int nilfs_write_end(struct file *file, struct address_space *mapping,
                           loff_t pos, unsigned len, unsigned copied,
-                          struct page *page, void *fsdata)
+                          struct folio *folio, void *fsdata)
 {
        struct inode *inode = mapping->host;
        unsigned int start = pos & (PAGE_SIZE - 1);
        unsigned int nr_dirty;
        int err;
 
-       nr_dirty = nilfs_page_count_clean_buffers(page, start,
+       nr_dirty = nilfs_page_count_clean_buffers(&folio->page, start,
                                                  start + copied);
-       copied = generic_write_end(file, mapping, pos, len, copied, page,
+       copied = generic_write_end(file, mapping, pos, len, copied, folio,
                                   fsdata);
        nilfs_set_file_dirty(inode, nr_dirty);
        err = nilfs_transaction_commit(inode->i_sb);
index ca1ddc46bd8664b88b716ce5a9f84652adddcfb1..88a7d81cf2ba328c572e6eb77205809d70097746 100644 (file)
@@ -215,7 +215,7 @@ static int ntfs_extend_initialized_size(struct file *file,
                zero_user_segment(page, zerofrom, PAGE_SIZE);
 
                /* This function in any case puts page. */
-               err = ntfs_write_end(file, mapping, pos, len, len, page, NULL);
+               err = ntfs_write_end(file, mapping, pos, len, len, page_folio(page), NULL);
                if (err < 0)
                        goto out;
                pos += len;
index 8eaaf9e465d4d3800456751be055a12fe7fb1e0d..9efd3f7c59d6c1440c0755f0c63563cc6bf0f84b 100644 (file)
@@ -947,9 +947,8 @@ out:
  * ntfs_write_end - Address_space_operations::write_end.
  */
 int ntfs_write_end(struct file *file, struct address_space *mapping, loff_t pos,
-                  u32 len, u32 copied, struct page *page, void *fsdata)
+                  u32 len, u32 copied, struct folio *folio, void *fsdata)
 {
-       struct folio *folio = page_folio(page);
        struct inode *inode = mapping->host;
        struct ntfs_inode *ni = ntfs_i(inode);
        u64 valid = ni->i_valid;
@@ -979,7 +978,7 @@ int ntfs_write_end(struct file *file, struct address_space *mapping, loff_t pos,
                folio_unlock(folio);
                folio_put(folio);
        } else {
-               err = generic_write_end(file, mapping, pos, len, copied, page,
+               err = generic_write_end(file, mapping, pos, len, copied, folio,
                                        fsdata);
        }
 
index 4e363b8342d62e21ae032ad1b50be1eb8b9672d8..53517281f26bbf2c2fd0d5ab18276bfa1d4669fc 100644 (file)
@@ -713,7 +713,7 @@ int ntfs_get_block(struct inode *inode, sector_t vbn,
 int ntfs_write_begin(struct file *file, struct address_space *mapping,
                     loff_t pos, u32 len, struct page **pagep, void **fsdata);
 int ntfs_write_end(struct file *file, struct address_space *mapping, loff_t pos,
-                  u32 len, u32 copied, struct page *page, void *fsdata);
+                  u32 len, u32 copied, struct folio *folio, void *fsdata);
 int ntfs3_write_inode(struct inode *inode, struct writeback_control *wbc);
 int ntfs_sync_inode(struct inode *inode);
 int ntfs_flush_inodes(struct super_block *sb, struct inode *i1,
index 6be175a1ab3ce1d7ed4f6472dced526aa0e276c7..9d8aa417e8da9ee4521b18c90bc9028769b31153 100644 (file)
@@ -2076,7 +2076,7 @@ out:
 
 static int ocfs2_write_end(struct file *file, struct address_space *mapping,
                           loff_t pos, unsigned len, unsigned copied,
-                          struct page *page, void *fsdata)
+                          struct folio *folio, void *fsdata)
 {
        int ret;
        struct inode *inode = mapping->host;
index e8440fa7d73ce31e7faba36b7f1101d8618deecc..69b507a611f85c84abb20582e1bd2c2e0d866f2b 100644 (file)
@@ -361,9 +361,9 @@ okay:
 }
 
 static int orangefs_write_end(struct file *file, struct address_space *mapping,
-    loff_t pos, unsigned len, unsigned copied, struct page *page, void *fsdata)
+               loff_t pos, unsigned len, unsigned copied, struct folio *folio,
+               void *fsdata)
 {
-       struct folio *folio = page_folio(page);
        struct inode *inode = folio->mapping->host;
        loff_t last_pos = pos + copied;
 
index 33da519c9767f71411dada9418fb76e95edf1f92..f4b9db4b4df22d953ff78a4d2cf8402a1589c977 100644 (file)
@@ -2862,10 +2862,9 @@ static sector_t reiserfs_aop_bmap(struct address_space *as, sector_t block)
 
 static int reiserfs_write_end(struct file *file, struct address_space *mapping,
                              loff_t pos, unsigned len, unsigned copied,
-                             struct page *page, void *fsdata)
+                             struct folio *folio, void *fsdata)
 {
-       struct folio *folio = page_folio(page);
-       struct inode *inode = page->mapping->host;
+       struct inode *inode = folio->mapping->host;
        int ret = 0;
        int update_sd = 0;
        struct reiserfs_transaction_handle *th;
@@ -2887,7 +2886,7 @@ static int reiserfs_write_end(struct file *file, struct address_space *mapping,
        }
        flush_dcache_folio(folio);
 
-       reiserfs_commit_page(inode, page, start, start + copied);
+       reiserfs_commit_page(inode, &folio->page, start, start + copied);
 
        /*
         * generic_commit_write does this for us, but does not update the
@@ -2942,8 +2941,8 @@ static int reiserfs_write_end(struct file *file, struct address_space *mapping,
 out:
        if (locked)
                reiserfs_write_unlock(inode->i_sb);
-       unlock_page(page);
-       put_page(page);
+       folio_unlock(folio);
+       folio_put(folio);
 
        if (pos + len > inode->i_size)
                reiserfs_truncate_failed_write(inode);
index 68e104423a48237d506c93d7fc953ebc2d2789f0..baa3eecc32feeca80a71bbf447e24907332ee37e 100644 (file)
@@ -524,9 +524,8 @@ static void cancel_budget(struct ubifs_info *c, struct folio *folio,
 
 static int ubifs_write_end(struct file *file, struct address_space *mapping,
                           loff_t pos, unsigned len, unsigned copied,
-                          struct page *page, void *fsdata)
+                          struct folio *folio, void *fsdata)
 {
-       struct folio *folio = page_folio(page);
        struct inode *inode = mapping->host;
        struct ubifs_inode *ui = ubifs_inode(inode);
        struct ubifs_info *c = inode->i_sb->s_fs_info;
index 4726a4d014b60c65b1a75a0a99f15e588b888fbe..fdf024e0b7724746e47189a700ca62c6ae00d29b 100644 (file)
@@ -273,16 +273,14 @@ static int udf_write_begin(struct file *file, struct address_space *mapping,
 
 static int udf_write_end(struct file *file, struct address_space *mapping,
                         loff_t pos, unsigned len, unsigned copied,
-                        struct page *page, void *fsdata)
+                        struct folio *folio, void *fsdata)
 {
        struct inode *inode = file_inode(file);
-       struct folio *folio;
        loff_t last_pos;
 
        if (UDF_I(inode)->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB)
-               return generic_write_end(file, mapping, pos, len, copied, page,
+               return generic_write_end(file, mapping, pos, len, copied, folio,
                                         fsdata);
-       folio = page_folio(page);
        last_pos = pos + copied;
        if (last_pos > inode->i_size)
                i_size_write(inode, last_pos);
index 0e608fc0d0fd2636524e4419aa31d0d9085a1f30..69adb198c634352d0b2b83524b99f3df890a48f1 100644 (file)
@@ -511,11 +511,11 @@ static int ufs_write_begin(struct file *file, struct address_space *mapping,
 
 static int ufs_write_end(struct file *file, struct address_space *mapping,
                        loff_t pos, unsigned len, unsigned copied,
-                       struct page *page, void *fsdata)
+                       struct folio *folio, void *fsdata)
 {
        int ret;
 
-       ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata);
+       ret = generic_write_end(file, mapping, pos, len, copied, folio, fsdata);
        if (ret < len)
                ufs_write_failed(mapping, pos + len);
        return ret;
index 029f106d56d97ff8a4349c10ff6b6f6fccdc4f40..b780deb81b022c692ef8b95ff5b94f1c2955381e 100644 (file)
@@ -300,9 +300,8 @@ static int vboxsf_writepage(struct page *page, struct writeback_control *wbc)
 
 static int vboxsf_write_end(struct file *file, struct address_space *mapping,
                            loff_t pos, unsigned int len, unsigned int copied,
-                           struct page *page, void *fsdata)
+                           struct folio *folio, void *fsdata)
 {
-       struct folio *folio = page_folio(page);
        struct inode *inode = mapping->host;
        struct vboxsf_handle *sf_handle = file->private_data;
        size_t from = offset_in_folio(folio, pos);
@@ -314,10 +313,10 @@ static int vboxsf_write_end(struct file *file, struct address_space *mapping,
        if (!folio_test_uptodate(folio) && copied < len)
                folio_zero_range(folio, from + copied, len - copied);
 
-       buf = kmap(page);
+       buf = kmap(&folio->page);
        err = vboxsf_write(sf_handle->root, sf_handle->handle,
                           pos, &nwritten, buf + from);
-       kunmap(page);
+       kunmap(&folio->page);
 
        if (err) {
                nwritten = 0;
index 3a3fec154536b7b83b5d5eda5129193ab24049d7..165e859664a559d3e08b0962100328cbc8551d3a 100644 (file)
@@ -265,8 +265,8 @@ int block_write_end(struct file *, struct address_space *,
                                loff_t, unsigned len, unsigned copied,
                                struct folio *, void *);
 int generic_write_end(struct file *, struct address_space *,
-                               loff_t, unsigned, unsigned,
-                               struct page *, void *);
+                               loff_t, unsigned len, unsigned copied,
+                               struct folio *, void *);
 void folio_zero_new_buffers(struct folio *folio, size_t from, size_t to);
 int cont_write_begin(struct file *, struct address_space *, loff_t,
                        unsigned, struct page **, void **,
index fd34b5755c0b52988a7131493cd56fa8ea640ad9..1af3373c7cd2a1dbb748db2e8dd19fe8a3285b7b 100644 (file)
@@ -411,7 +411,7 @@ struct address_space_operations {
                                struct page **pagep, void **fsdata);
        int (*write_end)(struct file *, struct address_space *mapping,
                                loff_t pos, unsigned len, unsigned copied,
-                               struct page *page, void *fsdata);
+                               struct folio *folio, void *fsdata);
 
        /* Unfortunately this kludge is needed for FIBMAP. Don't use it */
        sector_t (*bmap)(struct address_space *, sector_t);
index d62150418b910488d7eed35c86af9f8dc4e7cc24..fab6b0c3044ec44af0bff7166a8ada86c88eb7f3 100644 (file)
@@ -4033,7 +4033,7 @@ retry:
                flush_dcache_folio(folio);
 
                status = a_ops->write_end(file, mapping, pos, bytes, copied,
-                                               page, fsdata);
+                                               folio, fsdata);
                if (unlikely(status != copied)) {
                        iov_iter_revert(i, copied - max(status, 0L));
                        if (unlikely(status < 0))
index 2faa9daaf54baaf853460fcd424d6bfe5fb1a056..1116f147d78847af2fb88a98d49d7d301e39a77d 100644 (file)
@@ -2917,9 +2917,8 @@ shmem_write_begin(struct file *file, struct address_space *mapping,
 static int
 shmem_write_end(struct file *file, struct address_space *mapping,
                        loff_t pos, unsigned len, unsigned copied,
-                       struct page *page, void *fsdata)
+                       struct folio *folio, void *fsdata)
 {
-       struct folio *folio = page_folio(page);
        struct inode *inode = mapping->host;
 
        if (pos + copied > inode->i_size)