[RFC PATCH 2/3] filemap: Mark folios as dropbehind in generic_perform_write()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>

The iocb flags are not passed down to the write_begin() callback that is
allocating the folio, so we need to set the dropbehind folio flag from
inside the generic_perform_write() function itself.

Signed-off-by: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>
---
 mm/filemap.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/mm/filemap.c b/mm/filemap.c
index 12f694880bb8..4c383f29e828 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -4136,6 +4136,11 @@ ssize_t generic_perform_write(struct kiocb *iocb, struct iov_iter *i)
 		copied = copy_folio_from_iter_atomic(folio, offset, bytes, i);
 		flush_dcache_folio(folio);
 
+		if (iocb->ki_flags & IOCB_DONTCACHE)
+			folio_set_dropbehind(folio);
+		else if (folio_test_dropbehind(folio))
+			folio_clear_dropbehind(folio);
+
 		status = a_ops->write_end(file, mapping, pos, bytes, copied,
 						folio, fsdata);
 		if (unlikely(status != copied)) {
-- 
2.49.0





[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux