Commit 48813c1e authored by Jens Axboe's avatar Jens Axboe Committed by Linus Torvalds

[PATCH] blk: move threshold unplugging

The 'unplug on queued exceeding unplug threshold' logic only works for file
system requests currently, since it's in __make_request().  Move it where
it belongs, in elv_add_request().  This way it works for queued block sg
requests as well.
Signed-Off-By: default avatarJens Axboe <axboe@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 2c257a5a
...@@ -181,6 +181,14 @@ void __elv_add_request(request_queue_t *q, struct request *rq, int where, ...@@ -181,6 +181,14 @@ void __elv_add_request(request_queue_t *q, struct request *rq, int where,
rq->q = q; rq->q = q;
q->elevator.elevator_add_req_fn(q, rq, where); q->elevator.elevator_add_req_fn(q, rq, where);
if (blk_queue_plugged(q)) {
int nrq = q->rq.count[READ] + q->rq.count[WRITE] - q->in_flight;
if (nrq == q->unplug_thresh)
__generic_unplug_device(q);
}
} }
void elv_add_request(request_queue_t *q, struct request *rq, int where, void elv_add_request(request_queue_t *q, struct request *rq, int where,
......
...@@ -1123,7 +1123,7 @@ EXPORT_SYMBOL(blk_remove_plug); ...@@ -1123,7 +1123,7 @@ EXPORT_SYMBOL(blk_remove_plug);
/* /*
* remove the plug and let it rip.. * remove the plug and let it rip..
*/ */
static inline void __generic_unplug_device(request_queue_t *q) inline void __generic_unplug_device(request_queue_t *q)
{ {
if (test_bit(QUEUE_FLAG_STOPPED, &q->queue_flags)) if (test_bit(QUEUE_FLAG_STOPPED, &q->queue_flags))
return; return;
...@@ -1137,6 +1137,7 @@ static inline void __generic_unplug_device(request_queue_t *q) ...@@ -1137,6 +1137,7 @@ static inline void __generic_unplug_device(request_queue_t *q)
if (elv_next_request(q)) if (elv_next_request(q))
q->request_fn(q); q->request_fn(q);
} }
EXPORT_SYMBOL(__generic_unplug_device);
/** /**
* generic_unplug_device - fire a request queue * generic_unplug_device - fire a request queue
...@@ -2280,13 +2281,9 @@ static int __make_request(request_queue_t *q, struct bio *bio) ...@@ -2280,13 +2281,9 @@ static int __make_request(request_queue_t *q, struct bio *bio)
out: out:
if (freereq) if (freereq)
__blk_put_request(q, freereq); __blk_put_request(q, freereq);
if (bio_sync(bio))
if (blk_queue_plugged(q)) {
int nrq = q->rq.count[READ] + q->rq.count[WRITE] - q->in_flight;
if (nrq == q->unplug_thresh || bio_sync(bio))
__generic_unplug_device(q); __generic_unplug_device(q);
}
spin_unlock_irq(q->queue_lock); spin_unlock_irq(q->queue_lock);
return 0; return 0;
......
...@@ -592,6 +592,7 @@ extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bd ...@@ -592,6 +592,7 @@ extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bd
extern int blk_rq_map_sg(request_queue_t *, struct request *, struct scatterlist *); extern int blk_rq_map_sg(request_queue_t *, struct request *, struct scatterlist *);
extern void blk_dump_rq_flags(struct request *, char *); extern void blk_dump_rq_flags(struct request *, char *);
extern void generic_unplug_device(request_queue_t *); extern void generic_unplug_device(request_queue_t *);
extern inline void __generic_unplug_device(request_queue_t *);
extern long nr_blockdev_pages(void); extern long nr_blockdev_pages(void);
int blk_get_queue(request_queue_t *); int blk_get_queue(request_queue_t *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment