projects/linux·commit 2775df6e

Merge tag 'vfs-6.12.folio' of gitolite.kernel.org:pub/scm/linux/kernel/git/vfs/vfs

2775df6e · Linus Torvalds <[email protected]> · 2024-09-16 08:54:30 +02:00

Pull vfs folio updates from Christian Brauner:
 "This contains work to port write_begin and write_end to rely on folios
  for various filesystems.

  This converts ocfs2, vboxfs, orangefs, jffs2, hostfs, fuse, f2fs,
  ecryptfs, ntfs3, nilfs2, reiserfs, minixfs, qnx6, sysv, ufs, and
  squashfs.

  After this series lands a bunch of the filesystems in this list do not
  mention struct page anymore"

* tag 'vfs-6.12.folio' of gitolite.kernel.org:pub/scm/linux/kernel/git/vfs/vfs: (61 commits)
  Squashfs: Ensure all readahead pages have been used
  Squashfs: Rewrite and update squashfs_readahead_fragment() to not use page->index
  Squashfs: Update squashfs_readpage_block() to not use page->index
  Squashfs: Update squashfs_readahead() to not use page->index
  Squashfs: Update page_actor to not use page->index
  jffs2: Use a folio in jffs2_garbage_collect_dnode()
  jffs2: Convert jffs2_do_readpage_nolock to take a folio
  buffer: Convert __block_write_begin() to take a folio
  ocfs2: Convert ocfs2_write_zero_page to use a folio
  fs: Convert aops->write_begin to take a folio
  fs: Convert aops->write_end to take a folio
  vboxsf: Use a folio in vboxsf_write_end()
  orangefs: Convert orangefs_write_begin() to use a folio
  orangefs: Convert orangefs_write_end() to use a folio
  jffs2: Convert jffs2_write_begin() to use a folio
  jffs2: Convert jffs2_write_end() to use a folio
  hostfs: Convert hostfs_write_end() to use a folio
  fuse: Convert fuse_write_begin() to use a folio
  fuse: Convert fuse_write_end() to use a folio
  f2fs: Convert f2fs_write_begin() to use a folio
  ...
Commit
2775df6e5e324be9dc375f7db2c8d3042df72bbf
Parents
8f72c31f · 84e0e03b

Merge commit. Changes below are compared with the first parent: 8f72c31f.

Changes

83 files changed · +994 −1064

FileStatusAddDelContent
Documentation/filesystems/locking.rstmodified+3−3View file
Documentation/filesystems/vfs.rstmodified+6−6View file
block/fops.cmodified+6−6View file
drivers/gpu/drm/i915/gem/i915_gem_shmem.cmodified+22−25View file
fs/adfs/inode.cmodified+2−3View file
fs/affs/file.cmodified+10−12View file
fs/bcachefs/fs-io-buffered.cmodified+3−5View file
fs/bcachefs/fs-io-buffered.hmodified+3−3View file
fs/bfs/file.cmodified+2−2View file
fs/buffer.cmodified+31−32View file
fs/ceph/addr.cmodified+5−8View file
fs/ecryptfs/mmap.cmodified+43−43View file
fs/exfat/file.cmodified+4−4View file
fs/exfat/inode.cmodified+4−5View file
fs/ext2/dir.cmodified+2−2View file
fs/ext2/inode.cmodified+4−4View file
fs/ext4/ext4.hmodified+2−2View file
fs/ext4/inline.cmodified+7−7View file
fs/ext4/inode.cmodified+17−20View file
fs/ext4/verity.cmodified+4−4View file
fs/f2fs/data.cmodified+47−40View file
fs/f2fs/super.cmodified+4−4View file
fs/f2fs/verity.cmodified+4−4View file
fs/fat/inode.cmodified+4−5View file
fs/fuse/file.cmodified+24−23View file
fs/hfs/extent.cmodified+3−3View file
fs/hfs/hfs_fs.hmodified+1−1View file
fs/hfs/inode.cmodified+2−3View file
fs/hfsplus/extents.cmodified+3−3View file
fs/hfsplus/hfsplus_fs.hmodified+1−1View file
fs/hfsplus/inode.cmodified+2−3View file
fs/hostfs/hostfs_kern.cmodified+12−11View file
fs/hpfs/file.cmodified+4−5View file
fs/hugetlbfs/inode.cmodified+2−2View file
fs/iomap/buffered-io.cmodified+1−1View file
fs/jffs2/file.cmodified+42−46View file
fs/jffs2/gc.cmodified+12−13View file
fs/jfs/inode.cmodified+4−4View file
fs/libfs.cmodified+6−7View file
fs/minix/dir.cmodified+66−68View file
fs/minix/inode.cmodified+4−4View file
fs/minix/minix.hmodified+20−20View file
fs/minix/namei.cmodified+16−16View file
fs/namei.cmodified+5−5View file
fs/nfs/file.cmodified+3−4View file
fs/nilfs2/dir.cmodified+2−2View file
fs/nilfs2/inode.cmodified+5−5View file
fs/nilfs2/recovery.cmodified+8−8View file
fs/ntfs3/file.cmodified+4−5View file
fs/ntfs3/inode.cmodified+5−46View file
fs/ntfs3/ntfs_fs.hmodified+2−3View file
fs/ocfs2/aops.cmodified+6−6View file
fs/ocfs2/aops.hmodified+1−1View file
fs/ocfs2/file.cmodified+9−8View file
fs/ocfs2/mmap.cmodified+3−3View file
fs/omfs/file.cmodified+2−2View file
fs/orangefs/inode.cmodified+18−21View file
fs/qnx6/dir.cmodified+44−44View file
fs/qnx6/inode.cmodified+12−13View file
fs/qnx6/namei.cmodified+1−3View file
fs/qnx6/qnx6.hmodified+1−8View file
fs/reiserfs/inode.cmodified+28−29View file
fs/squashfs/file.cmodified+58−28View file
fs/squashfs/file_direct.cmodified+10−9View file
fs/squashfs/page_actor.cmodified+8−3View file
fs/squashfs/page_actor.hmodified+4−2View file
fs/sysv/dir.cmodified+77−81View file
fs/sysv/itree.cmodified+4−4View file
fs/sysv/namei.cmodified+16−16View file
fs/sysv/sysv.hmodified+10−10View file
fs/ubifs/file.cmodified+6−7View file
fs/udf/file.cmodified+1−1View file
fs/udf/inode.cmodified+5−7View file
fs/ufs/dir.cmodified+106−125View file
fs/ufs/inode.cmodified+6−6View file
fs/ufs/namei.cmodified+17−22View file
fs/ufs/ufs.hmodified+11−9View file
fs/ufs/util.hmodified+3−3View file
fs/vboxsf/file.cmodified+12−12View file
include/linux/buffer_head.hmodified+7−7View file
include/linux/fs.hmodified+3−3View file
mm/filemap.cmodified+2−4View file
mm/shmem.cmodified+5−6View file

Only the first 600 diff lines are shown. Download the complete patch.

Documentation/filesystems/locking.rst

View file
diff --git a/Documentation/filesystems/locking.rst b/Documentation/filesystems/locking.rst
index e664061..f5e3676 100644
--- a/Documentation/filesystems/locking.rst
+++ b/Documentation/filesystems/locking.rst
@@ -251,10 +251,10 @@ prototypes::
void (*readahead)(struct readahead_control *);
int (*write_begin)(struct file *, struct address_space *mapping,
loff_t pos, unsigned len,
- struct page **pagep, void **fsdata);
+ struct folio **foliop, 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);
@@ -280,7 +280,7 @@ read_folio: yes, unlocks shared
writepages:
dirty_folio: maybe
readahead: yes, unlocks shared
-write_begin: locks the page exclusive
+write_begin: locks the folio exclusive
write_end: yes, unlocks exclusive
bmap:
invalidate_folio: yes exclusive

Documentation/filesystems/vfs.rst

