[PATCH 0/3] nvmet: add buffered_io support for bdev-ns

Christoph Hellwig hch at lst.de
Wed Jan 26 08:27:47 PST 2022


Shouldn't something like the patch below be all we need to use
buffered I/O on a block device?

diff --git a/drivers/nvme/target/io-cmd-bdev.c b/drivers/nvme/target/io-cmd-bdev.c
index 70ca9dfc1771a..7d9da2f77b83a 100644
--- a/drivers/nvme/target/io-cmd-bdev.c
+++ b/drivers/nvme/target/io-cmd-bdev.c
@@ -76,6 +76,10 @@ int nvmet_bdev_ns_enable(struct nvmet_ns *ns)
 {
 	int ret;
 
+	/* force fallback to the file backend for buffered I/O mode */
+	if (ns->buffered_io)
+		return -ENOTBLK;
+
 	ns->bdev = blkdev_get_by_path(ns->device_path,
 			FMODE_READ | FMODE_WRITE, NULL);
 	if (IS_ERR(ns->bdev)) {



More information about the Linux-nvme mailing list