Skip to contentSkip to conversation

: NVMe: ioctl support for FLUSH command

PATCH New David Milburn 2 participants 2 messages Nov 4, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : NVMe: ioctl support for FLUSH command

Support for user space application to submit FLUSH command.

Signed-off-by David Milburn <dmilburn at redhat.com>
---
 drivers/block/nvme-core.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/block/nvme-core.c +4 -0
index da52092..4fab135 100644
@@ -1392,6 +1392,10 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio)
 	case nvme_cmd_compare:
 		iod = nvme_map_user_pages(dev, io.opcode & 1, io.addr, length);
 		break;
+	case nvme_cmd_flush:
+		nvmeq = get_nvmeq(dev);
+		status = nvme_submit_flush_data(nvmeq, ns);
+		return status;
 	default:
 		return -EINVAL;
 	}
#1 lore raw

PATCH 1/1 : NVMe: ioctl support for FLUSH command

Quoted 12 lines · David Milburn

Support for user space application to submit FLUSH command.

Signed-off-by David Milburn <dmilburn at redhat.com>

---
drivers/block/nvme-core.c | 4 ++++

1 files changed, 4 insertions(+), 0 deletions(-)
drivers/block/nvme-core.c +0 -0
index da52092..4fab135 100644

drivers/block/nvme-core.c static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio) · line 1398

Quoted 7 lines
drivers/block/nvme-core.c +4 -0
@@ -1392,6 +1392,10 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio)
 	case nvme_cmd_compare:
 		iod = nvme_map_user_pages(dev, io.opcode & 1, io.addr, length);
 		break;
+	case nvme_cmd_flush:
+		nvmeq = get_nvmeq(dev);
+		status = nvme_submit_flush_data(nvmeq, ns);
+		return status;

I'm not sure this is the right way to go. The other nvme passthrough commands are synchronous where this would be asynchronous, so the user can't get the nvme status with a flush command.

If async flush is okay, the nvmeq->q_lock needs to be held around nvme_submit_flush_data, and call put_nvmeq() before returning status.

I think we might want to rethink this whole user io ioctl to take any nvme io command including vendor unique ones. ?

Quoted 4 lines
drivers/block/nvme-core.c +0 -0
 	default:
 		return -EINVAL;
 	}