Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 264029
b: refs/heads/master
c: 56ebdaf
h: refs/heads/master
i:
  264027: 1d54492
v: v3
  • Loading branch information
Shaohua Li authored and Jens Axboe committed Aug 24, 2011
1 parent 82245db commit 4c72527
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a63271627521b825b0dd0a564e9a9c62b4c1ca89
refs/heads/master: 56ebdaf2fa3c5276be201c5d1aff1490b682ecf2
13 changes: 7 additions & 6 deletions trunk/block/blk-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@ static bool bio_attempt_front_merge(struct request_queue *q,
* true if merge was successful, otherwise false.
*/
static bool attempt_plug_merge(struct task_struct *tsk, struct request_queue *q,
struct bio *bio)
struct bio *bio, unsigned int *request_count)
{
struct blk_plug *plug;
struct request *rq;
Expand All @@ -1176,10 +1176,13 @@ static bool attempt_plug_merge(struct task_struct *tsk, struct request_queue *q,
plug = tsk->plug;
if (!plug)
goto out;
*request_count = 0;

list_for_each_entry_reverse(rq, &plug->list, queuelist) {
int el_ret;

(*request_count)++;

if (rq->q != q)
continue;

Expand Down Expand Up @@ -1219,6 +1222,7 @@ static int __make_request(struct request_queue *q, struct bio *bio)
struct blk_plug *plug;
int el_ret, rw_flags, where = ELEVATOR_INSERT_SORT;
struct request *req;
unsigned int request_count = 0;

/*
* low level driver can indicate that it wants pages above a
Expand All @@ -1237,7 +1241,7 @@ static int __make_request(struct request_queue *q, struct bio *bio)
* Check if we can merge with the plugged list before grabbing
* any locks.
*/
if (attempt_plug_merge(current, q, bio))
if (attempt_plug_merge(current, q, bio, &request_count))
goto out;

spin_lock_irq(q->queue_lock);
Expand Down Expand Up @@ -1302,9 +1306,8 @@ static int __make_request(struct request_queue *q, struct bio *bio)
if (__rq->q != q)
plug->should_sort = 1;
}
if (plug->count >= BLK_MAX_REQUEST_COUNT)
if (request_count >= BLK_MAX_REQUEST_COUNT)
blk_flush_plug_list(plug, false);
plug->count++;
list_add_tail(&req->queuelist, &plug->list);
drive_stat_acct(req, 1);
} else {
Expand Down Expand Up @@ -2634,7 +2637,6 @@ void blk_start_plug(struct blk_plug *plug)
INIT_LIST_HEAD(&plug->list);
INIT_LIST_HEAD(&plug->cb_list);
plug->should_sort = 0;
plug->count = 0;

/*
* If this is a nested plug, don't actually assign it. It will be
Expand Down Expand Up @@ -2718,7 +2720,6 @@ void blk_flush_plug_list(struct blk_plug *plug, bool from_schedule)
return;

list_splice_init(&plug->list, &list);
plug->count = 0;

if (plug->should_sort) {
list_sort(NULL, &list, plug_rq_cmp);
Expand Down
1 change: 0 additions & 1 deletion trunk/include/linux/blkdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,6 @@ struct blk_plug {
struct list_head list;
struct list_head cb_list;
unsigned int should_sort;
unsigned int count;
};
#define BLK_MAX_REQUEST_COUNT 16

Expand Down

0 comments on commit 4c72527

Please sign in to comment.