aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-17 12:29:55 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-17 12:29:55 -0400
commitc53dbf54863e7f3b0b8810dda2bdd0290006bdac (patch)
treef783074f1bec1112bf1148a077e0114a38403ad4 /block
parentb73b636e8987f8728c6c700377615757691b9a55 (diff)
parentf73e2d13a16cc88c4faa4729967f92bfeec8a142 (diff)
Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
* 'for-linus' of git://git.kernel.dk/linux-2.6-block: block: remove __generic_unplug_device() from exports block: move q->unplug_work initialization blktrace: pass zfcp driver data blktrace: add support for driver data block: fix current kernel-doc warnings block: only call ->request_fn when the queue is not stopped block: simplify string handling in elv_iosched_store() block: fix kernel-doc for blk_alloc_devt() block: fix nr_phys_segments miscalculation bug block: add partition attribute for partition number block: add BIG FAT WARNING to CONFIG_DEBUG_BLOCK_EXT_DEVT softirq: Add support for triggering softirq work on softirqs.
Diffstat (limited to 'block')
-rw-r--r--block/blk-core.c26
-rw-r--r--block/blk-merge.c20
-rw-r--r--block/blk-settings.c2
-rw-r--r--block/blk.h1
-rw-r--r--block/elevator.c16
-rw-r--r--block/genhd.c3
6 files changed, 46 insertions, 22 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 9e79a485e4f3..c3df30cfb3fc 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -257,7 +257,6 @@ void __generic_unplug_device(struct request_queue *q)
257 257
258 q->request_fn(q); 258 q->request_fn(q);
259} 259}
260EXPORT_SYMBOL(__generic_unplug_device);
261 260
262/** 261/**
263 * generic_unplug_device - fire a request queue 262 * generic_unplug_device - fire a request queue
@@ -325,6 +324,9 @@ EXPORT_SYMBOL(blk_unplug);
325 324
326static void blk_invoke_request_fn(struct request_queue *q) 325static void blk_invoke_request_fn(struct request_queue *q)
327{ 326{
327 if (unlikely(blk_queue_stopped(q)))
328 return;
329
328 /* 330 /*
329 * one level of recursion is ok and is much faster than kicking 331 * one level of recursion is ok and is much faster than kicking
330 * the unplug handling 332 * the unplug handling
@@ -399,8 +401,13 @@ void blk_sync_queue(struct request_queue *q)
399EXPORT_SYMBOL(blk_sync_queue); 401EXPORT_SYMBOL(blk_sync_queue);
400 402
401/** 403/**
402 * blk_run_queue - run a single device queue 404 * __blk_run_queue - run a single device queue
403 * @q: The queue to run 405 * @q: The queue to run
406 *
407 * Description:
408 * See @blk_run_queue. This variant must be called with the queue lock
409 * held and interrupts disabled.
410 *
404 */ 411 */
405void __blk_run_queue(struct request_queue *q) 412void __blk_run_queue(struct request_queue *q)
406{ 413{
@@ -418,6 +425,12 @@ EXPORT_SYMBOL(__blk_run_queue);
418/** 425/**
419 * blk_run_queue - run a single device queue 426 * blk_run_queue - run a single device queue
420 * @q: The queue to run 427 * @q: The queue to run
428 *
429 * Description:
430 * Invoke request handling on this queue, if it has pending work to do.
431 * May be used to restart queueing when a request has completed. Also
432 * See @blk_start_queueing.
433 *
421 */ 434 */
422void blk_run_queue(struct request_queue *q) 435void blk_run_queue(struct request_queue *q)
423{ 436{
@@ -501,6 +514,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
501 init_timer(&q->unplug_timer); 514 init_timer(&q->unplug_timer);
502 setup_timer(&q->timeout, blk_rq_timed_out_timer, (unsigned long) q); 515 setup_timer(&q->timeout, blk_rq_timed_out_timer, (unsigned long) q);
503 INIT_LIST_HEAD(&q->timeout_list); 516 INIT_LIST_HEAD(&q->timeout_list);
517 INIT_WORK(&q->unplug_work, blk_unplug_work);
504 518
505 kobject_init(&q->kobj, &blk_queue_ktype); 519 kobject_init(&q->kobj, &blk_queue_ktype);
506 520
@@ -884,7 +898,8 @@ EXPORT_SYMBOL(blk_get_request);
884 * 898 *
885 * This is basically a helper to remove the need to know whether a queue 899 * This is basically a helper to remove the need to know whether a queue
886 * is plugged or not if someone just wants to initiate dispatch of requests 900 * is plugged or not if someone just wants to initiate dispatch of requests
887 * for this queue. 901 * for this queue. Should be used to start queueing on a device outside
902 * of ->request_fn() context. Also see @blk_run_queue.
888 * 903 *
889 * The queue lock must be held with interrupts disabled. 904 * The queue lock must be held with interrupts disabled.
890 */ 905 */
@@ -1003,8 +1018,9 @@ static void part_round_stats_single(int cpu, struct hd_struct *part,
1003} 1018}
1004 1019
1005/** 1020/**
1006 * part_round_stats() - Round off the performance stats on a struct 1021 * part_round_stats() - Round off the performance stats on a struct disk_stats.
1007 * disk_stats. 1022 * @cpu: cpu number for stats access
1023 * @part: target partition
1008 * 1024 *
1009 * The average IO queue length and utilisation statistics are maintained 1025 * The average IO queue length and utilisation statistics are maintained
1010 * by observing the current state of the queue length and the amount of 1026 * by observing the current state of the queue length and the amount of
diff --git a/block/blk-merge.c b/block/blk-merge.c
index 908d3e11ac52..8681cd6f9911 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -77,12 +77,20 @@ void blk_recalc_rq_segments(struct request *rq)
77 continue; 77 continue;
78 } 78 }
79new_segment: 79new_segment:
80 if (nr_phys_segs == 1 && seg_size > rq->bio->bi_seg_front_size)
81 rq->bio->bi_seg_front_size = seg_size;
82
80 nr_phys_segs++; 83 nr_phys_segs++;
81 bvprv = bv; 84 bvprv = bv;
82 seg_size = bv->bv_len; 85 seg_size = bv->bv_len;
83 highprv = high; 86 highprv = high;
84 } 87 }
85 88
89 if (nr_phys_segs == 1 && seg_size > rq->bio->bi_seg_front_size)
90 rq->bio->bi_seg_front_size = seg_size;
91 if (seg_size > rq->biotail->bi_seg_back_size)
92 rq->biotail->bi_seg_back_size = seg_size;
93
86 rq->nr_phys_segments = nr_phys_segs; 94 rq->nr_phys_segments = nr_phys_segs;
87} 95}
88 96
@@ -106,7 +114,8 @@ static int blk_phys_contig_segment(struct request_queue *q, struct bio *bio,
106 if (!test_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags)) 114 if (!test_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags))
107 return 0; 115 return 0;
108 116
109 if (bio->bi_size + nxt->bi_size > q->max_segment_size) 117 if (bio->bi_seg_back_size + nxt->bi_seg_front_size >
118 q->max_segment_size)
110 return 0; 119 return 0;
111 120
112 if (!bio_has_data(bio)) 121 if (!bio_has_data(bio))
@@ -309,6 +318,8 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req,
309 struct request *next) 318 struct request *next)
310{ 319{
311 int total_phys_segments; 320 int total_phys_segments;
321 unsigned int seg_size =
322 req->biotail->bi_seg_back_size + next->bio->bi_seg_front_size;
312 323
313 /* 324 /*
314 * First check if the either of the requests are re-queued 325 * First check if the either of the requests are re-queued
@@ -324,8 +335,13 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req,
324 return 0; 335 return 0;
325 336
326 total_phys_segments = req->nr_phys_segments + next->nr_phys_segments; 337 total_phys_segments = req->nr_phys_segments + next->nr_phys_segments;
327 if (blk_phys_contig_segment(q, req->biotail, next->bio)) 338 if (blk_phys_contig_segment(q, req->biotail, next->bio)) {
339 if (req->nr_phys_segments == 1)
340 req->bio->bi_seg_front_size = seg_size;
341 if (next->nr_phys_segments == 1)
342 next->biotail->bi_seg_back_size = seg_size;
328 total_phys_segments--; 343 total_phys_segments--;
344 }
329 345
330 if (total_phys_segments > q->max_phys_segments) 346 if (total_phys_segments > q->max_phys_segments)
331 return 0; 347 return 0;
diff --git a/block/blk-settings.c b/block/blk-settings.c
index b21dcdb64151..41392fbe19ff 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -141,8 +141,6 @@ void blk_queue_make_request(struct request_queue *q, make_request_fn *mfn)
141 if (q->unplug_delay == 0) 141 if (q->unplug_delay == 0)
142 q->unplug_delay = 1; 142 q->unplug_delay = 1;
143 143
144 INIT_WORK(&q->unplug_work, blk_unplug_work);
145
146 q->unplug_timer.function = blk_unplug_timeout; 144 q->unplug_timer.function = blk_unplug_timeout;
147 q->unplug_timer.data = (unsigned long)q; 145 q->unplug_timer.data = (unsigned long)q;
148 146
diff --git a/block/blk.h b/block/blk.h
index e5c579769963..d2e49af90db5 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -20,6 +20,7 @@ void blk_unplug_timeout(unsigned long data);
20void blk_rq_timed_out_timer(unsigned long data); 20void blk_rq_timed_out_timer(unsigned long data);
21void blk_delete_timer(struct request *); 21void blk_delete_timer(struct request *);
22void blk_add_timer(struct request *); 22void blk_add_timer(struct request *);
23void __generic_unplug_device(struct request_queue *);
23 24
24/* 25/*
25 * Internal atomic flags for request handling 26 * Internal atomic flags for request handling
diff --git a/block/elevator.c b/block/elevator.c
index 04518921db31..59173a69ebdf 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -612,7 +612,7 @@ void elv_insert(struct request_queue *q, struct request *rq, int where)
612 * processing. 612 * processing.
613 */ 613 */
614 blk_remove_plug(q); 614 blk_remove_plug(q);
615 q->request_fn(q); 615 blk_start_queueing(q);
616 break; 616 break;
617 617
618 case ELEVATOR_INSERT_SORT: 618 case ELEVATOR_INSERT_SORT:
@@ -950,7 +950,7 @@ void elv_completed_request(struct request_queue *q, struct request *rq)
950 blk_ordered_cur_seq(q) == QUEUE_ORDSEQ_DRAIN && 950 blk_ordered_cur_seq(q) == QUEUE_ORDSEQ_DRAIN &&
951 blk_ordered_req_seq(first_rq) > QUEUE_ORDSEQ_DRAIN) { 951 blk_ordered_req_seq(first_rq) > QUEUE_ORDSEQ_DRAIN) {
952 blk_ordered_complete_seq(q, QUEUE_ORDSEQ_DRAIN, 0); 952 blk_ordered_complete_seq(q, QUEUE_ORDSEQ_DRAIN, 0);
953 q->request_fn(q); 953 blk_start_queueing(q);
954 } 954 }
955 } 955 }
956} 956}
@@ -1109,8 +1109,7 @@ static int elevator_switch(struct request_queue *q, struct elevator_type *new_e)
1109 elv_drain_elevator(q); 1109 elv_drain_elevator(q);
1110 1110
1111 while (q->rq.elvpriv) { 1111 while (q->rq.elvpriv) {
1112 blk_remove_plug(q); 1112 blk_start_queueing(q);
1113 q->request_fn(q);
1114 spin_unlock_irq(q->queue_lock); 1113 spin_unlock_irq(q->queue_lock);
1115 msleep(10); 1114 msleep(10);
1116 spin_lock_irq(q->queue_lock); 1115 spin_lock_irq(q->queue_lock);
@@ -1166,15 +1165,10 @@ ssize_t elv_iosched_store(struct request_queue *q, const char *name,
1166 size_t count) 1165 size_t count)
1167{ 1166{
1168 char elevator_name[ELV_NAME_MAX]; 1167 char elevator_name[ELV_NAME_MAX];
1169 size_t len;
1170 struct elevator_type *e; 1168 struct elevator_type *e;
1171 1169
1172 elevator_name[sizeof(elevator_name) - 1] = '\0'; 1170 strlcpy(elevator_name, name, sizeof(elevator_name));
1173 strncpy(elevator_name, name, sizeof(elevator_name) - 1); 1171 strstrip(elevator_name);
1174 len = strlen(elevator_name);
1175
1176 if (len && elevator_name[len - 1] == '\n')
1177 elevator_name[len - 1] = '\0';
1178 1172
1179 e = elevator_get(elevator_name); 1173 e = elevator_get(elevator_name);
1180 if (!e) { 1174 if (!e) {
diff --git a/block/genhd.c b/block/genhd.c
index 4cd3433c99ac..646e1d2507c7 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -358,7 +358,6 @@ static int blk_mangle_minor(int minor)
358/** 358/**
359 * blk_alloc_devt - allocate a dev_t for a partition 359 * blk_alloc_devt - allocate a dev_t for a partition
360 * @part: partition to allocate dev_t for 360 * @part: partition to allocate dev_t for
361 * @gfp_mask: memory allocation flag
362 * @devt: out parameter for resulting dev_t 361 * @devt: out parameter for resulting dev_t
363 * 362 *
364 * Allocate a dev_t for block device. 363 * Allocate a dev_t for block device.
@@ -535,7 +534,7 @@ void unlink_gendisk(struct gendisk *disk)
535/** 534/**
536 * get_gendisk - get partitioning information for a given device 535 * get_gendisk - get partitioning information for a given device
537 * @devt: device to get partitioning information for 536 * @devt: device to get partitioning information for
538 * @part: returned partition index 537 * @partno: returned partition index
539 * 538 *
540 * This function gets the structure containing partitioning 539 * This function gets the structure containing partitioning
541 * information for the given device @devt. 540 * information for the given device @devt.