Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 286253
b: refs/heads/master
c: 9294bbe
h: refs/heads/master
i:
  286251: 8305834
v: v3
  • Loading branch information
Matthew Wilcox committed Nov 4, 2011
1 parent 54f9edc commit 574d77b
Show file tree
Hide file tree
Showing 2 changed files with 18 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: e85248e516c550382ba33ca325c272a0ca397e44
refs/heads/master: 9294bbed78926a895516ec016ba23033f58d1a88
17 changes: 17 additions & 0 deletions trunk/drivers/block/nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ struct nvme_queue {
unsigned long cmdid_data[];
};

static void nvme_resubmit_bio(struct nvme_queue *nvmeq, struct bio *bio);

/*
* Check we didin't inadvertently grow the command struct
*/
Expand Down Expand Up @@ -274,6 +276,9 @@ static void bio_completion(struct nvme_queue *nvmeq, void *ctx,
bio_data_dir(bio) ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
free_info(info);
bio_endio(bio, status ? -EIO : 0);
bio = bio_list_pop(&nvmeq->sq_cong);
if (bio)
nvme_resubmit_bio(nvmeq, bio);
}

/* length is in bytes */
Expand Down Expand Up @@ -392,6 +397,16 @@ static int nvme_submit_bio_queue(struct nvme_queue *nvmeq, struct nvme_ns *ns,
return -EBUSY;
}

static void nvme_resubmit_bio(struct nvme_queue *nvmeq, struct bio *bio)
{
struct nvme_ns *ns = bio->bi_bdev->bd_disk->private_data;
if (nvme_submit_bio_queue(nvmeq, ns, bio))
bio_list_add_head(&nvmeq->sq_cong, bio);
else if (bio_list_empty(&nvmeq->sq_cong))
blk_clear_queue_congested(ns->queue, rw_is_sync(bio->bi_rw));
/* XXX: Need to duplicate the logic from __freed_request here */
}

/*
* NB: return value of non-zero would mean that we were a stacking driver.
* make_request must always succeed.
Expand All @@ -403,7 +418,9 @@ static int nvme_make_request(struct request_queue *q, struct bio *bio)

if (nvme_submit_bio_queue(nvmeq, ns, bio)) {
blk_set_queue_congested(q, rw_is_sync(bio->bi_rw));
spin_lock_irq(&nvmeq->q_lock);
bio_list_add(&nvmeq->sq_cong, bio);
spin_unlock_irq(&nvmeq->q_lock);
}
put_nvmeq(nvmeq);

Expand Down

0 comments on commit 574d77b

Please sign in to comment.