Skip to content

Commit 68cf8d0

Browse files
committed
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
2 parents 0fbf2cc + f3cff25 commit 68cf8d0

File tree

10 files changed

+40
-25
lines changed

10 files changed

+40
-25
lines changed

block/blk-cgroup.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,13 @@ static struct blkcg_gq *blkg_create(struct blkcg *blkcg,
235235
blkg->online = true;
236236
spin_unlock(&blkcg->lock);
237237

238-
if (!ret)
238+
if (!ret) {
239+
if (blkcg == &blkcg_root) {
240+
q->root_blkg = blkg;
241+
q->root_rl.blkg = blkg;
242+
}
239243
return blkg;
244+
}
240245

241246
/* @blkg failed fully initialized, use the usual release path */
242247
blkg_put(blkg);
@@ -334,6 +339,15 @@ static void blkg_destroy(struct blkcg_gq *blkg)
334339
if (rcu_dereference_raw(blkcg->blkg_hint) == blkg)
335340
rcu_assign_pointer(blkcg->blkg_hint, NULL);
336341

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+
337351
/*
338352
* Put the reference taken at the time of creation so that when all
339353
* queues are gone, group can be destroyed.
@@ -360,13 +374,6 @@ static void blkg_destroy_all(struct request_queue *q)
360374
blkg_destroy(blkg);
361375
spin_unlock(&blkcg->lock);
362376
}
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;
370377
}
371378

372379
/*
@@ -970,8 +977,6 @@ int blkcg_activate_policy(struct request_queue *q,
970977
ret = PTR_ERR(blkg);
971978
goto out_unlock;
972979
}
973-
q->root_blkg = blkg;
974-
q->root_rl.blkg = blkg;
975980

976981
list_for_each_entry(blkg, &q->blkg_list, q_node)
977982
cnt++;

block/blk-core.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,11 +1549,9 @@ void blk_queue_bio(struct request_queue *q, struct bio *bio)
15491549
if (plug) {
15501550
/*
15511551
* If this is the first request added after a plug, fire
1552-
* of a plug trace. If others have been added before, check
1553-
* if we have multiple devices in this plug. If so, make a
1554-
* note to sort the list before dispatch.
1552+
* of a plug trace.
15551553
*/
1556-
if (list_empty(&plug->list))
1554+
if (!request_count)
15571555
trace_block_plug(q);
15581556
else {
15591557
if (request_count >= BLK_MAX_REQUEST_COUNT) {

block/blk-exec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk,
6868
spin_lock_irq(q->queue_lock);
6969

7070
if (unlikely(blk_queue_dying(q))) {
71+
rq->cmd_flags |= REQ_QUIET;
7172
rq->errors = -ENXIO;
72-
if (rq->end_io)
73-
rq->end_io(rq, rq->errors);
73+
__blk_end_request_all(rq, rq->errors);
7474
spin_unlock_irq(q->queue_lock);
7575
return;
7676
}

block/cfq-iosched.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1803,7 +1803,7 @@ static u64 cfqg_prfill_avg_queue_size(struct seq_file *sf,
18031803

18041804
if (samples) {
18051805
v = blkg_stat_read(&cfqg->stats.avg_queue_size_sum);
1806-
do_div(v, samples);
1806+
v = div64_u64(v, samples);
18071807
}
18081808
__blkg_prfill_u64(sf, pd, v);
18091809
return 0;
@@ -4358,7 +4358,7 @@ static int cfq_init_queue(struct request_queue *q, struct elevator_type *e)
43584358
if (!eq)
43594359
return -ENOMEM;
43604360

4361-
cfqd = kmalloc_node(sizeof(*cfqd), GFP_KERNEL | __GFP_ZERO, q->node);
4361+
cfqd = kzalloc_node(sizeof(*cfqd), GFP_KERNEL, q->node);
43624362
if (!cfqd) {
43634363
kobject_put(&eq->kobj);
43644364
return -ENOMEM;

block/deadline-iosched.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ static int deadline_init_queue(struct request_queue *q, struct elevator_type *e)
346346
if (!eq)
347347
return -ENOMEM;
348348

349-
dd = kmalloc_node(sizeof(*dd), GFP_KERNEL | __GFP_ZERO, q->node);
349+
dd = kzalloc_node(sizeof(*dd), GFP_KERNEL, q->node);
350350
if (!dd) {
351351
kobject_put(&eq->kobj);
352352
return -ENOMEM;

block/elevator.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ struct elevator_queue *elevator_alloc(struct request_queue *q,
155155
{
156156
struct elevator_queue *eq;
157157

158-
eq = kmalloc_node(sizeof(*eq), GFP_KERNEL | __GFP_ZERO, q->node);
158+
eq = kzalloc_node(sizeof(*eq), GFP_KERNEL, q->node);
159159
if (unlikely(!eq))
160160
goto err;
161161

block/genhd.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,8 +1252,7 @@ struct gendisk *alloc_disk_node(int minors, int node_id)
12521252
{
12531253
struct gendisk *disk;
12541254

1255-
disk = kmalloc_node(sizeof(struct gendisk),
1256-
GFP_KERNEL | __GFP_ZERO, node_id);
1255+
disk = kzalloc_node(sizeof(struct gendisk), GFP_KERNEL, node_id);
12571256
if (disk) {
12581257
if (!init_part_stats(&disk->part0)) {
12591258
kfree(disk);

fs/bio-integrity.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ void bioset_integrity_free(struct bio_set *bs)
735735
mempool_destroy(bs->bio_integrity_pool);
736736

737737
if (bs->bvec_integrity_pool)
738-
mempool_destroy(bs->bio_integrity_pool);
738+
mempool_destroy(bs->bvec_integrity_pool);
739739
}
740740
EXPORT_SYMBOL(bioset_integrity_free);
741741

include/linux/blkdev.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,17 @@ static inline unsigned int blk_rq_get_max_sectors(struct request *rq)
862862
return blk_queue_get_max_sectors(q, rq->cmd_flags);
863863
}
864864

865+
static 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+
865876
/*
866877
* Request issue related functions.
867878
*/

include/trace/events/block.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,7 @@ TRACE_EVENT(block_rq_remap,
618618
__field( unsigned int, nr_sector )
619619
__field( dev_t, old_dev )
620620
__field( sector_t, old_sector )
621+
__field( unsigned int, nr_bios )
621622
__array( char, rwbs, RWBS_LEN)
622623
),
623624

@@ -627,15 +628,16 @@ TRACE_EVENT(block_rq_remap,
627628
__entry->nr_sector = blk_rq_sectors(rq);
628629
__entry->old_dev = dev;
629630
__entry->old_sector = from;
631+
__entry->nr_bios = blk_rq_count_bios(rq);
630632
blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq));
631633
),
632634

633-
TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
635+
TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu %u",
634636
MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
635637
(unsigned long long)__entry->sector,
636638
__entry->nr_sector,
637639
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)
639641
);
640642

641643
#endif /* _TRACE_BLOCK_H */

0 commit comments

Comments
 (0)