Commit a9e102b6 authored by NeilBrown's avatar NeilBrown Committed by Linus Torvalds

[PATCH] More corrections to vfs.txt update

Thanks "Randy.Dunlap" <rdunlap@xenotime.net>

Cc: "Randy.Dunlap" <rdunlap@xenotime.net>
Signed-off-by: default avatarNeil Brown <neilb@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 5ddcfa87
...@@ -458,7 +458,7 @@ address-space can provide. These include communicating memory ...@@ -458,7 +458,7 @@ address-space can provide. These include communicating memory
pressure, page lookup by address, and keeping track of pages tagged as pressure, page lookup by address, and keeping track of pages tagged as
Dirty or Writeback. Dirty or Writeback.
The first can be used independantly to the others. The vm can try to The first can be used independently to the others. The VM can try to
either write dirty pages in order to clean them, or release clean either write dirty pages in order to clean them, or release clean
pages in order to reuse them. To do this it can call the ->writepage pages in order to reuse them. To do this it can call the ->writepage
method on dirty pages, and ->releasepage on clean pages with method on dirty pages, and ->releasepage on clean pages with
...@@ -466,7 +466,7 @@ PagePrivate set. Clean pages without PagePrivate and with no external ...@@ -466,7 +466,7 @@ PagePrivate set. Clean pages without PagePrivate and with no external
references will be released without notice being given to the references will be released without notice being given to the
address_space. address_space.
To achieve this functionality, pages need to be placed on an lru with To achieve this functionality, pages need to be placed on an LRU with
lru_cache_add and mark_page_active needs to be called whenever the lru_cache_add and mark_page_active needs to be called whenever the
page is used. page is used.
...@@ -478,20 +478,20 @@ quickly. ...@@ -478,20 +478,20 @@ quickly.
The Dirty tag is primarily used by mpage_writepages - the default The Dirty tag is primarily used by mpage_writepages - the default
->writepages method. It uses the tag to find dirty pages to call ->writepages method. It uses the tag to find dirty pages to call
->writepage on. If mpage_writepages is not used (i.e. the address ->writepage on. If mpage_writepages is not used (i.e. the address
provides it's own ->writepages) , the PAGECACHE_TAG_DIRTY tag is provides its own ->writepages) , the PAGECACHE_TAG_DIRTY tag is
almost unused. write_inode_now and sync_inode do use it (through almost unused. write_inode_now and sync_inode do use it (through
__sync_single_inode) to check if ->writepages has been successful in __sync_single_inode) to check if ->writepages has been successful in
writing out the whole address_space. writing out the whole address_space.
The Writeback tag is used by filemap*wait* and sync_page* functions, The Writeback tag is used by filemap*wait* and sync_page* functions,
though wait_on_page_writeback_range, to wait for all writeback to via wait_on_page_writeback_range, to wait for all writeback to
complete. While waiting ->sync_page (if defined) will be called on complete. While waiting ->sync_page (if defined) will be called on
each page that is found to require writeback each page that is found to require writeback.
An address_space handler may attach extra information to a page, An address_space handler may attach extra information to a page,
typically using the 'private' field in the 'struct page'. If such typically using the 'private' field in the 'struct page'. If such
information is attached, the PG_Private flag should be set. This will information is attached, the PG_Private flag should be set. This will
cause various mm routines to make extra calls into the address_space cause various VM routines to make extra calls into the address_space
handler to deal with that data. handler to deal with that data.
An address space acts as an intermediate between storage and An 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, ...@@ -500,7 +500,7 @@ time, and provided to the application either by copying of the page,
or by memory-mapping the page. or by memory-mapping the page.
Data is written into the address space by the application, and then Data is written into the address space by the application, and then
written-back to storage typically in whole pages, however the written-back to storage typically in whole pages, however the
address_space has finner control of write sizes. address_space has finer control of write sizes.
The read process essentially only requires 'readpage'. The write 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 prepare_write/commit_write or
...@@ -546,7 +546,7 @@ struct address_space_operations { ...@@ -546,7 +546,7 @@ struct address_space_operations {
}; };
writepage: called by the VM to write a dirty page to backing store. writepage: called by the VM to write a dirty page to backing store.
This may happen for data integrity reason (i.e. 'sync'), or This may happen for data integrity reasons (i.e. 'sync'), or
to free up memory (flush). The difference can be seen in to free up memory (flush). The difference can be seen in
wbc->sync_mode. wbc->sync_mode.
The PG_Dirty flag has been cleared and PageLocked is true. The PG_Dirty flag has been cleared and PageLocked is true.
...@@ -555,10 +555,10 @@ struct address_space_operations { ...@@ -555,10 +555,10 @@ struct address_space_operations {
or asynchronously when the write operation completes. or asynchronously when the write operation completes.
If wbc->sync_mode is WB_SYNC_NONE, ->writepage doesn't have to If wbc->sync_mode is WB_SYNC_NONE, ->writepage doesn't have to
try too hard if there are problems, and may choose to write out a try too hard if there are problems, and may choose to write out
different page from the mapping if that would be more other pages from the mapping if that is easier (e.g. due to
appropriate. If it chooses not to start writeout, it should internal dependencies). If it chooses not to start writeout, it
return AOP_WRITEPAGE_ACTIVATE so that the VM will not keep should return AOP_WRITEPAGE_ACTIVATE so that the VM will not keep
calling ->writepage on that page. calling ->writepage on that page.
See the file "Locking" for more details. See the file "Locking" for more details.
...@@ -568,7 +568,7 @@ struct address_space_operations { ...@@ -568,7 +568,7 @@ struct address_space_operations {
unlocked and marked uptodate once the read completes. unlocked and marked uptodate once the read completes.
If ->readpage discovers that it needs to unlock the page for If ->readpage discovers that it needs to unlock the page for
some reason, it can do so, and then return AOP_TRUNCATED_PAGE. some reason, it can do so, and then return AOP_TRUNCATED_PAGE.
In this case, the page will be re-located, re-locked and if In this case, the page will be relocated, relocked and if
that all succeeds, ->readpage will be called again. that all succeeds, ->readpage will be called again.
sync_page: called by the VM to notify the backing store to perform all sync_page: called by the VM to notify the backing store to perform all
...@@ -579,12 +579,12 @@ struct address_space_operations { ...@@ -579,12 +579,12 @@ struct address_space_operations {
PG_Writeback set while waiting for the writeback to complete. PG_Writeback set while waiting for the writeback to complete.
writepages: called by the VM to write out pages associated with the writepages: called by the VM to write out pages associated with the
address_space object. If WBC_SYNC_ALL, then the address_space object. If wbc->sync_mode is WBC_SYNC_ALL, then
writeback_control will specify a range of pages that must be the writeback_control will specify a range of pages that must be
written out. If WBC_SYNC_NONE, then a nr_to_write is given written out. If it is WBC_SYNC_NONE, then a nr_to_write is given
and that many pages should be written if possible. and that many pages should be written if possible.
If no ->writepages is given, then mpage_writepages is used If no ->writepages is given, then mpage_writepages is used
instead. This will choose pages from the addresspace that are instead. This will choose pages from the address space that are
tagged as DIRTY and will pass them to ->writepage. tagged as DIRTY and will pass them to ->writepage.
set_page_dirty: called by the VM to set a page dirty. set_page_dirty: called by the VM to set a page dirty.
...@@ -599,15 +599,15 @@ struct address_space_operations { ...@@ -599,15 +599,15 @@ struct address_space_operations {
object. This is essentially just a vector version of object. This is essentially just a vector version of
readpage. Instead of just one page, several pages are readpage. Instead of just one page, several pages are
requested. requested.
readpages is only used for readahead, so read errors are readpages is only used for read-ahead, so read errors are
ignored. If anything goes wrong, feel free to give up. 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 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 request for a page. This indicates to the address space that
the given range of bytes are about to be written. The the given range of bytes is about to be written. The
address_space should check that the write will be able to address_space should check that the write will be able to
complete, by allocating space if necessary and doing any other complete, by allocating space if necessary and doing any other
internal house keeping. If the write will update parts of internal housekeeping. If the write will update parts of
any basic-blocks on storage, then those blocks should be any basic-blocks on storage, then those blocks should be
pre-read (if they haven't been read already) so that the pre-read (if they haven't been read already) so that the
updated blocks can be written out properly. updated blocks can be written out properly.
...@@ -625,9 +625,9 @@ struct address_space_operations { ...@@ -625,9 +625,9 @@ struct address_space_operations {
errors should have been handled by prepare_write. errors should have been handled by prepare_write.
bmap: called by the VFS to map a logical block offset within object to bmap: called by the VFS to map a logical block offset within object to
physical block number. This method is used by for the FIBMAP physical block number. This method is used by the FIBMAP
ioctl and for working with swap-files. To be able to swap to ioctl and for working with swap-files. To be able to swap to
a file, the file must have as stable mapping to a block a file, the file must have a stable mapping to a block
device. The swap system does not go through the filesystem device. The swap system does not go through the filesystem
but instead uses bmap to find out where the blocks in the file but instead uses bmap to find out where the blocks in the file
are and uses those addresses directly. are and uses those addresses directly.
...@@ -635,7 +635,7 @@ struct address_space_operations { ...@@ -635,7 +635,7 @@ struct address_space_operations {
invalidatepage: If a page has PagePrivate set, then invalidatepage invalidatepage: If a page has PagePrivate set, then invalidatepage
will be called when part or all of the page is to be removed will be called when part or all of the page is to be removed
from the address space. This generally corresponds either a from the address space. This generally corresponds to either a
truncation or a complete invalidation of the address space truncation or a complete invalidation of the address space
(in the latter case 'offset' will always be 0). (in the latter case 'offset' will always be 0).
Any private data associated with the page should be updated Any private data associated with the page should be updated
...@@ -663,13 +663,13 @@ struct address_space_operations { ...@@ -663,13 +663,13 @@ struct address_space_operations {
they believe the cache may be out of date with storage) by they believe the cache may be out of date with storage) by
calling invalidate_inode_pages2(). calling invalidate_inode_pages2().
If the filesystem makes such a call, and needs to be certain If the filesystem makes such a call, and needs to be certain
that all pages are invalidated, then it's releasepage will that all pages are invalidated, then its releasepage will
need to ensure this. Possibly it can clear the PageUptodate need to ensure this. Possibly it can clear the PageUptodate
bit if it cannot free private data yet. bit if it cannot free private data yet.
direct_IO: called by the generic read/write routines to perform direct_IO: called by the generic read/write routines to perform
direct_IO - that is IO requests which bypass the page cache direct_IO - that is IO requests which bypass the page cache
and tranfer data directly between the storage and the and transfer data directly between the storage and the
application's address space. application's address space.
get_xip_page: called by the VM to translate a block number to a page. get_xip_page: called by the VM to translate a block number to a page.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment