aboutsummaryrefslogtreecommitdiffstats
path: root/mm/filemap.c
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <[email protected]>2023-10-04 16:53:03 +0000
committerAndrew Morton <[email protected]>2023-10-18 21:34:16 +0000
commit0b237047d5a72ffe06c0bdf2f4536f669dcd31c9 (patch)
tree03cf27b48189f26e36323cb222de65dbacd32332 /mm/filemap.c
parentiomap: protect read_bytes_pending with the state_lock (diff)
downloadkernel-0b237047d5a72ffe06c0bdf2f4536f669dcd31c9.tar.gz
kernel-0b237047d5a72ffe06c0bdf2f4536f669dcd31c9.zip
mm: add folio_end_read()
Provide a function for filesystems to call when they have finished reading an entire folio. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Cc: Albert Ou <[email protected]> Cc: Alexander Gordeev <[email protected]> Cc: Andreas Dilger <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: Christophe Leroy <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ivan Kokshaysky <[email protected]> Cc: Matt Turner <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Nicholas Piggin <[email protected]> Cc: Palmer Dabbelt <[email protected]> Cc: Paul Walmsley <[email protected]> Cc: Richard Henderson <[email protected]> Cc: Sven Schnelle <[email protected]> Cc: "Theodore Ts'o" <[email protected]> Cc: Thomas Bogendoerfer <[email protected]> Cc: Vasily Gorbik <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'mm/filemap.c')
-rw-r--r--mm/filemap.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index cd872fbc6086..1ce78c619294 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1526,6 +1526,28 @@ void folio_unlock(struct folio *folio)
EXPORT_SYMBOL(folio_unlock);
/**
+ * folio_end_read - End read on a folio.
+ * @folio: The folio.
+ * @success: True if all reads completed successfully.
+ *
+ * When all reads against a folio have completed, filesystems should
+ * call this function to let the pagecache know that no more reads
+ * are outstanding. This will unlock the folio and wake up any thread
+ * sleeping on the lock. The folio will also be marked uptodate if all
+ * reads succeeded.
+ *
+ * Context: May be called from interrupt or process context. May not be
+ * called from NMI context.
+ */
+void folio_end_read(struct folio *folio, bool success)
+{
+ if (likely(success))
+ folio_mark_uptodate(folio);
+ folio_unlock(folio);
+}
+EXPORT_SYMBOL(folio_end_read);
+
+/**
* folio_end_private_2 - Clear PG_private_2 and wake any waiters.
* @folio: The folio.
*