[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251219071707.3295393-1-den@valinux.co.jp>
Date: Fri, 19 Dec 2025 16:17:07 +0900
From: Koichiro Den <den@...inux.co.jp>
To: axboe@...nel.dk
Cc: linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] block: enable RWF_DONTCACHE for block device buffered I/O
Set FOP_DONTCACHE for def_blk_fops so preadv2()/pwritev2() can accept
RWF_DONTCACHE on block device files. The generic page cache and iomap
infrastructure already handles RWF_DONTCACHE semantics for the buffered
I/O, so simply enabling the flag suffices.
This lets userspace request drop-behind behaviour and is particularly
useful for avoiding double caching in virtualization stacks that do not
use O_DIRECT (e.g. virtio-disk backend for xen).
Signed-off-by: Koichiro Den <den@...inux.co.jp>
---
block/fops.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/fops.c b/block/fops.c
index 4d32785b31d9..9db41dada818 100644
--- a/block/fops.c
+++ b/block/fops.c
@@ -967,7 +967,7 @@ const struct file_operations def_blk_fops = {
.splice_write = iter_file_splice_write,
.fallocate = blkdev_fallocate,
.uring_cmd = blkdev_uring_cmd,
- .fop_flags = FOP_BUFFER_RASYNC,
+ .fop_flags = FOP_BUFFER_RASYNC | FOP_DONTCACHE,
};
static __init int blkdev_init(void)
--
2.51.0
Powered by blists - more mailing lists