[PATCH v2 4/5] ext4: handle IOCB_DONTCACHE in buffered write path

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

 



From: Taotao Chen <chentaotao@xxxxxxxxxxxxxx>

Add support for the IOCB_DONTCACHE flag in ext4_write_begin() and
ext4_da_write_begin(). When set in the kiocb, the FGP_DONTCACHE bit
is passed to the page cache lookup, preventing written pages from
being retained in the cache.

Only the handling logic is implemented here; the behavior remains
inactive until ext4 advertises support via FOP_DONTCACHE.

This change relies on prior patches that refactor the write_begin
interface to use struct kiocb and introduce DONTCACHE handling in ext4.

Part of a series refactoring address_space_operations write_begin and
write_end callbacks to use struct kiocb for passing write context and
flags.

Signed-off-by: Taotao Chen <chentaotao@xxxxxxxxxxxxxx>
---
 fs/ext4/inode.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 7ff7009f9799..3a82b52565cc 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1269,6 +1269,9 @@ static int ext4_write_begin(struct kiocb *iocb, struct address_space *mapping,
 	if (unlikely(ret))
 		return ret;
 
+	if (iocb->ki_flags & IOCB_DONTCACHE)
+		fgp |= FGP_DONTCACHE;
+
 	trace_ext4_write_begin(inode, pos, len);
 	/*
 	 * Reserve one block more for addition to orphan list in case
@@ -3066,6 +3069,9 @@ static int ext4_da_write_begin(struct kiocb *iocb, struct address_space *mapping
 			return 0;
 	}
 
+	if (iocb->ki_flags & IOCB_DONTCACHE)
+		fgp |= FGP_DONTCACHE;
+
 retry:
 	fgp |= fgf_set_order(len);
 	folio = __filemap_get_folio(mapping, index, fgp,
-- 
2.34.1




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux