diff options
Diffstat (limited to 'Documentation/filesystems')
-rw-r--r-- | Documentation/filesystems/Locking | 12 | ||||
-rw-r--r-- | Documentation/filesystems/vfs.txt | 39 |
2 files changed, 12 insertions, 39 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking index 8362860e21a7..23d2f4460deb 100644 --- a/Documentation/filesystems/Locking +++ b/Documentation/filesystems/Locking | |||
@@ -161,8 +161,12 @@ prototypes: | |||
161 | int (*set_page_dirty)(struct page *page); | 161 | int (*set_page_dirty)(struct page *page); |
162 | int (*readpages)(struct file *filp, struct address_space *mapping, | 162 | int (*readpages)(struct file *filp, struct address_space *mapping, |
163 | struct list_head *pages, unsigned nr_pages); | 163 | struct list_head *pages, unsigned nr_pages); |
164 | int (*prepare_write)(struct file *, struct page *, unsigned, unsigned); | 164 | int (*write_begin)(struct file *, struct address_space *mapping, |
165 | int (*commit_write)(struct file *, struct page *, unsigned, unsigned); | 165 | loff_t pos, unsigned len, unsigned flags, |
166 | struct page **pagep, void **fsdata); | ||
167 | int (*write_end)(struct file *, struct address_space *mapping, | ||
168 | loff_t pos, unsigned len, unsigned copied, | ||
169 | struct page *page, void *fsdata); | ||
166 | sector_t (*bmap)(struct address_space *, sector_t); | 170 | sector_t (*bmap)(struct address_space *, sector_t); |
167 | int (*invalidatepage) (struct page *, unsigned long); | 171 | int (*invalidatepage) (struct page *, unsigned long); |
168 | int (*releasepage) (struct page *, int); | 172 | int (*releasepage) (struct page *, int); |
@@ -180,8 +184,6 @@ sync_page: no maybe | |||
180 | writepages: no | 184 | writepages: no |
181 | set_page_dirty no no | 185 | set_page_dirty no no |
182 | readpages: no | 186 | readpages: no |
183 | prepare_write: no yes yes | ||
184 | commit_write: no yes yes | ||
185 | write_begin: no locks the page yes | 187 | write_begin: no locks the page yes |
186 | write_end: no yes, unlocks yes | 188 | write_end: no yes, unlocks yes |
187 | perform_write: no n/a yes | 189 | perform_write: no n/a yes |
@@ -191,7 +193,7 @@ releasepage: no yes | |||
191 | direct_IO: no | 193 | direct_IO: no |
192 | launder_page: no yes | 194 | launder_page: no yes |
193 | 195 | ||
194 | ->prepare_write(), ->commit_write(), ->sync_page() and ->readpage() | 196 | ->write_begin(), ->write_end(), ->sync_page() and ->readpage() |
195 | may be called from the request handler (/dev/loop). | 197 | may be called from the request handler (/dev/loop). |
196 | 198 | ||
197 | ->readpage() unlocks the page, either synchronously or via I/O | 199 | ->readpage() unlocks the page, either synchronously or via I/O |
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt index c4d348dabe94..5579bda58a6d 100644 --- a/Documentation/filesystems/vfs.txt +++ b/Documentation/filesystems/vfs.txt | |||
@@ -492,7 +492,7 @@ written-back to storage typically in whole pages, however the | |||
492 | address_space has finer control of write sizes. | 492 | address_space has finer control of write sizes. |
493 | 493 | ||
494 | The read process essentially only requires 'readpage'. The write | 494 | The 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 |
496 | set_page_dirty to write data into the address_space, and writepage, | 496 | set_page_dirty to write data into the address_space, and writepage, |
497 | sync_page, and writepages to writeback data to storage. | 497 | sync_page, and writepages to writeback data to storage. |
498 | 498 | ||
@@ -521,8 +521,6 @@ struct address_space_operations { | |||
521 | int (*set_page_dirty)(struct page *page); | 521 | int (*set_page_dirty)(struct page *page); |
522 | int (*readpages)(struct file *filp, struct address_space *mapping, | 522 | int (*readpages)(struct file *filp, struct address_space *mapping, |
523 | struct list_head *pages, unsigned nr_pages); | 523 | 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); | ||
526 | int (*write_begin)(struct file *, struct address_space *mapping, | 524 | int (*write_begin)(struct file *, struct address_space *mapping, |
527 | loff_t pos, unsigned len, unsigned flags, | 525 | loff_t pos, unsigned len, unsigned flags, |
528 | struct page **pagep, void **fsdata); | 526 | struct page **pagep, void **fsdata); |
@@ -598,37 +596,7 @@ struct address_space_operations { | |||
598 | readpages is only used for read-ahead, so read errors are | 596 | readpages is only used for read-ahead, so read errors are |
599 | ignored. If anything goes wrong, feel free to give up. | 597 | ignored. If anything goes wrong, feel free to give up. |
600 | 598 | ||
601 | prepare_write: called by the generic write path in VM to set up a write | 599 | write_begin: |
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 | |||
632 | Called by the generic buffered write code to ask the filesystem to | 600 | Called by the generic buffered write code to ask the filesystem to |
633 | prepare to write len bytes at the given offset in the file. The | 601 | prepare to write len bytes at the given offset in the file. The |
634 | address_space should check that the write will be able to complete, | 602 | address_space should check that the write will be able to complete, |
@@ -640,6 +608,9 @@ struct address_space_operations { | |||
640 | The filesystem must return the locked pagecache page for the specified | 608 | The filesystem must return the locked pagecache page for the specified |
641 | offset, in *pagep, for the caller to write into. | 609 | offset, in *pagep, for the caller to write into. |
642 | 610 | ||
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 | |||
643 | flags is a field for AOP_FLAG_xxx flags, described in | 614 | flags is a field for AOP_FLAG_xxx flags, described in |
644 | include/linux/fs.h. | 615 | include/linux/fs.h. |
645 | 616 | ||