Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4e02ed4b authored by Nick Piggin's avatar Nick Piggin Committed by Linus Torvalds
Browse files

fs: remove prepare_write/commit_write



Nothing uses prepare_write or commit_write. Remove them from the tree
completely.

[akpm@linux-foundation.org: schedule simple_prepare_write() for unexporting]
Signed-off-by: default avatarNick Piggin <npiggin@suse.de>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 9b913735
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -161,8 +161,12 @@ prototypes:
	int (*set_page_dirty)(struct page *page);
	int (*readpages)(struct file *filp, struct address_space *mapping,
			struct list_head *pages, unsigned nr_pages);
	int (*prepare_write)(struct file *, struct page *, unsigned, unsigned);
	int (*commit_write)(struct file *, struct page *, unsigned, unsigned);
	int (*write_begin)(struct file *, struct address_space *mapping,
				loff_t pos, unsigned len, unsigned flags,
				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);
	sector_t (*bmap)(struct address_space *, sector_t);
	int (*invalidatepage) (struct page *, unsigned long);
	int (*releasepage) (struct page *, int);
@@ -180,8 +184,6 @@ sync_page: no maybe
writepages:		no
set_page_dirty		no	no
readpages:		no
prepare_write:		no	yes			yes
commit_write:		no	yes			yes
write_begin:		no	locks the page		yes
write_end:		no	yes, unlocks		yes
perform_write:		no	n/a			yes
@@ -191,7 +193,7 @@ releasepage: no yes
direct_IO:		no
launder_page:		no	yes

	->prepare_write(), ->commit_write(), ->sync_page() and ->readpage()
	->write_begin(), ->write_end(), ->sync_page() and ->readpage()
may be called from the request handler (/dev/loop).

	->readpage() unlocks the page, either synchronously or via I/O
+5 −34
Original line number Diff line number Diff line
@@ -492,7 +492,7 @@ written-back to storage typically in whole pages, however the
address_space has finer control of write sizes.

The read process essentially only requires 'readpage'.  The write
process is more complicated and uses prepare_write/commit_write or
process is more complicated and uses write_begin/write_end or
set_page_dirty to write data into the address_space, and writepage,
sync_page, and writepages to writeback data to storage.

@@ -521,8 +521,6 @@ struct address_space_operations {
	int (*set_page_dirty)(struct page *page);
	int (*readpages)(struct file *filp, struct address_space *mapping,
			struct list_head *pages, unsigned nr_pages);
	int (*prepare_write)(struct file *, struct page *, unsigned, unsigned);
	int (*commit_write)(struct file *, struct page *, unsigned, unsigned);
	int (*write_begin)(struct file *, struct address_space *mapping,
				loff_t pos, unsigned len, unsigned flags,
				struct page **pagep, void **fsdata);
@@ -598,37 +596,7 @@ struct address_space_operations {
	readpages is only used for read-ahead, so read errors are
  	ignored.  If anything goes wrong, feel free to give up.

  prepare_write: called by the generic write path in VM to set up a write
  	request for a page.  This indicates to the address space that
  	the given range of bytes is about to be written.  The
  	address_space should check that the write will be able to
  	complete, by allocating space if necessary and doing any other
  	internal housekeeping.  If the write will update parts of
  	any basic-blocks on storage, then those blocks should be
  	pre-read (if they haven't been read already) so that the
  	updated blocks can be written out properly.
	The page will be locked.

	Note: the page _must not_ be marked uptodate in this function
	(or anywhere else) unless it actually is uptodate right now. As
	soon as a page is marked uptodate, it is possible for a concurrent
	read(2) to copy it to userspace.

  commit_write: If prepare_write succeeds, new data will be copied
        into the page and then commit_write will be called.  It will
        typically update the size of the file (if appropriate) and
        mark the inode as dirty, and do any other related housekeeping
        operations.  It should avoid returning an error if possible -
        errors should have been handled by prepare_write.

  write_begin: This is intended as a replacement for prepare_write. The
	key differences being that:
		- it returns a locked page (in *pagep) rather than being
		  given a pre locked page;
		- 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).

  write_begin:
	Called by the generic buffered write code to ask the filesystem to
	prepare to write len bytes at the given offset in the file. The
	address_space should check that the write will be able to complete,
@@ -640,6 +608,9 @@ struct address_space_operations {
        The filesystem must return the locked pagecache page for the specified
	offset, in *pagep, 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).

	flags is a field for AOP_FLAG_xxx flags, described in
	include/linux/fs.h.

+2 −3
Original line number Diff line number Diff line
@@ -40,8 +40,7 @@
 * Heinz Mauelshagen <mge@sistina.com>, Feb 2002
 *
 * Support for falling back on the write file operation when the address space
 * operations prepare_write and/or commit_write are not available on the
 * backing filesystem.
 * operations write_begin is not available on the backing filesystem.
 * Anton Altaparmakov, 16 Feb 2005
 *
 * Still To Fix:
@@ -765,7 +764,7 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
		 */
		if (!file->f_op->splice_read)
			goto out_putf;
		if (aops->prepare_write || aops->write_begin)
		if (aops->write_begin)
			lo_flags |= LO_FLAGS_USE_AOPS;
		if (!(lo_flags & LO_FLAGS_USE_AOPS) && !file->f_op->write)
			lo_flags |= LO_FLAGS_READ_ONLY;
+1 −1
Original line number Diff line number Diff line
@@ -175,7 +175,7 @@ static ssize_t fat_direct_IO(int rw, struct kiocb *iocb,

	if (rw == WRITE) {
		/*
		 * FIXME: blockdev_direct_IO() doesn't use ->prepare_write(),
		 * FIXME: blockdev_direct_IO() doesn't use ->write_begin(),
		 * so we need to update the ->mmu_private to block boundary.
		 *
		 * But we must fill the remaining area or hole by nul for
+1 −1
Original line number Diff line number Diff line
@@ -814,7 +814,7 @@ EXPORT_SYMBOL(simple_getattr);
EXPORT_SYMBOL(simple_link);
EXPORT_SYMBOL(simple_lookup);
EXPORT_SYMBOL(simple_pin_fs);
EXPORT_SYMBOL(simple_prepare_write);
EXPORT_UNUSED_SYMBOL(simple_prepare_write);
EXPORT_SYMBOL(simple_readpage);
EXPORT_SYMBOL(simple_release_fs);
EXPORT_SYMBOL(simple_rename);
Loading