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

JIRA: https://issues.redhat.com/browse/RHEL-85589

commit 9d8b36744935f83c5553e6f242b9961f676628ed
Author: Christoph Hellwig <hch@lst.de>
Date:   Mon Feb 19 07:27:15 2024 +0100

    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: Christoph Hellwig <hch@lst.de>
    Reviewed-by: "Matthew Wilcox (Oracle)" <willy@infradead.org>
    Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
    Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
This commit is contained in:
Bill O'Donnell 2025-07-10 21:49:44 -05:00
parent c9f9f0b39b
commit 43d87507d0
1 changed files with 4 additions and 0 deletions

View File

@ -2152,6 +2152,10 @@ unlock:
* 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