Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1291174 > unrolled thread

[PATCH RFC 3/5] lightnvm: add sync support for submit_io

Started byMatias Bjørling <m@bjorling.me>
First post2015-12-14 14:20 +0100
Last post2015-12-15 15:20 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH RFC 3/5] lightnvm: add sync support for submit_io Matias Bjørling <m@bjorling.me> - 2015-12-14 14:20 +0100
    Re: [PATCH RFC 3/5] lightnvm: add sync support for submit_io Christoph Hellwig <hch@infradead.org> - 2015-12-15 13:40 +0100
      Re: [PATCH RFC 3/5] lightnvm: add sync support for submit_io Matias Bjørling <m@bjorling.me> - 2015-12-15 15:20 +0100

#1291174 — [PATCH RFC 3/5] lightnvm: add sync support for submit_io

FromMatias Bjørling <m@bjorling.me>
Date2015-12-14 14:20 +0100
Subject[PATCH RFC 3/5] lightnvm: add sync support for submit_io
Message-ID<qFBcJ-6CH-5@gated-at.bofh.it>
Allow read and write I/Os to be issued synchronous. Users include the
LightNVM core to implement system block support and similar.

Signed-off-by: Matias Bjørling <m@bjorling.me>
---
 drivers/nvme/host/lightnvm.c | 7 +++++++
 include/linux/lightnvm.h     | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index 15f2acb..1454e53 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -496,6 +496,13 @@ static int nvme_nvm_submit_io(struct nvm_dev *dev, struct nvm_rq *rqd)
 	rq->cmd_len = sizeof(struct nvme_nvm_command);
 	rq->special = (void *)0;
 
+	if (rqd->flags & NVM_IO_F_SYNC) {
+		int err = blk_execute_rq(q, NULL, rq, 0);
+		kfree(cmd);
+		blk_mq_free_request(rq);
+		return err;
+	}
+
 	rq->end_io_data = rqd;
 
 	blk_execute_rq_nowait(q, NULL, rq, 0, nvme_nvm_end_io);
diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h
index 2fd6871..770278a 100644
--- a/include/linux/lightnvm.h
+++ b/include/linux/lightnvm.h
@@ -60,6 +60,9 @@ enum {
 	NVM_BLK_T_BAD		= 0x1,
 	NVM_BLK_T_DEV		= 0x2,
 	NVM_BLK_T_HOST		= 0x4,
+
+	/* NVM Request Flags */
+	NVM_IO_F_SYNC		= 0x1,
 };
 
 struct nvm_id_group {
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1292114

FromChristoph Hellwig <hch@infradead.org>
Date2015-12-15 13:40 +0100
Message-ID<qFX3A-479-19@gated-at.bofh.it>
In reply to#1291174
On Mon, Dec 14, 2015 at 02:17:05PM +0100, Matias Bj??rling wrote:
> Allow read and write I/Os to be issued synchronous. Users include the
> LightNVM core to implement system block support and similar.

I think the right way to implement this is to wait in the caller,
e.g. set your end_io handler to a trivial one that just does a complete
and add a completion that you can wait on in the caller.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1292210

FromMatias Bjørling <m@bjorling.me>
Date2015-12-15 15:20 +0100
Message-ID<qFYCl-5bR-9@gated-at.bofh.it>
In reply to#1292114
On 12/15/2015 01:34 PM, Christoph Hellwig wrote:
> On Mon, Dec 14, 2015 at 02:17:05PM +0100, Matias Bj??rling wrote:
>> Allow read and write I/Os to be issued synchronous. Users include the
>> LightNVM core to implement system block support and similar.
>
> I think the right way to implement this is to wait in the caller,
> e.g. set your end_io handler to a trivial one that just does a complete
> and add a completion that you can wait on in the caller.
>

Thanks Christoph. I'll change it.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web