Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 286250
b: refs/heads/master
c: 48e3d39
h: refs/heads/master
v: v3
  • Loading branch information
Matthew Wilcox committed Nov 4, 2011
1 parent 3cddb8f commit 98fa6e4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b36235df01ec4141b4e589571d6789076c346d88
refs/heads/master: 48e3d39816416b3bf03dee3a796c0c04427c1a31
9 changes: 9 additions & 0 deletions trunk/drivers/block/nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,15 @@ enum {
#define CMD_CTX_BASE (POISON_POINTER_DELTA + sync_completion_id)
#define CMD_CTX_CANCELLED (0x2008 + CMD_CTX_BASE)
#define CMD_CTX_COMPLETED (0x2010 + CMD_CTX_BASE)
#define CMD_CTX_INVALID (0x2014 + CMD_CTX_BASE)

static unsigned long free_cmdid(struct nvme_queue *nvmeq, int cmdid)
{
unsigned long data;
unsigned offset = cmdid + BITS_TO_LONGS(nvmeq->q_depth);

if (cmdid > nvmeq->q_depth)
return CMD_CTX_INVALID;
data = nvmeq->cmdid_data[offset];
nvmeq->cmdid_data[offset] = CMD_CTX_COMPLETED;
clear_bit(cmdid, nvmeq->cmdid_data);
Expand Down Expand Up @@ -411,6 +414,12 @@ static void sync_completion(struct nvme_queue *nvmeq, void *ctx,
cqe->command_id, le16_to_cpup(&cqe->sq_id));
return;
}
if (unlikely((unsigned long)cmdinfo == CMD_CTX_INVALID)) {
dev_warn(nvmeq->q_dmadev,
"invalid id %d completed on queue %d\n",
cqe->command_id, le16_to_cpup(&cqe->sq_id));
return;
}
cmdinfo->result = le32_to_cpup(&cqe->result);
cmdinfo->status = le16_to_cpup(&cqe->status) >> 1;
wake_up_process(cmdinfo->task);
Expand Down

0 comments on commit 98fa6e4

Please sign in to comment.