aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/filesystems/vfs.txt50
1 files changed, 25 insertions, 25 deletions
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index 0fcbd74efd2f..adaa899e5c90 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -458,7 +458,7 @@ address-space can provide. These include communicating memory
458pressure, page lookup by address, and keeping track of pages tagged as 458pressure, page lookup by address, and keeping track of pages tagged as
459Dirty or Writeback. 459Dirty or Writeback.
460 460
461The first can be used independantly to the others. The vm can try to 461The first can be used independently to the others. The VM can try to
462either write dirty pages in order to clean them, or release clean 462either write dirty pages in order to clean them, or release clean
463pages in order to reuse them. To do this it can call the ->writepage 463pages in order to reuse them. To do this it can call the ->writepage
464method on dirty pages, and ->releasepage on clean pages with 464method on dirty pages, and ->releasepage on clean pages with
@@ -466,7 +466,7 @@ PagePrivate set. Clean pages without PagePrivate and with no external
466references will be released without notice being given to the 466references will be released without notice being given to the
467address_space. 467address_space.
468 468
469To achieve this functionality, pages need to be placed on an lru with 469To achieve this functionality, pages need to be placed on an LRU with
470lru_cache_add and mark_page_active needs to be called whenever the 470lru_cache_add and mark_page_active needs to be called whenever the
471page is used. 471page is used.
472 472
@@ -478,20 +478,20 @@ quickly.
478The Dirty tag is primarily used by mpage_writepages - the default 478The Dirty tag is primarily used by mpage_writepages - the default
479->writepages method. It uses the tag to find dirty pages to call 479->writepages method. It uses the tag to find dirty pages to call
480->writepage on. If mpage_writepages is not used (i.e. the address 480->writepage on. If mpage_writepages is not used (i.e. the address
481provides it's own ->writepages) , the PAGECACHE_TAG_DIRTY tag is 481provides its own ->writepages) , the PAGECACHE_TAG_DIRTY tag is
482almost unused. write_inode_now and sync_inode do use it (through 482almost unused. write_inode_now and sync_inode do use it (through
483__sync_single_inode) to check if ->writepages has been successful in 483__sync_single_inode) to check if ->writepages has been successful in
484writing out the whole address_space. 484writing out the whole address_space.
485 485
486The Writeback tag is used by filemap*wait* and sync_page* functions, 486The Writeback tag is used by filemap*wait* and sync_page* functions,
487though wait_on_page_writeback_range, to wait for all writeback to 487via wait_on_page_writeback_range, to wait for all writeback to
488complete. While waiting ->sync_page (if defined) will be called on 488complete. While waiting ->sync_page (if defined) will be called on
489each page that is found to require writeback 489each page that is found to require writeback.
490 490
491An address_space handler may attach extra information to a page, 491An address_space handler may attach extra information to a page,
492typically using the 'private' field in the 'struct page'. If such 492typically using the 'private' field in the 'struct page'. If such
493information is attached, the PG_Private flag should be set. This will 493information is attached, the PG_Private flag should be set. This will
494cause various mm routines to make extra calls into the address_space 494cause various VM routines to make extra calls into the address_space
495handler to deal with that data. 495handler to deal with that data.
496 496
497An address space acts as an intermediate between storage and 497An address space acts as an intermediate between storage and
@@ -500,7 +500,7 @@ time, and provided to the application either by copying of the page,
500or by memory-mapping the page. 500or by memory-mapping the page.
501Data is written into the address space by the application, and then 501Data is written into the address space by the application, and then
502written-back to storage typically in whole pages, however the 502written-back to storage typically in whole pages, however the
503address_space has finner control of write sizes. 503address_space has finer control of write sizes.
504 504
505The read process essentially only requires 'readpage'. The write 505The read process essentially only requires 'readpage'. The write
506process is more complicated and uses prepare_write/commit_write or 506process is more complicated and uses prepare_write/commit_write or
@@ -546,7 +546,7 @@ struct address_space_operations {
546}; 546};
547 547
548 writepage: called by the VM to write a dirty page to backing store. 548 writepage: called by the VM to write a dirty page to backing store.
549 This may happen for data integrity reason (i.e. 'sync'), or 549 This may happen for data integrity reasons (i.e. 'sync'), or
550 to free up memory (flush). The difference can be seen in 550 to free up memory (flush). The difference can be seen in
551 wbc->sync_mode. 551 wbc->sync_mode.
552 The PG_Dirty flag has been cleared and PageLocked is true. 552 The PG_Dirty flag has been cleared and PageLocked is true.
@@ -555,10 +555,10 @@ struct address_space_operations {
555 or asynchronously when the write operation completes. 555 or asynchronously when the write operation completes.
556 556
557 If wbc->sync_mode is WB_SYNC_NONE, ->writepage doesn't have to 557 If wbc->sync_mode is WB_SYNC_NONE, ->writepage doesn't have to
558 try too hard if there are problems, and may choose to write out a 558 try too hard if there are problems, and may choose to write out
559 different page from the mapping if that would be more 559 other pages from the mapping if that is easier (e.g. due to
560 appropriate. If it chooses not to start writeout, it should 560 internal dependencies). If it chooses not to start writeout, it
561 return AOP_WRITEPAGE_ACTIVATE so that the VM will not keep 561 should return AOP_WRITEPAGE_ACTIVATE so that the VM will not keep
562 calling ->writepage on that page. 562 calling ->writepage on that page.
563 563
564 See the file "Locking" for more details. 564 See the file "Locking" for more details.
@@ -568,7 +568,7 @@ struct address_space_operations {
568 unlocked and marked uptodate once the read completes. 568 unlocked and marked uptodate once the read completes.
569 If ->readpage discovers that it needs to unlock the page for 569 If ->readpage discovers that it needs to unlock the page for
570 some reason, it can do so, and then return AOP_TRUNCATED_PAGE. 570 some reason, it can do so, and then return AOP_TRUNCATED_PAGE.
571 In this case, the page will be re-located, re-locked and if 571 In this case, the page will be relocated, relocked and if
572 that all succeeds, ->readpage will be called again. 572 that all succeeds, ->readpage will be called again.
573 573
574 sync_page: called by the VM to notify the backing store to perform all 574 sync_page: called by the VM to notify the backing store to perform all
@@ -579,12 +579,12 @@ struct address_space_operations {
579 PG_Writeback set while waiting for the writeback to complete. 579 PG_Writeback set while waiting for the writeback to complete.
580 580
581 writepages: called by the VM to write out pages associated with the 581 writepages: called by the VM to write out pages associated with the
582 address_space object. If WBC_SYNC_ALL, then the 582 address_space object. If wbc->sync_mode is WBC_SYNC_ALL, then
583 writeback_control will specify a range of pages that must be 583 the writeback_control will specify a range of pages that must be
584 written out. If WBC_SYNC_NONE, then a nr_to_write is given 584 written out. If it is WBC_SYNC_NONE, then a nr_to_write is given
585 and that many pages should be written if possible. 585 and that many pages should be written if possible.
586 If no ->writepages is given, then mpage_writepages is used 586 If no ->writepages is given, then mpage_writepages is used
587 instead. This will choose pages from the addresspace that are 587 instead. This will choose pages from the address space that are
588 tagged as DIRTY and will pass them to ->writepage. 588 tagged as DIRTY and will pass them to ->writepage.
589 589
590 set_page_dirty: called by the VM to set a page dirty. 590 set_page_dirty: called by the VM to set a page dirty.
@@ -599,15 +599,15 @@ struct address_space_operations {
599 object. This is essentially just a vector version of 599 object. This is essentially just a vector version of
600 readpage. Instead of just one page, several pages are 600 readpage. Instead of just one page, several pages are
601 requested. 601 requested.
602 readpages is only used for readahead, so read errors are 602 readpages is only used for read-ahead, so read errors are
603 ignored. If anything goes wrong, feel free to give up. 603 ignored. If anything goes wrong, feel free to give up.
604 604
605 prepare_write: called by the generic write path in VM to set up a write 605 prepare_write: called by the generic write path in VM to set up a write
606 request for a page. This indicates to the address space that 606 request for a page. This indicates to the address space that
607 the given range of bytes are about to be written. The 607 the given range of bytes is about to be written. The
608 address_space should check that the write will be able to 608 address_space should check that the write will be able to
609 complete, by allocating space if necessary and doing any other 609 complete, by allocating space if necessary and doing any other
610 internal house keeping. If the write will update parts of 610 internal housekeeping. If the write will update parts of
611 any basic-blocks on storage, then those blocks should be 611 any basic-blocks on storage, then those blocks should be
612 pre-read (if they haven't been read already) so that the 612 pre-read (if they haven't been read already) so that the
613 updated blocks can be written out properly. 613 updated blocks can be written out properly.
@@ -625,9 +625,9 @@ struct address_space_operations {
625 errors should have been handled by prepare_write. 625 errors should have been handled by prepare_write.
626 626
627 bmap: called by the VFS to map a logical block offset within object to 627 bmap: called by the VFS to map a logical block offset within object to
628 physical block number. This method is used by for the FIBMAP 628 physical block number. This method is used by the FIBMAP
629 ioctl and for working with swap-files. To be able to swap to 629 ioctl and for working with swap-files. To be able to swap to
630 a file, the file must have as stable mapping to a block 630 a file, the file must have a stable mapping to a block
631 device. The swap system does not go through the filesystem 631 device. The swap system does not go through the filesystem
632 but instead uses bmap to find out where the blocks in the file 632 but instead uses bmap to find out where the blocks in the file
633 are and uses those addresses directly. 633 are and uses those addresses directly.
@@ -635,7 +635,7 @@ struct address_space_operations {
635 635
636 invalidatepage: If a page has PagePrivate set, then invalidatepage 636 invalidatepage: If a page has PagePrivate set, then invalidatepage
637 will be called when part or all of the page is to be removed 637 will be called when part or all of the page is to be removed
638 from the address space. This generally corresponds either a 638 from the address space. This generally corresponds to either a
639 truncation or a complete invalidation of the address space 639 truncation or a complete invalidation of the address space
640 (in the latter case 'offset' will always be 0). 640 (in the latter case 'offset' will always be 0).
641 Any private data associated with the page should be updated 641 Any private data associated with the page should be updated
@@ -663,13 +663,13 @@ struct address_space_operations {
663 they believe the cache may be out of date with storage) by 663 they believe the cache may be out of date with storage) by
664 calling invalidate_inode_pages2(). 664 calling invalidate_inode_pages2().
665 If the filesystem makes such a call, and needs to be certain 665 If the filesystem makes such a call, and needs to be certain
666 that all pages are invalidated, then it's releasepage will 666 that all pages are invalidated, then its releasepage will
667 need to ensure this. Possibly it can clear the PageUptodate 667 need to ensure this. Possibly it can clear the PageUptodate
668 bit if it cannot free private data yet. 668 bit if it cannot free private data yet.
669 669
670 direct_IO: called by the generic read/write routines to perform 670 direct_IO: called by the generic read/write routines to perform
671 direct_IO - that is IO requests which bypass the page cache 671 direct_IO - that is IO requests which bypass the page cache
672 and tranfer data directly between the storage and the 672 and transfer data directly between the storage and the
673 application's address space. 673 application's address space.
674 674
675 get_xip_page: called by the VM to translate a block number to a page. 675 get_xip_page: called by the VM to translate a block number to a page.