* [PATCH] NVMe: Initialize iod nents to 0
@ 2012-11-06 18:59 Keith Busch
2012-11-06 21:03 ` Matthew Wilcox
0 siblings, 1 reply; 2+ messages in thread
From: Keith Busch @ 2012-11-06 18:59 UTC (permalink / raw)
For commands that do not map a scatter list, we need to initilaize the iod's
number of sg entries (nents) to 0 and not unmap in this case.
Signed-off-by: Keith Busch <keith.busch at intel.com>
---
drivers/block/nvme.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/block/nvme.c b/drivers/block/nvme.c
index f9ad514..2544504 100644
--- a/drivers/block/nvme.c
+++ b/drivers/block/nvme.c
@@ -334,6 +334,7 @@ nvme_alloc_iod(unsigned nseg, unsigned nbytes, gfp_t gfp)
iod->offset = offsetof(struct nvme_iod, sg[nseg]);
iod->npages = -1;
iod->length = nbytes;
+ iod->nents = 0;
}
return iod;
@@ -374,7 +375,8 @@ static void bio_completion(struct nvme_dev *dev, void *ctx,
struct bio *bio = iod->private;
u16 status = le16_to_cpup(&cqe->status) >> 1;
- dma_unmap_sg(&dev->pci_dev->dev, iod->sg, iod->nents,
+ if (iod->nents)
+ dma_unmap_sg(&dev->pci_dev->dev, iod->sg, iod->nents,
bio_data_dir(bio) ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
nvme_free_iod(dev, iod);
if (status) {
--
1.7.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] NVMe: Initialize iod nents to 0
2012-11-06 18:59 [PATCH] NVMe: Initialize iod nents to 0 Keith Busch
@ 2012-11-06 21:03 ` Matthew Wilcox
0 siblings, 0 replies; 2+ messages in thread
From: Matthew Wilcox @ 2012-11-06 21:03 UTC (permalink / raw)
On Tue, Nov 06, 2012@11:59:23AM -0700, Keith Busch wrote:
> For commands that do not map a scatter list, we need to initilaize the iod's
> number of sg entries (nents) to 0 and not unmap in this case.
>
> Signed-off-by: Keith Busch <keith.busch at intel.com>
Thanks; applied
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-11-06 21:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-06 18:59 [PATCH] NVMe: Initialize iod nents to 0 Keith Busch
2012-11-06 21:03 ` Matthew Wilcox
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).