Skip to content

Commit 32b29cc

Browse files
author
Matthew Wilcox (Oracle)
committed
doc: Correct the description of ->release_folio
The filesystem ->release_folio method is called under more circumstances now than when the documentation was written. The second sentence describing the interpretation of the return value is the wrong polarity (false indicates failure, not success). And the third sentence is also wrong (the kernel calls try_to_free_buffers() instead). So replace the entire paragraph with a detailed description of what the state of the folio may be, the meaning of the gfp parameter, why the method is being called and what the filesystem is expected to do. Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]>
1 parent a221ab7 commit 32b29cc

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

Documentation/filesystems/locking.rst

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -374,10 +374,17 @@ invalidate_lock before invalidating page cache in truncate / hole punch
374374
path (and thus calling into ->invalidate_folio) to block races between page
375375
cache invalidation and page cache filling functions (fault, read, ...).
376376

377-
->release_folio() is called when the kernel is about to try to drop the
378-
buffers from the folio in preparation for freeing it. It returns false to
379-
indicate that the buffers are (or may be) freeable. If ->release_folio is
380-
NULL, the kernel assumes that the fs has no private interest in the buffers.
377+
->release_folio() is called when the MM wants to make a change to the
378+
folio that would invalidate the filesystem's private data. For example,
379+
it may be about to be removed from the address_space or split. The folio
380+
is locked and not under writeback. It may be dirty. The gfp parameter
381+
is not usually used for allocation, but rather to indicate what the
382+
filesystem may do to attempt to free the private data. The filesystem may
383+
return false to indicate that the folio's private data cannot be freed.
384+
If it returns true, it should have already removed the private data from
385+
the folio. If a filesystem does not provide a ->release_folio method,
386+
the pagecache will assume that private data is buffer_heads and call
387+
try_to_free_buffers().
381388

382389
->free_folio() is called when the kernel has dropped the folio
383390
from the page cache.

0 commit comments

Comments
 (0)