View file
diff --git a/Documentation/filesystems/vfs.rst b/Documentation/filesystems/vfs.rst
index 6e903a9..4f67b5e 100644
--- a/Documentation/filesystems/vfs.rst
+++ b/Documentation/filesystems/vfs.rst
@@ -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);
@@ -926,12 +926,12 @@ cache in your filesystem. The following members are defined:
(if they haven't been read already) so that the updated blocks
can be written out properly.
- The filesystem must return the locked pagecache page for the
- specified offset, in ``*pagep``, for the caller to write into.
+ The filesystem must return the locked pagecache folio for the
+ specified offset, in ``*foliop``, for the caller to write into.
It must be able to cope with short writes (where the length
passed to write_begin is greater than the number of bytes copied
- into the page).
+ into the folio).
A void * may be returned in fsdata, which then gets passed into
write_end.
@@ -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.

block/fops.c

View file
diff --git a/block/fops.c b/block/fops.c
index 9825c17..dacbd61 100644
--- a/block/fops.c
+++ b/block/fops.c
@@ -451,20 +451,20 @@ static void blkdev_readahead(struct readahead_control *rac)
}
static int blkdev_write_begin(struct file *file, struct address_space *mapping,
- loff_t pos, unsigned len, struct page **pagep, void **fsdata)
+ loff_t pos, unsigned len, struct folio **foliop, void **fsdata)
{
- return block_write_begin(mapping, pos, len, pagep, blkdev_get_block);
+ return block_write_begin(mapping, pos, len, foliop, blkdev_get_block);
}
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)
{
int ret;
- ret = block_write_end(file, mapping, pos, len, copied, page, fsdata);
+ ret = block_write_end(file, mapping, pos, len, copied, folio, fsdata);
- unlock_page(page);
- put_page(page);
+ folio_unlock(folio);
+ folio_put(folio);
return ret;
}

drivers/gpu/drm/i915/gem/i915_gem_shmem.c

