aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-09-22 18:00:11 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-22 18:00:11 -0400
commit68cf8d0c720cdb76dc912c983d8dae9de6d6e5cf (patch)
tree41779dfce5cae3dc495f27f76ed8e66dd046ac4c
parent0fbf2cc983ca15208545010863c6536d36a25f3a (diff)
parentf3cff25f05f2ac29b2ee355e611b0657482f6f1d (diff)
Merge branch 'for-3.12/core' of git://git.kernel.dk/linux-block
Pull block IO fixes from Jens Axboe: "After merge window, no new stuff this time only a collection of neatly confined and simple fixes" * 'for-3.12/core' of git://git.kernel.dk/linux-block: cfq: explicitly use 64bit divide operation for 64bit arguments block: Add nr_bios to block_rq_remap tracepoint If the queue is dying then we only call the rq->end_io callout. This leaves bios setup on the request, because the caller assumes when the blk_execute_rq_nowait/blk_execute_rq call has completed that the rq->bios have been cleaned up. bio-integrity: Fix use of bs->bio_integrity_pool after free blkcg: relocate root_blkg setting and clearing block: Convert kmalloc_node(...GFP_ZERO...) to kzalloc_node(...) block: trace all devices plug operation
-rw-r--r--block/blk-cgroup.c25
-rw-r--r--block/blk-core.c6
-rw-r--r--block/blk-exec.c4
-rw-r--r--block/cfq-iosched.c4
-rw-r--r--block/deadline-iosched.c2
-rw-r--r--block/elevator.c2
-rw-r--r--block/genhd.c3
-rw-r--r--fs/bio-integrity.c2
-rw-r--r--include/linux/blkdev.h11
-rw-r--r--include/trace/events/block.h6
10 files changed, 40 insertions, 25 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index e90c7c164c83..4e491d9b5292 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -235,8 +235,13 @@ static struct blkcg_gq *blkg_create(struct blkcg *blkcg,
235 blkg->online = true; 235 blkg->online = true;
236 spin_unlock(&blkcg->lock); 236 spin_unlock(&blkcg->lock);
237 237
238 if (!ret) 238 if (!ret) {
239 if (blkcg == &blkcg_root) {
240 q->root_blkg = blkg;
241 q->root_rl.blkg = blkg;
242 }
239 return blkg; 243 return blkg;
244 }
240 245
241 /* @blkg failed fully initialized, use the usual release path */ 246 /* @blkg failed fully initialized, use the usual release path */
242 blkg_put(blkg); 247 blkg_put(blkg);
@@ -335,6 +340,15 @@ static void blkg_destroy(struct blkcg_gq *blkg)
335 rcu_assign_pointer(blkcg->blkg_hint, NULL); 340 rcu_assign_pointer(blkcg->blkg_hint, NULL);
336 341
337 /* 342 /*
343 * If root blkg is destroyed. Just clear the pointer since root_rl
344 * does not take reference on root blkg.
345 */
346 if (blkcg == &blkcg_root) {
347 blkg->q->root_blkg = NULL;
348 blkg->q->root_rl.blkg = NULL;
349 }
350
351 /*
338 * Put the reference taken at the time of creation so that when all 352 * Put the reference taken at the time of creation so that when all
339 * queues are gone, group can be destroyed. 353 * queues are gone, group can be destroyed.
340 */ 354 */
@@ -360,13 +374,6 @@ static void blkg_destroy_all(struct request_queue *q)
360 blkg_destroy(blkg); 374 blkg_destroy(blkg);
361 spin_unlock(&blkcg->lock); 375 spin_unlock(&blkcg->lock);
362 } 376 }
363
364 /*
365 * root blkg is destroyed. Just clear the pointer since
366 * root_rl does not take reference on root blkg.
367 */
368 q->root_blkg = NULL;
369 q->root_rl.blkg = NULL;
370} 377}
371 378
372/* 379/*
@@ -970,8 +977,6 @@ int blkcg_activate_policy(struct request_queue *q,
970 ret = PTR_ERR(blkg); 977 ret = PTR_ERR(blkg);
971 goto out_unlock; 978 goto out_unlock;
972 } 979 }
973 q->root_blkg = blkg;
974 q->root_rl.blkg = blkg;
975 980
976 list_for_each_entry(blkg, &q->blkg_list, q_node) 981 list_for_each_entry(blkg, &q->blkg_list, q_node)
977 cnt++; 982 cnt++;
diff --git a/block/blk-core.c b/block/blk-core.c
index c04505358342..0a00e4ecf87c 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1549,11 +1549,9 @@ get_rq:
1549 if (plug) { 1549 if (plug) {
1550 /* 1550 /*
1551 * If this is the first request added after a plug, fire 1551 * If this is the first request added after a plug, fire
1552 * of a plug trace. If others have been added before, check 1552 * of a plug trace.
1553 * if we have multiple devices in this plug. If so, make a
1554 * note to sort the list before dispatch.
1555 */ 1553 */
1556 if (list_empty(&plug->list)) 1554 if (!request_count)
1557 trace_block_plug(q); 1555 trace_block_plug(q);
1558 else { 1556 else {
1559 if (request_count >= BLK_MAX_REQUEST_COUNT) { 1557 if (request_count >= BLK_MAX_REQUEST_COUNT) {
diff --git a/block/blk-exec.c b/block/blk-exec.c
index e70621396129..ae4f27d7944e 100644
--- a/block/blk-exec.c
+++ b/block/blk-exec.c
@@ -68,9 +68,9 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk,
68 spin_lock_irq(q->queue_lock); 68 spin_lock_irq(q->queue_lock);
69 69
70 if (unlikely(blk_queue_dying(q))) { 70 if (unlikely(blk_queue_dying(q))) {
71 rq->cmd_flags |= REQ_QUIET;
71 rq->errors = -ENXIO; 72 rq->errors = -ENXIO;
72 if (rq->end_io) 73 __blk_end_request_all(rq, rq->errors);
73 rq->end_io(rq, rq->errors);
74 spin_unlock_irq(q->queue_lock); 74 spin_unlock_irq(q->queue_lock);
75 return; 75 return;
76 } 76 }
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index dabb9d02cf9a..434944cbd761 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1803,7 +1803,7 @@ static u64 cfqg_prfill_avg_queue_size(struct seq_file *sf,
1803 1803
1804 if (samples) { 1804 if (samples) {
1805 v = blkg_stat_read(&cfqg->stats.avg_queue_size_sum); 1805 v = blkg_stat_read(&cfqg->stats.avg_queue_size_sum);
1806 do_div(v, samples); 1806 v = div64_u64(v, samples);
1807 } 1807 }
1808 __blkg_prfill_u64(sf, pd, v); 1808 __blkg_prfill_u64(sf, pd, v);
1809 return 0; 1809 return 0;
@@ -4358,7 +4358,7 @@ static int cfq_init_queue(struct request_queue *q, struct elevator_type *e)
4358 if (!eq) 4358 if (!eq)
4359 return -ENOMEM; 4359 return -ENOMEM;
4360 4360
4361 cfqd = kmalloc_node(sizeof(*cfqd), GFP_KERNEL | __GFP_ZERO, q->node); 4361 cfqd = kzalloc_node(sizeof(*cfqd), GFP_KERNEL, q->node);
4362 if (!cfqd) { 4362 if (!cfqd) {
4363 kobject_put(&eq->kobj); 4363 kobject_put(&eq->kobj);
4364 return -ENOMEM; 4364 return -ENOMEM;
diff --git a/block/deadline-iosched.c b/block/deadline-iosched.c
index 20614a332362..9ef66406c625 100644
--- a/block/deadline-iosched.c
+++ b/block/deadline-iosched.c
@@ -346,7 +346,7 @@ static int deadline_init_queue(struct request_queue *q, struct elevator_type *e)
346 if (!eq) 346 if (!eq)
347 return -ENOMEM; 347 return -ENOMEM;
348 348
349 dd = kmalloc_node(sizeof(*dd), GFP_KERNEL | __GFP_ZERO, q->node); 349 dd = kzalloc_node(sizeof(*dd), GFP_KERNEL, q->node);
350 if (!dd) { 350 if (!dd) {
351 kobject_put(&eq->kobj); 351 kobject_put(&eq->kobj);
352 return -ENOMEM; 352 return -ENOMEM;
diff --git a/block/elevator.c b/block/elevator.c
index 668394d18588..2bcbd8cc14d4 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -155,7 +155,7 @@ struct elevator_queue *elevator_alloc(struct request_queue *q,
155{ 155{
156 struct elevator_queue *eq; 156 struct elevator_queue *eq;
157 157
158 eq = kmalloc_node(sizeof(*eq), GFP_KERNEL | __GFP_ZERO, q->node); 158 eq = kzalloc_node(sizeof(*eq), GFP_KERNEL, q->node);
159 if (unlikely(!eq)) 159 if (unlikely(!eq))
160 goto err; 160 goto err;
161 161
diff --git a/block/genhd.c b/block/genhd.c
index dadf42b454a3..791f41943132 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1252,8 +1252,7 @@ struct gendisk *alloc_disk_node(int minors, int node_id)
1252{ 1252{
1253 struct gendisk *disk; 1253 struct gendisk *disk;
1254 1254
1255 disk = kmalloc_node(sizeof(struct gendisk), 1255 disk = kzalloc_node(sizeof(struct gendisk), GFP_KERNEL, node_id);
1256 GFP_KERNEL | __GFP_ZERO, node_id);
1257 if (disk) { 1256 if (disk) {
1258 if (!init_part_stats(&disk->part0)) { 1257 if (!init_part_stats(&disk->part0)) {
1259 kfree(disk); 1258 kfree(disk);
diff --git a/fs/bio-integrity.c b/fs/bio-integrity.c
index 60250847929f..fc60b31453ee 100644
--- a/fs/bio-integrity.c
+++ b/fs/bio-integrity.c
@@ -735,7 +735,7 @@ void bioset_integrity_free(struct bio_set *bs)
735 mempool_destroy(bs->bio_integrity_pool); 735 mempool_destroy(bs->bio_integrity_pool);
736 736
737 if (bs->bvec_integrity_pool) 737 if (bs->bvec_integrity_pool)
738 mempool_destroy(bs->bio_integrity_pool); 738 mempool_destroy(bs->bvec_integrity_pool);
739} 739}
740EXPORT_SYMBOL(bioset_integrity_free); 740EXPORT_SYMBOL(bioset_integrity_free);
741 741
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 2fdb4a451b49..0e6f765aa1f5 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -862,6 +862,17 @@ static inline unsigned int blk_rq_get_max_sectors(struct request *rq)
862 return blk_queue_get_max_sectors(q, rq->cmd_flags); 862 return blk_queue_get_max_sectors(q, rq->cmd_flags);
863} 863}
864 864
865static inline unsigned int blk_rq_count_bios(struct request *rq)
866{
867 unsigned int nr_bios = 0;
868 struct bio *bio;
869
870 __rq_for_each_bio(bio, rq)
871 nr_bios++;
872
873 return nr_bios;
874}
875
865/* 876/*
866 * Request issue related functions. 877 * Request issue related functions.
867 */ 878 */
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index 60ae7c3db912..4c2301d2ef1a 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -618,6 +618,7 @@ TRACE_EVENT(block_rq_remap,
618 __field( unsigned int, nr_sector ) 618 __field( unsigned int, nr_sector )
619 __field( dev_t, old_dev ) 619 __field( dev_t, old_dev )
620 __field( sector_t, old_sector ) 620 __field( sector_t, old_sector )
621 __field( unsigned int, nr_bios )
621 __array( char, rwbs, RWBS_LEN) 622 __array( char, rwbs, RWBS_LEN)
622 ), 623 ),
623 624
@@ -627,15 +628,16 @@ TRACE_EVENT(block_rq_remap,
627 __entry->nr_sector = blk_rq_sectors(rq); 628 __entry->nr_sector = blk_rq_sectors(rq);
628 __entry->old_dev = dev; 629 __entry->old_dev = dev;
629 __entry->old_sector = from; 630 __entry->old_sector = from;
631 __entry->nr_bios = blk_rq_count_bios(rq);
630 blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq)); 632 blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq));
631 ), 633 ),
632 634
633 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu", 635 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu %u",
634 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, 636 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
635 (unsigned long long)__entry->sector, 637 (unsigned long long)__entry->sector,
636 __entry->nr_sector, 638 __entry->nr_sector,
637 MAJOR(__entry->old_dev), MINOR(__entry->old_dev), 639 MAJOR(__entry->old_dev), MINOR(__entry->old_dev),
638 (unsigned long long)__entry->old_sector) 640 (unsigned long long)__entry->old_sector, __entry->nr_bios)
639); 641);
640 642
641#endif /* _TRACE_BLOCK_H */ 643#endif /* _TRACE_BLOCK_H */