* [PATCH 1/2] lightnvm: create cmd before allocating request
@ 2017-05-03 9:19 Javier González
2017-05-03 9:19 ` [PATCH 2/2] lightnvm: fix bad back free on error path Javier González
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Javier González @ 2017-05-03 9:19 UTC (permalink / raw)
To: mb; +Cc: linux-block, linux-kernel, Javier González
Create nvme command before allocating a request using
nvme_alloc_request, which uses the command direction. Up until now, the
command has been zeroized, so all commands have been allocated as a
read operation.
Signed-off-by: Javier González <javier@cnexlabs.com>
---
drivers/nvme/host/lightnvm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index de61a4a03d78..090bbeb655bc 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -503,6 +503,8 @@ static int nvme_nvm_submit_io(struct nvm_dev *dev, struct nvm_rq *rqd)
if (!cmd)
return -ENOMEM;
+ nvme_nvm_rqtocmd(rq, rqd, ns, cmd);
+
rq = nvme_alloc_request(q, (struct nvme_command *)cmd, 0, NVME_QID_ANY);
if (IS_ERR(rq)) {
kfree(cmd);
@@ -517,8 +519,6 @@ static int nvme_nvm_submit_io(struct nvm_dev *dev, struct nvm_rq *rqd)
rq->__data_len = 0;
}
- nvme_nvm_rqtocmd(rq, rqd, ns, cmd);
-
rq->end_io_data = rqd;
blk_execute_rq_nowait(q, NULL, rq, 0, nvme_nvm_end_io);
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] lightnvm: fix bad back free on error path
2017-05-03 9:19 [PATCH 1/2] lightnvm: create cmd before allocating request Javier González
@ 2017-05-03 9:19 ` Javier González
2017-05-04 8:04 ` Matias Bjørling
2017-05-04 11:27 ` Christoph Hellwig
2017-05-04 8:04 ` [PATCH 1/2] lightnvm: create cmd before allocating request Matias Bjørling
` (2 subsequent siblings)
3 siblings, 2 replies; 8+ messages in thread
From: Javier González @ 2017-05-03 9:19 UTC (permalink / raw)
To: mb; +Cc: linux-block, linux-kernel, Javier González
Free memory correctly when an allocation fails on a loop and we free
backwards previously successful allocations.
Signed-off-by: Javier González <javier@cnexlabs.com>
---
drivers/lightnvm/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
index 54a06c3a2b8c..6a4aa608ad95 100644
--- a/drivers/lightnvm/core.c
+++ b/drivers/lightnvm/core.c
@@ -74,7 +74,7 @@ static int nvm_reserve_luns(struct nvm_dev *dev, int lun_begin, int lun_end)
return 0;
err:
- while (--i > lun_begin)
+ while (--i >= lun_begin)
clear_bit(i, dev->lun_map);
return -EBUSY;
@@ -211,7 +211,7 @@ static struct nvm_tgt_dev *nvm_create_tgt_dev(struct nvm_dev *dev,
return tgt_dev;
err_ch:
- while (--i > 0)
+ while (--i >= 0)
kfree(dev_map->chnls[i].lun_offs);
kfree(luns);
err_luns:
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] lightnvm: create cmd before allocating request
2017-05-03 9:19 [PATCH 1/2] lightnvm: create cmd before allocating request Javier González
2017-05-03 9:19 ` [PATCH 2/2] lightnvm: fix bad back free on error path Javier González
@ 2017-05-04 8:04 ` Matias Bjørling
2017-05-04 11:27 ` Christoph Hellwig
2017-05-04 13:53 ` Jens Axboe
3 siblings, 0 replies; 8+ messages in thread
From: Matias Bjørling @ 2017-05-04 8:04 UTC (permalink / raw)
To: Javier González, mb
Cc: linux-block, linux-kernel, Javier González, Jens Axboe
On 05/03/2017 11:19 AM, Javier González wrote:
> Create nvme command before allocating a request using
> nvme_alloc_request, which uses the command direction. Up until now, the
> command has been zeroized, so all commands have been allocated as a
> read operation.
>
> Signed-off-by: Javier González <javier@cnexlabs.com>
> ---
> drivers/nvme/host/lightnvm.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
> index de61a4a03d78..090bbeb655bc 100644
> --- a/drivers/nvme/host/lightnvm.c
> +++ b/drivers/nvme/host/lightnvm.c
> @@ -503,6 +503,8 @@ static int nvme_nvm_submit_io(struct nvm_dev *dev, struct nvm_rq *rqd)
> if (!cmd)
> return -ENOMEM;
>
> + nvme_nvm_rqtocmd(rq, rqd, ns, cmd);
> +
> rq = nvme_alloc_request(q, (struct nvme_command *)cmd, 0, NVME_QID_ANY);
> if (IS_ERR(rq)) {
> kfree(cmd);
> @@ -517,8 +519,6 @@ static int nvme_nvm_submit_io(struct nvm_dev *dev, struct nvm_rq *rqd)
> rq->__data_len = 0;
> }
>
> - nvme_nvm_rqtocmd(rq, rqd, ns, cmd);
> -
> rq->end_io_data = rqd;
>
> blk_execute_rq_nowait(q, NULL, rq, 0, nvme_nvm_end_io);
>
Reviewed-by: Matias Bjørling <matias@cnexlabs.com>
Jens, would you pick this up when convenient? Thank you!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] lightnvm: fix bad back free on error path
2017-05-03 9:19 ` [PATCH 2/2] lightnvm: fix bad back free on error path Javier González
@ 2017-05-04 8:04 ` Matias Bjørling
2017-05-04 11:27 ` Christoph Hellwig
1 sibling, 0 replies; 8+ messages in thread
From: Matias Bjørling @ 2017-05-04 8:04 UTC (permalink / raw)
To: Javier González, mb
Cc: linux-block, linux-kernel, Javier González, Jens Axboe
On 05/03/2017 11:19 AM, Javier González wrote:
> Free memory correctly when an allocation fails on a loop and we free
> backwards previously successful allocations.
>
> Signed-off-by: Javier González <javier@cnexlabs.com>
> ---
> drivers/lightnvm/core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
> index 54a06c3a2b8c..6a4aa608ad95 100644
> --- a/drivers/lightnvm/core.c
> +++ b/drivers/lightnvm/core.c
> @@ -74,7 +74,7 @@ static int nvm_reserve_luns(struct nvm_dev *dev, int lun_begin, int lun_end)
>
> return 0;
> err:
> - while (--i > lun_begin)
> + while (--i >= lun_begin)
> clear_bit(i, dev->lun_map);
>
> return -EBUSY;
> @@ -211,7 +211,7 @@ static struct nvm_tgt_dev *nvm_create_tgt_dev(struct nvm_dev *dev,
>
> return tgt_dev;
> err_ch:
> - while (--i > 0)
> + while (--i >= 0)
> kfree(dev_map->chnls[i].lun_offs);
> kfree(luns);
> err_luns:
>
Reviewed-by: Matias Bjørling <matias@cnexlabs.com>
Jens, and this baby as well? :)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] lightnvm: create cmd before allocating request
2017-05-03 9:19 [PATCH 1/2] lightnvm: create cmd before allocating request Javier González
2017-05-03 9:19 ` [PATCH 2/2] lightnvm: fix bad back free on error path Javier González
2017-05-04 8:04 ` [PATCH 1/2] lightnvm: create cmd before allocating request Matias Bjørling
@ 2017-05-04 11:27 ` Christoph Hellwig
2017-05-04 13:53 ` Jens Axboe
3 siblings, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2017-05-04 11:27 UTC (permalink / raw)
To: Javier González; +Cc: mb, linux-block, linux-kernel, Javier González
On Wed, May 03, 2017 at 11:19:04AM +0200, Javier González wrote:
> Create nvme command before allocating a request using
> nvme_alloc_request, which uses the command direction. Up until now, the
> command has been zeroized, so all commands have been allocated as a
> read operation.
Hah.. Looks fine:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] lightnvm: fix bad back free on error path
2017-05-03 9:19 ` [PATCH 2/2] lightnvm: fix bad back free on error path Javier González
2017-05-04 8:04 ` Matias Bjørling
@ 2017-05-04 11:27 ` Christoph Hellwig
1 sibling, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2017-05-04 11:27 UTC (permalink / raw)
To: Javier González; +Cc: mb, linux-block, linux-kernel, Javier González
Looks fine,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] lightnvm: create cmd before allocating request
2017-05-03 9:19 [PATCH 1/2] lightnvm: create cmd before allocating request Javier González
` (2 preceding siblings ...)
2017-05-04 11:27 ` Christoph Hellwig
@ 2017-05-04 13:53 ` Jens Axboe
2017-05-04 13:55 ` Javier González
3 siblings, 1 reply; 8+ messages in thread
From: Jens Axboe @ 2017-05-04 13:53 UTC (permalink / raw)
To: Javier González; +Cc: mb, linux-block, linux-kernel, Javier González
On Wed, May 03 2017, Javier González wrote:
> Create nvme command before allocating a request using
> nvme_alloc_request, which uses the command direction. Up until now, the
> command has been zeroized, so all commands have been allocated as a
> read operation.
Applied 1-2. Javier, please use a cover letter when sending more than 1
patch at the time, makes it easier to reply to the series as a whole.
--
Jens Axboe
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] lightnvm: create cmd before allocating request
2017-05-04 13:53 ` Jens Axboe
@ 2017-05-04 13:55 ` Javier González
0 siblings, 0 replies; 8+ messages in thread
From: Javier González @ 2017-05-04 13:55 UTC (permalink / raw)
To: Jens Axboe; +Cc: Matias Bjørling, linux-block, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 536 bytes --]
> On 4 May 2017, at 15.53, Jens Axboe <axboe@kernel.dk> wrote:
>
> On Wed, May 03 2017, Javier González wrote:
>> Create nvme command before allocating a request using
>> nvme_alloc_request, which uses the command direction. Up until now, the
>> command has been zeroized, so all commands have been allocated as a
>> read operation.
>
> Applied 1-2. Javier, please use a cover letter when sending more than 1
> patch at the time, makes it easier to reply to the series as a whole.
>
Thanks Jens. I will.
Javier
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-05-04 13:56 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-03 9:19 [PATCH 1/2] lightnvm: create cmd before allocating request Javier González
2017-05-03 9:19 ` [PATCH 2/2] lightnvm: fix bad back free on error path Javier González
2017-05-04 8:04 ` Matias Bjørling
2017-05-04 11:27 ` Christoph Hellwig
2017-05-04 8:04 ` [PATCH 1/2] lightnvm: create cmd before allocating request Matias Bjørling
2017-05-04 11:27 ` Christoph Hellwig
2017-05-04 13:53 ` Jens Axboe
2017-05-04 13:55 ` Javier González
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).