Commit 9d8b3674 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Chandan Babu R

shmem: document how to "persist" data when using shmem_*file_setup

Add a blurb that simply dirtying the folio will persist data for in-kernel
shmem files.  This is what most of the callers already do.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatar"Matthew Wilcox (Oracle)" <willy@infradead.org>
Reviewed-by: default avatar"Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: default avatarChandan Babu R <chandanbabu@kernel.org>
parent be9d9366
......@@ -2147,6 +2147,10 @@ static int shmem_get_folio_gfp(struct inode *inode, pgoff_t index,
* Looks up the page cache entry at @inode & @index. If a folio is
* present, it is returned locked with an increased refcount.
*
* If the caller modifies data in the folio, it must call folio_mark_dirty()
* before unlocking the folio to ensure that the folio is not reclaimed.
* There is no need to reserve space before calling folio_mark_dirty().
*
* When no folio is found, the behavior depends on @sgp:
* - for SGP_READ, *foliop is %NULL and 0 is returned
* - for SGP_NOALLOC, *foliop is %NULL and -ENOENT is returned
......
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