Unverified Commit a225800f authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Christian Brauner
Browse files

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: default avatarJosef Bacik <josef@toxicpanda.com>
Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 3e5d37c5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);
+3 −3
Original line number Diff line number Diff line
@@ -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.
+1 −2
Original line number Diff line number Diff line
@@ -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);

+2 −2
Original line number Diff line number Diff line
@@ -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;

+4 −5
Original line number Diff line number Diff line
@@ -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);
Loading