]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - Documentation/filesystems/vfs.txt
[ARM] 4760/1: [AT91] SPI CS0 errata on AT91RM9200
[linux-2.6-omap-h63xx.git] / Documentation / filesystems / vfs.txt
index 045f3e055a28932c76864a19696732311a4f9838..9d019d35728f28bcb9ecfeaf5bd3a4227f026586 100644 (file)
@@ -537,6 +537,12 @@ struct address_space_operations {
                        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);
@@ -615,11 +621,7 @@ struct address_space_operations {
        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.  If prepare_write wants to unlock the
-       page it, like readpage, may do so and return
-       AOP_TRUNCATED_PAGE.
-       In this case the prepare_write will be retried one the lock is
-       regained.
+       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
@@ -633,6 +635,45 @@ struct address_space_operations {
         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).
+
+       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,
+       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 filesystem must return the locked pagecache page for the specified
+       offset, in *pagep, for the caller to write into.
+
+       flags is a field for AOP_FLAG_xxx flags, described in
+       include/linux/fs.h.
+
+        A void * may be returned in fsdata, which then gets passed into
+        write_end.
+
+        Returns 0 on success; < 0 on failure (which is the error code), in
+       which case write_end is not called.
+
+  write_end: After a successful write_begin, and data copy, write_end must
+        be called. len is the original len passed to write_begin, and copied
+        is the amount that was able to be copied (copied == len is always true
+       if write_begin was called with the AOP_FLAG_UNINTERRUPTIBLE flag).
+
+        The filesystem must take care of unlocking the page and releasing it
+        refcount, and updating i_size.
+
+        Returns < 0 on failure, otherwise the number of bytes (<= 'copied')
+        that were able to be copied into pagecache.
+
   bmap: called by the VFS to map a logical block offset within object to
        physical block number. This method is used by the FIBMAP
        ioctl and for working with swap-files.  To be able to swap to
@@ -665,7 +706,7 @@ struct address_space_operations {
         wants to make it a free page.  If ->releasepage succeeds, the
         page will be removed from the address_space and become free.
 
-       The second case if when a request has been made to invalidate
+       The second case is when a request has been made to invalidate
         some or all pages in an address_space.  This can happen
         through the fadvice(POSIX_FADV_DONTNEED) system call or by the
         filesystem explicitly requesting it as nfs and 9fs do (when