View file
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
index c5e1c71..fe69f2c 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
@@ -424,7 +424,8 @@ shmem_pwrite(struct drm_i915_gem_object *obj,
struct address_space *mapping = obj->base.filp->f_mapping;
const struct address_space_operations *aops = mapping->a_ops;
char __user *user_data = u64_to_user_ptr(arg->data_ptr);
- u64 remain, offset;
+ u64 remain;
+ loff_t pos;
unsigned int pg;
/* Caller already validated user args */
@@ -457,12 +458,12 @@ shmem_pwrite(struct drm_i915_gem_object *obj,
*/
remain = arg->size;
- offset = arg->offset;
- pg = offset_in_page(offset);
+ pos = arg->offset;
+ pg = offset_in_page(pos);
do {
unsigned int len, unwritten;
- struct page *page;
+ struct folio *folio;
void *data, *vaddr;
int err;
char __maybe_unused c;
@@ -480,21 +481,19 @@ shmem_pwrite(struct drm_i915_gem_object *obj,
if (err)
return err;
- err = aops->write_begin(obj->base.filp, mapping, offset, len,
- &page, &data);
+ err = aops->write_begin(obj->base.filp, mapping, pos, len,
+ &folio, &data);
if (err < 0)
return err;
- vaddr = kmap_local_page(page);
+ vaddr = kmap_local_folio(folio, offset_in_folio(folio, pos));
pagefault_disable();
- unwritten = __copy_from_user_inatomic(vaddr + pg,
- user_data,
- len);
+ unwritten = __copy_from_user_inatomic(vaddr, user_data, len);
pagefault_enable();
kunmap_local(vaddr);
- err = aops->write_end(obj->base.filp, mapping, offset, len,
- len - unwritten, page, data);
+ err = aops->write_end(obj->base.filp, mapping, pos, len,
+ len - unwritten, folio, data);
if (err < 0)
return err;
@@ -504,7 +503,7 @@ shmem_pwrite(struct drm_i915_gem_object *obj,
remain -= len;
user_data += len;
- offset += len;
+ pos += len;
pg = 0;
} while (remain);
@@ -660,7 +659,7 @@ i915_gem_object_create_shmem_from_data(struct drm_i915_private *i915,
struct drm_i915_gem_object *obj;
struct file *file;
const struct address_space_operations *aops;
- resource_size_t offset;
+ loff_t pos;
int err;
GEM_WARN_ON(IS_DGFX(i915));
@@ -672,29 +671,27 @@ i915_gem_object_create_shmem_from_data(struct drm_i915_private *i915,
file = obj->base.filp;
aops = file->f_mapping->a_ops;
- offset = 0;
+ pos = 0;
do {
unsigned int len = min_t(typeof(size), size, PAGE_SIZE);
- struct page *page;
- void *pgdata, *vaddr;
+ struct folio *folio;
+ void *fsdata;
- err = aops->write_begin(file, file->f_mapping, offset, len,
- &page, &pgdata);
+ err = aops->write_begin(file, file->f_mapping, pos, len,
+ &folio, &fsdata);
if (err < 0)
goto fail;
- vaddr = kmap(page);
- memcpy(vaddr, data, len);
- kunmap(page);
+ memcpy_to_folio(folio, offset_in_folio(folio, pos), data, len);
- err = aops->write_end(file, file->f_mapping, offset, len, len,
- page, pgdata);
+ err = aops->write_end(file, file->f_mapping, pos, len, len,
+ folio, fsdata);
if (err < 0)
goto fail;
size -= len;
data += len;
- offset += len;
+ pos += len;
} while (size);
return obj;

fs/adfs/inode.c

View file
diff --git a/fs/adfs/inode.c b/fs/adfs/inode.c
index a183e21..2152718 100644
--- a/fs/adfs/inode.c
+++ b/fs/adfs/inode.c
@@ -55,12 +55,11 @@ static void adfs_write_failed(struct address_space *mapping, loff_t to)
static int adfs_write_begin(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len,
- struct page **pagep, void **fsdata)
+ struct folio **foliop, void **fsdata)
{
int ret;
- *pagep = NULL;
- ret = cont_write_begin(file, mapping, pos, len, pagep, fsdata,
+ ret = cont_write_begin(file, mapping, pos, len, foliop, fsdata,
adfs_get_block,
&ADFS_I(mapping->host)->mmu_private);
if (unlikely(ret))

fs/affs/file.c

View file
diff --git a/fs/affs/file.c b/fs/affs/file.c
index 04c018e..a5a861d 100644
--- a/fs/affs/file.c
+++ b/fs/affs/file.c
@@ -417,12 +417,11 @@ affs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
static int affs_write_begin(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len,
- struct page **pagep, void **fsdata)
+ struct folio **foliop, void **fsdata)
{
int ret;
- *pagep = NULL;
- ret = cont_write_begin(file, mapping, pos, len, pagep, fsdata,
+ ret = cont_write_begin(file, mapping, pos, len, foliop, fsdata,
affs_get_block,
&AFFS_I(mapping->host)->mmu_private);
if (unlikely(ret))
@@ -433,12 +432,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) {
@@ -648,7 +647,7 @@ static int affs_read_folio_ofs(struct file *file, struct folio *folio)
static int affs_write_begin_ofs(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len,
- struct page **pagep, void **fsdata)
+ struct folio **foliop, void **fsdata)
{
struct inode *inode = mapping->host;
struct folio *folio;
@@ -671,7 +670,7 @@ static int affs_write_begin_ofs(struct file *file, struct address_space *mapping
mapping_gfp_mask(mapping));
if (IS_ERR(folio))
return PTR_ERR(folio);
- *pagep = &folio->page;
+ *foliop = folio;
if (folio_test_uptodate(folio))
return 0;
@@ -687,9 +686,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;
@@ -882,14 +880,14 @@ affs_truncate(struct inode *inode)
if (inode->i_size > AFFS_I(inode)->mmu_private) {
struct address_space *mapping = inode->i_mapping;
- struct page *page;
+ struct folio *folio;
void *fsdata = NULL;
loff_t isize = inode->i_size;
int res;
- res = mapping->a_ops->write_begin(NULL, mapping, isize, 0, &page, &fsdata);
+ res = mapping->a_ops->write_begin(NULL, mapping, isize, 0, &folio, &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, folio, fsdata);
else
inode->i_size = AFFS_I(inode)->mmu_private;
mark_inode_dirty(inode);

fs/bcachefs/fs-io-buffered.c

View file
diff --git a/fs/bcachefs/fs-io-buffered.c b/fs/bcachefs/fs-io-buffered.c
index ec8c427..ff60c04 100644
--- a/fs/bcachefs/fs-io-buffered.c
+++ b/fs/bcachefs/fs-io-buffered.c
@@ -659,7 +659,7 @@ int bch2_writepages(struct address_space *mapping, struct writeback_control *wbc
int bch2_write_begin(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len,
- struct page **pagep, void **fsdata)
+ struct folio **foliop, void **fsdata)
{
struct bch_inode_info *inode = to_bch_ei(mapping->host);
struct bch_fs *c = inode->v.i_sb->s_fs_info;
@@ -728,12 +728,11 @@ out:
goto err;
}
- *pagep = &folio->page;
+ *foliop = folio;
return 0;
err:
folio_unlock(folio);
folio_put(folio);
- *pagep = NULL;
err_unlock:
bch2_pagecache_add_put(inode);
kfree(res);
@@ -743,12 +742,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);

fs/bcachefs/fs-io-buffered.h

View file
diff --git a/fs/bcachefs/fs-io-buffered.h b/fs/bcachefs/fs-io-buffered.h
index a6126ff..3207ebb 100644
--- a/fs/bcachefs/fs-io-buffered.h
+++ b/fs/bcachefs/fs-io-buffered.h
@@ -10,10 +10,10 @@ int bch2_read_folio(struct file *, struct folio *);
int bch2_writepages(struct address_space *, struct writeback_control *);
void bch2_readahead(struct readahead_control *);
-int bch2_write_begin(struct file *, struct address_space *, loff_t,
- unsigned, struct page **, void **);
+int bch2_write_begin(struct file *, struct address_space *, loff_t pos,
+ unsigned len, struct folio **, 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 *);

fs/bfs/file.c

View file
diff --git a/fs/bfs/file.c b/fs/bfs/file.c
index a778411..fa66a09 100644
--- a/fs/bfs/file.c
+++ b/fs/bfs/file.c
@@ -172,11 +172,11 @@ static void bfs_write_failed(struct address_space *mapping, loff_t to)
static int bfs_write_begin(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len,
- struct page **pagep, void **fsdata)
+ struct folio **foliop, void **fsdata)
{
int ret;
- ret = block_write_begin(mapping, pos, len, pagep, bfs_get_block);
+ ret = block_write_begin(mapping, pos, len, foliop, bfs_get_block);
if (unlikely(ret))
bfs_write_failed(mapping, pos + len);

fs/buffer.c

View file
diff --git a/fs/buffer.c b/fs/buffer.c
index 74f4eb5..1fc9a50 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -2164,11 +2164,10 @@ int __block_write_begin_int(struct folio *folio, loff_t pos, unsigned len,
return err;
}
-int __block_write_begin(struct page *page, loff_t pos, unsigned len,
+int __block_write_begin(struct folio *folio, loff_t pos, unsigned len,
get_block_t *get_block)
{
- return __block_write_begin_int(page_folio(page), pos, len, get_block,
- NULL);
+ return __block_write_begin_int(folio, pos, len, get_block, NULL);
}
EXPORT_SYMBOL(__block_write_begin);
@@ -2218,33 +2217,33 @@ static void __block_commit_write(struct folio *folio, size_t from, size_t to)
* The filesystem needs to handle block truncation upon failure.
*/
int block_write_begin(struct address_space *mapping, loff_t pos, unsigned len,
- struct page **pagep, get_block_t *get_block)
+ struct folio **foliop, get_block_t *get_block)
{
pgoff_t index = pos >> PAGE_SHIFT;
- struct page *page;
+ struct folio *folio;
int status;
- page = grab_cache_page_write_begin(mapping, index);
- if (!page)
- return -ENOMEM;
+ folio = __filemap_get_folio(mapping, index, FGP_WRITEBEGIN,
+ mapping_gfp_mask(mapping));
+ if (IS_ERR(folio))
+ return PTR_ERR(folio);
- status = __block_write_begin(page, pos, len, get_block);
+ status = __block_write_begin_int(folio, pos, len, get_block, NULL);
if (unlikely(status)) {
- unlock_page(page);
- put_page(page);
- page = NULL;
+ folio_unlock(folio);
+ folio_put(folio);
+ folio = NULL;
}
- *pagep = page;
+ *foliop = folio;
return status;
}
EXPORT_SYMBOL(block_write_begin);
int block_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);
size_t start = pos - folio_pos(folio);
if (unlikely(copied < len)) {
@@ -2276,19 +2275,19 @@ 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 inode *inode = mapping->host;
loff_t old_size = inode->i_size;
bool i_size_changed = false;
- copied = block_write_end(file, mapping, pos, len, copied, page, fsdata);
+ copied = block_write_end(file, mapping, pos, len, copied, folio, fsdata);
/*
* No need to use i_size_read() here, the i_size cannot change under us
* because we hold i_rwsem.
*
- * But it's important to update i_size while still holding page lock:
+ * But it's important to update i_size while still holding folio lock:
* page writeout could otherwise come in and zero beyond i_size.
*/
if (pos + copied > inode->i_size) {
@@ -2296,8 +2295,8 @@ int generic_write_end(struct file *file, struct address_space *mapping,
i_size_changed = true;
}
- unlock_page(page);
- put_page(page);
+ folio_unlock(folio);
+ folio_put(folio);
if (old_size < pos)
pagecache_isize_extended(inode, old_size, pos);
@@ -2463,7 +2462,7 @@ int generic_cont_expand_simple(struct inode *inode, loff_t size)
{
struct address_space *mapping = inode->i_mapping;
const struct address_space_operations *aops = mapping->a_ops;
- struct page *page;
+ struct folio *folio;
void *fsdata = NULL;
int err;
@@ -2471,11 +2470,11 @@ int generic_cont_expand_simple(struct inode *inode, loff_t size)
if (err)
goto out;
- err = aops->write_begin(NULL, mapping, size, 0, &page, &fsdata);
+ err = aops->write_begin(NULL, mapping, size, 0, &folio, &fsdata);
if (err)
goto out;
- err = aops->write_end(NULL, mapping, size, 0, 0, page, fsdata);
+ err = aops->write_end(NULL, mapping, size, 0, 0, folio, fsdata);
BUG_ON(err > 0);
out:
@@ -2489,7 +2488,7 @@ static int cont_expand_zero(struct file *file, struct address_space *mapping,
struct inode *inode = mapping->host;
const struct address_space_operations *aops = mapping->a_ops;
unsigned int blocksize = i_blocksize(inode);
- struct page *page;
+ struct folio *folio;
void *fsdata = NULL;
pgoff_t index, curidx;
loff_t curpos;
@@ -2508,12 +2507,12 @@ static int cont_expand_zero(struct file *file, struct address_space *mapping,
len = PAGE_SIZE - zerofrom;
err = aops->write_begin(file, mapping, curpos, len,
- &page, &fsdata);
+ &folio, &fsdata);
if (err)
goto out;
- zero_user(page, zerofrom, len);
+ folio_zero_range(folio, offset_in_folio(folio, curpos), len);
err = aops->write_end(file, mapping, curpos, len, len,
- page, fsdata);
+ folio, fsdata);
if (err < 0)
goto out;
BUG_ON(err != len);
@@ -2541,12 +2540,12 @@ static int cont_expand_zero(struct file *file, struct address_space *mapping,
len = offset - zerofrom;
err = aops->write_begin(file, mapping, curpos, len,
- &page, &fsdata);
+ &folio, &fsdata);
if (err)
goto out;
- zero_user(page, zerofrom, len);
+ folio_zero_range(folio, offset_in_folio(folio, curpos), len);
err = aops->write_end(file, mapping, curpos, len, len,
- page, fsdata);
+ folio, fsdata);
if (err < 0)
goto out;
BUG_ON(err != len);
@@ -2562,7 +2561,7 @@ out:
*/
int cont_write_begin(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len,
- struct page **pagep, void **fsdata,
+ struct folio **foliop, void **fsdata,
get_block_t *get_block, loff_t *bytes)
{
struct inode *inode = mapping->host;
@@ -2580,7 +2579,7 @@ int cont_write_begin(struct file *file, struct address_space *mapping,
(*bytes)++;
}
- return block_write_begin(mapping, pos, len, pagep, get_block);
+ return block_write_begin(mapping, pos, len, foliop, get_block);
}
EXPORT_SYMBOL(cont_write_begin);

fs/ceph/addr.c

View file
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index c4744a0..a5f848c 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -1508,20 +1508,18 @@ static int ceph_netfs_check_write_begin(struct file *file, loff_t pos, unsigned
*/
static int ceph_write_begin(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len,
- struct page **pagep, void **fsdata)
+ struct folio **foliop, void **fsdata)
{
struct inode *inode = file_inode(file);
struct ceph_inode_info *ci = ceph_inode(inode);
- struct folio *folio = NULL;
int r;
- r = netfs_write_begin(&ci->netfs, file, inode->i_mapping, pos, len, &folio, NULL);
+ r = netfs_write_begin(&ci->netfs, file, inode->i_mapping, pos, len, foliop, NULL);
if (r < 0)
return r;
- folio_wait_private_2(folio); /* [DEPRECATED] */
- WARN_ON_ONCE(!folio_test_locked(folio));
- *pagep = &folio->page;
+ folio_wait_private_2(*foliop); /* [DEPRECATED] */
+ WARN_ON_ONCE(!folio_test_locked(*foliop));
return 0;
}
@@ -1531,9 +1529,8 @@ static int ceph_write_begin(struct file *file, struct address_space *mapping,
*/

This diff is incomplete. Download the complete patch.

fs/ecryptfs/mmap.c

View file

This diff is incomplete. Download the complete patch.

fs/exfat/file.c

View file

This diff is incomplete. Download the complete patch.

fs/exfat/inode.c

View file

This diff is incomplete. Download the complete patch.

fs/ext2/dir.c

View file

This diff is incomplete. Download the complete patch.

fs/ext2/inode.c

View file

This diff is incomplete. Download the complete patch.

fs/ext4/ext4.h

View file

This diff is incomplete. Download the complete patch.

fs/ext4/inline.c

View file

This diff is incomplete. Download the complete patch.

fs/ext4/inode.c

View file

This diff is incomplete. Download the complete patch.

fs/ext4/verity.c

View file

This diff is incomplete. Download the complete patch.

fs/f2fs/data.c

View file

This diff is incomplete. Download the complete patch.

fs/f2fs/super.c

View file

This diff is incomplete. Download the complete patch.

fs/f2fs/verity.c

View file

This diff is incomplete. Download the complete patch.

fs/fat/inode.c

View file

This diff is incomplete. Download the complete patch.

fs/fuse/file.c

View file

This diff is incomplete. Download the complete patch.

fs/hfs/extent.c

View file

This diff is incomplete. Download the complete patch.

fs/hfs/hfs_fs.h

View file

This diff is incomplete. Download the complete patch.

fs/hfs/inode.c

View file

This diff is incomplete. Download the complete patch.

fs/hfsplus/extents.c

View file

This diff is incomplete. Download the complete patch.

fs/hfsplus/hfsplus_fs.h

View file

This diff is incomplete. Download the complete patch.

fs/hfsplus/inode.c

View file

This diff is incomplete. Download the complete patch.

fs/hostfs/hostfs_kern.c

View file

This diff is incomplete. Download the complete patch.

fs/hpfs/file.c

View file

This diff is incomplete. Download the complete patch.

fs/hugetlbfs/inode.c

View file

This diff is incomplete. Download the complete patch.

fs/iomap/buffered-io.c

View file

This diff is incomplete. Download the complete patch.

fs/jffs2/file.c

View file

This diff is incomplete. Download the complete patch.

fs/jffs2/gc.c

View file

This diff is incomplete. Download the complete patch.

fs/jfs/inode.c

View file

This diff is incomplete. Download the complete patch.

fs/libfs.c

View file

This diff is incomplete. Download the complete patch.

fs/minix/dir.c

View file

This diff is incomplete. Download the complete patch.

fs/minix/inode.c

View file

This diff is incomplete. Download the complete patch.

fs/minix/minix.h

View file

This diff is incomplete. Download the complete patch.

fs/minix/namei.c

View file

This diff is incomplete. Download the complete patch.

fs/namei.c

View file

This diff is incomplete. Download the complete patch.

fs/nfs/file.c

View file

This diff is incomplete. Download the complete patch.

fs/nilfs2/dir.c

View file

This diff is incomplete. Download the complete patch.

fs/nilfs2/inode.c

View file

This diff is incomplete. Download the complete patch.

fs/nilfs2/recovery.c

View file

This diff is incomplete. Download the complete patch.

fs/ntfs3/file.c

View file

This diff is incomplete. Download the complete patch.

fs/ntfs3/inode.c

View file

This diff is incomplete. Download the complete patch.

fs/ntfs3/ntfs_fs.h

View file

This diff is incomplete. Download the complete patch.

fs/ocfs2/aops.c

View file

This diff is incomplete. Download the complete patch.

fs/ocfs2/aops.h

View file

This diff is incomplete. Download the complete patch.

fs/ocfs2/file.c

View file

This diff is incomplete. Download the complete patch.

fs/ocfs2/mmap.c

View file

This diff is incomplete. Download the complete patch.

fs/omfs/file.c

View file

This diff is incomplete. Download the complete patch.

fs/orangefs/inode.c

View file

This diff is incomplete. Download the complete patch.

fs/qnx6/dir.c

View file

This diff is incomplete. Download the complete patch.

fs/qnx6/inode.c

View file

This diff is incomplete. Download the complete patch.

fs/qnx6/namei.c

View file

This diff is incomplete. Download the complete patch.

fs/qnx6/qnx6.h

View file

This diff is incomplete. Download the complete patch.

fs/reiserfs/inode.c

View file

This diff is incomplete. Download the complete patch.

fs/squashfs/file.c

View file

This diff is incomplete. Download the complete patch.

fs/squashfs/file_direct.c

View file

This diff is incomplete. Download the complete patch.

fs/squashfs/page_actor.c

View file

This diff is incomplete. Download the complete patch.

fs/squashfs/page_actor.h

View file

This diff is incomplete. Download the complete patch.

fs/sysv/dir.c

View file

This diff is incomplete. Download the complete patch.

fs/sysv/itree.c

View file

This diff is incomplete. Download the complete patch.

fs/sysv/namei.c

View file

This diff is incomplete. Download the complete patch.

fs/sysv/sysv.h

View file

This diff is incomplete. Download the complete patch.

fs/ubifs/file.c

View file

This diff is incomplete. Download the complete patch.

fs/udf/file.c

View file

This diff is incomplete. Download the complete patch.

fs/udf/inode.c

View file

This diff is incomplete. Download the complete patch.

fs/ufs/dir.c

View file

This diff is incomplete. Download the complete patch.

fs/ufs/inode.c

View file

This diff is incomplete. Download the complete patch.

fs/ufs/namei.c

View file

This diff is incomplete. Download the complete patch.

fs/ufs/ufs.h

View file

This diff is incomplete. Download the complete patch.

fs/ufs/util.h

View file

This diff is incomplete. Download the complete patch.

fs/vboxsf/file.c

View file

This diff is incomplete. Download the complete patch.

include/linux/buffer_head.h

View file

This diff is incomplete. Download the complete patch.

include/linux/fs.h

View file

This diff is incomplete. Download the complete patch.

mm/filemap.c

View file

This diff is incomplete. Download the complete patch.

mm/shmem.c

View file

This diff is incomplete. Download the complete patch.