@@ -492,7 +492,7 @@ written-back to storage typically in whole pages, however the
492492address_space has finer control of write sizes.
493493
494494The read process essentially only requires 'readpage'. The write
495- process is more complicated and uses prepare_write/commit_write or
495+ process is more complicated and uses write_begin/write_end or
496496set_page_dirty to write data into the address_space, and writepage,
497497sync_page, and writepages to writeback data to storage.
498498
@@ -521,8 +521,6 @@ struct address_space_operations {
521521 int (*set_page_dirty)(struct page *page);
522522 int (*readpages)(struct file *filp, struct address_space *mapping,
523523 struct list_head *pages, unsigned nr_pages);
524- int (*prepare_write)(struct file *, struct page *, unsigned, unsigned);
525- int (*commit_write)(struct file *, struct page *, unsigned, unsigned);
526524 int (*write_begin)(struct file *, struct address_space *mapping,
527525 loff_t pos, unsigned len, unsigned flags,
528526 struct page **pagep, void **fsdata);
@@ -598,37 +596,7 @@ struct address_space_operations {
598596 readpages is only used for read-ahead, so read errors are
599597 ignored. If anything goes wrong, feel free to give up.
600598
601- prepare_write: called by the generic write path in VM to set up a write
602- request for a page. This indicates to the address space that
603- the given range of bytes is about to be written. The
604- address_space should check that the write will be able to
605- complete, by allocating space if necessary and doing any other
606- internal housekeeping. If the write will update parts of
607- any basic-blocks on storage, then those blocks should be
608- pre-read (if they haven't been read already) so that the
609- updated blocks can be written out properly.
610- The page will be locked.
611-
612- Note: the page _must not_ be marked uptodate in this function
613- (or anywhere else) unless it actually is uptodate right now. As
614- soon as a page is marked uptodate, it is possible for a concurrent
615- read(2) to copy it to userspace.
616-
617- commit_write: If prepare_write succeeds, new data will be copied
618- into the page and then commit_write will be called. It will
619- typically update the size of the file (if appropriate) and
620- mark the inode as dirty, and do any other related housekeeping
621- operations. It should avoid returning an error if possible -
622- errors should have been handled by prepare_write.
623-
624- write_begin: This is intended as a replacement for prepare_write. The
625- key differences being that:
626- - it returns a locked page (in *pagep) rather than being
627- given a pre locked page;
628- - it must be able to cope with short writes (where the
629- length passed to write_begin is greater than the number
630- of bytes copied into the page).
631-
599+ write_begin:
632600 Called by the generic buffered write code to ask the filesystem to
633601 prepare to write len bytes at the given offset in the file. The
634602 address_space should check that the write will be able to complete,
@@ -640,6 +608,9 @@ struct address_space_operations {
640608 The filesystem must return the locked pagecache page for the specified
641609 offset, in *pagep, for the caller to write into.
642610
611+ It must be able to cope with short writes (where the length passed to
612+ write_begin is greater than the number of bytes copied into the page).
613+
643614 flags is a field for AOP_FLAG_xxx flags, described in
644615 include/linux/fs.h.
645616
0 commit comments