NVMe: Correct SQ doorbell semantics
authorMatthew Wilcox <matthew.r.wilcox@intel.com>
Wed, 16 Feb 2011 14:59:59 +0000 (09:59 -0500)
committerMatthew Wilcox <matthew.r.wilcox@intel.com>
Fri, 4 Nov 2011 19:52:58 +0000 (15:52 -0400)
The value written to the doorbell needs to be the first free index in
the queue, not the most recently used index in the queue.

Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
drivers/block/nvme.c

index df1d8bda8c7c0fa6f3fcec48f44fc7dc2ea41129..af45e286d5dda0ff5b143148d34b6f9746c3baee 100644 (file)
@@ -246,9 +246,9 @@ static int nvme_submit_cmd(struct nvme_queue *nvmeq, struct nvme_command *cmd)
        spin_lock_irqsave(&nvmeq->q_lock, flags);
        tail = nvmeq->sq_tail;
        memcpy(&nvmeq->sq_cmds[tail], cmd, sizeof(*cmd));
-       writel(tail, nvmeq->q_db);
        if (++tail == nvmeq->q_depth)
                tail = 0;
+       writel(tail, nvmeq->q_db);
        nvmeq->sq_tail = tail;
        spin_unlock_irqrestore(&nvmeq->q_lock, flags);
 
@@ -471,9 +471,9 @@ static int nvme_submit_bio_queue(struct nvme_queue *nvmeq, struct nvme_ns *ns,
        cmnd->rw.control = cpu_to_le16(control);
        cmnd->rw.dsmgmt = cpu_to_le32(dsmgmt);
 
-       writel(nvmeq->sq_tail, nvmeq->q_db);
        if (++nvmeq->sq_tail == nvmeq->q_depth)
                nvmeq->sq_tail = 0;
+       writel(nvmeq->sq_tail, nvmeq->q_db);
 
        return 0;
 
This page took 0.025567 seconds and 5 git commands to generate.