[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250624121149.2927-5-chentaotao@didiglobal.com>
Date: Tue, 24 Jun 2025 12:12:09 +0000
From: 陈涛涛 Taotao Chen <chentaotao@...iglobal.com>
To: "tytso@....edu" <tytso@....edu>, "hch@...radead.org" <hch@...radead.org>,
"adilger.kernel@...ger.ca" <adilger.kernel@...ger.ca>, "willy@...radead.org"
<willy@...radead.org>, "brauner@...nel.org" <brauner@...nel.org>,
"jani.nikula@...ux.intel.com" <jani.nikula@...ux.intel.com>,
"rodrigo.vivi@...el.com" <rodrigo.vivi@...el.com>, "tursulin@...ulin.net"
<tursulin@...ulin.net>, "airlied@...il.com" <airlied@...il.com>
CC: "linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
"linux-ext4@...r.kernel.org" <linux-ext4@...r.kernel.org>,
"linux-block@...r.kernel.org" <linux-block@...r.kernel.org>,
"intel-gfx@...ts.freedesktop.org" <intel-gfx@...ts.freedesktop.org>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>, "linux-doc@...r.kernel.org"
<linux-doc@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "chentao325@...com" <chentao325@...com>,
陈涛涛 Taotao Chen <chentaotao@...iglobal.com>
Subject: [PATCH v2 4/5] ext4: handle IOCB_DONTCACHE in buffered write path
From: Taotao Chen <chentaotao@...iglobal.com>
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@...iglobal.com>
---
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
Powered by blists - more mailing lists