From: axboe@kernel.dk (Jens Axboe)
Subject: [PATCH] NVMe: Add rw_page support
Date: Fri, 14 Nov 2014 15:56:59 -0700 [thread overview]
Message-ID: <546688BB.3030802@kernel.dk> (raw)
In-Reply-To: <alpine.LNX.2.00.1411142238330.4225@localhost.lm.intel.com>
On 11/14/2014 03:50 PM, Keith Busch wrote:
> On Fri, 14 Nov 2014, Andrey Kuzmin wrote:
>> On Nov 14, 2014 3:13 AM, "Keith Busch" <keith.busch@intel.com> wrote:
>> > +static void pgwr_completion(struct nvme_queue *nvmeq, void *ctx,
>> > + struct
>> nvme_completion *cqe)
>> > +{
>> > + struct request *req = ctx;
>> > + struct nvme_cmd_info *cmd_rq = blk_mq_rq_to_pdu(req);
>> > + struct page *page = req->special;
>> > + u16 status = le16_to_cpup(&cqe->status) >> 1;
>> > +
>> > + dma_unmap_page(nvmeq->q_dmadev, cmd_rq->dma,
>> PAGE_CACHE_SIZE, DMA_TO_DEVICE);
>> > + page_endio(page, WRITE, status != NVME_SC_SUCCESS);
>> > + blk_put_request(req);
>> > +}
>> > +
>>
>> As you have access to the nvme_cmd_info - and thus command opcode - in
>> the
>> completion handler, having separate completion handlers for read and
>> write
>> operations looks like unnecessary code duplication. Just my .02 :).
>
> But nvme_cmd_info does not contain the opcode. I do have the struct
> request here, and I can certainly pull the data direction from its
> cmd_flags, so thanks for the suggestion!
>
> Now I wonder if there's something else unused in a request that I
> can repurpose to save the dma_addr_t in so I don't add it in the
> nvme_cmd_info...
For the rw_page path, you don't use ->special to store the iod. So you
could use that... That might break for 32-bit platforms and 64-bit DMA,
though. If you really want to get nasty, ->__cmd is 16 bytes of unused
goodness as well, though I do want to make that one dynamically
allocated for the queues that need it.
--
Jens Axboe
next prev parent reply other threads:[~2014-11-14 22:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-14 0:05 [PATCH] NVMe: Add rw_page support Keith Busch
2014-11-14 1:29 ` Jens Axboe
2014-11-14 14:58 ` Matthew Wilcox
2014-11-14 15:07 ` Jens Axboe
2014-11-14 15:52 ` Matthew Wilcox
2014-11-14 16:32 ` Jens Axboe
2014-11-14 17:05 ` Keith Busch
2014-11-14 20:53 ` Jens Axboe
2014-11-14 22:59 ` Keith Busch
2014-11-14 14:55 ` Matthew Wilcox
[not found] ` <CANvN+ekQTdNgPe33iaM_9=2Hjrfds2B2R3d3XK06K9n=SY+ZKA@mail.gmail.com>
2014-11-14 22:50 ` Keith Busch
2014-11-14 22:56 ` Jens Axboe [this message]
2014-11-14 23:04 ` Keith Busch
2014-11-14 23:30 ` Jens Axboe
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=546688BB.3030802@kernel.dk \
--to=axboe@kernel.dk \
/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