Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: willy@linux.intel.com (Matthew Wilcox)
Subject: [PATCH] NVMe: Add rw_page support
Date: Fri, 14 Nov 2014 09:55:44 -0500	[thread overview]
Message-ID: <20141114145544.GE11522@wil.cx> (raw)
In-Reply-To: <1415923538-18760-1-git-send-email-keith.busch@intel.com>

On Thu, Nov 13, 2014@05:05:38PM -0700, Keith Busch wrote:
> +static void pgrd_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_FROM_DEVICE);
> +	page_endio(page, READ, status != NVME_SC_SUCCESS);

The third parameter to page_endio() is supposed to be an errno.  This will
happen to work fine since anything other than 0 and -ENOSPC gets translated
to -EIO, but it'd be better to make this line:

	page_endio(page, READ, nvme_error_status(status));

> +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);

Here too.

  parent reply	other threads:[~2014-11-14 14:55 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 [this message]
     [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
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=20141114145544.GE11522@wil.cx \
    --to=willy@linux.intel.com \
    /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