From: Jinyoung CHOI <j-young.choi@samsung.com>
To: "kbusch@kernel.org" <kbusch@kernel.org>,
"axboe@fb.com" <axboe@fb.com>, "hch@lst.de" <hch@lst.de>,
"sagi@grimberg.me" <sagi@grimberg.me>,
"chaitanya.kulkarni@wdc.com" <chaitanya.kulkarni@wdc.com>,
"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/2] nvme-pci: fix metadata mapping length
Date: Wed, 12 Apr 2023 14:24:43 +0900 [thread overview]
Message-ID: <20230412052443epcms2p836b669a12c4e81368bec2cd340656f73@epcms2p8> (raw)
In-Reply-To: <CGME20230412052443epcms2p836b669a12c4e81368bec2cd340656f73@epcms2p8>
Even if the memory allocated for integrity is physically continuous,
struct bio_vec is composed separately for each page size.
In order not to use the blk_rq_map_integrity_sg(), the length of the
DMA mapping should be the total size of integrity payload.
Fixes: 783b94bd9250 ("nvme-pci: do not build a scatterlist to map metadata")
Signed-off-by: Jinyoung Choi <j-young.choi@samsung.com>
---
drivers/nvme/host/pci.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 593f86323e25..611c677add67 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -827,8 +827,10 @@ static blk_status_t nvme_map_metadata(struct nvme_dev *dev, struct request *req,
{
struct nvme_iod *iod = blk_mq_rq_to_pdu(req);
- iod->meta_dma = dma_map_bvec(dev->dev, rq_integrity_vec(req),
- rq_dma_dir(req), 0);
+ iod->meta_dma = dma_map_page(dev->dev, rq_integrity_vec(req)->bv_page,
+ rq_integrity_vec(req)->bv_offset,
+ rq_integrity_payload_size(req),
+ rq_dma_dir(req));
if (dma_mapping_error(dev->dev, iod->meta_dma))
return BLK_STS_IOERR;
cmnd->rw.metadata = cpu_to_le64(iod->meta_dma);
@@ -968,7 +970,8 @@ static __always_inline void nvme_pci_unmap_rq(struct request *req)
struct nvme_iod *iod = blk_mq_rq_to_pdu(req);
dma_unmap_page(dev->dev, iod->meta_dma,
- rq_integrity_vec(req)->bv_len, rq_data_dir(req));
+ rq_integrity_payload_size(req),
+ rq_data_dir(req));
}
if (blk_rq_nr_phys_segments(req))
--
2.34.1
next parent reply other threads:[~2023-04-12 5:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20230412052443epcms2p836b669a12c4e81368bec2cd340656f73@epcms2p8>
2023-04-12 5:24 ` Jinyoung CHOI [this message]
2023-04-12 6:57 ` hch
2023-04-13 1:34 ` Martin K. Petersen
[not found] ` <CGME20230412052443epcms2p836b669a12c4e81368bec2cd340656f73@epcms2p1>
2023-04-12 7:12 ` Jinyoung CHOI
2023-04-12 11:49 ` (2) " hch
2023-04-13 1:37 ` Martin K. Petersen
[not found] ` <CGME20230412052443epcms2p836b669a12c4e81368bec2cd340656f73@epcms2p3>
2023-04-13 2:19 ` Jinyoung CHOI
2023-04-13 2:26 ` (2) " Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230412052443epcms2p836b669a12c4e81368bec2cd340656f73@epcms2p8 \
--to=j-young.choi@samsung.com \
--cc=axboe@fb.com \
--cc=chaitanya.kulkarni@wdc.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®