diff options
author | Ming Lei <tom.leiming@gmail.com> | 2015-07-15 23:16:45 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2015-07-17 10:41:53 -0400 |
commit | 6c71013ecb7e2bddbed9f5b95e7aed22c491daa9 (patch) | |
tree | 773a3ebe4289815e677ce2b357c665cba5292c0e /block/genhd.c | |
parent | b54e5ed8f285d62c0d242c4ef9da90937994db02 (diff) |
block: partition: convert percpu ref
Percpu refcount is the perfect match for partition's case,
and the conversion is quite straight.
With the convertion, one pair of atomic inc/dec can be saved
for accounting block I/O, which is run in hot path of block I/O.
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/genhd.c')
-rw-r--r-- | block/genhd.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/block/genhd.c b/block/genhd.c index 85df45292dba..0c706f33a599 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -1284,7 +1284,11 @@ struct gendisk *alloc_disk_node(int minors, int node_id) | |||
1284 | * converted to make use of bd_mutex and sequence counters. | 1284 | * converted to make use of bd_mutex and sequence counters. |
1285 | */ | 1285 | */ |
1286 | seqcount_init(&disk->part0.nr_sects_seq); | 1286 | seqcount_init(&disk->part0.nr_sects_seq); |
1287 | hd_ref_init(&disk->part0); | 1287 | if (hd_ref_init(&disk->part0)) { |
1288 | hd_free_part(&disk->part0); | ||
1289 | kfree(disk); | ||
1290 | return NULL; | ||
1291 | } | ||
1288 | 1292 | ||
1289 | disk->minors = minors; | 1293 | disk->minors = minors; |
1290 | rand_initialize_disk(disk); | 1294 | rand_initialize_disk(disk); |