aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorJens Axboe <jaxboe@fusionio.com>2011-01-07 02:43:37 -0500
committerJens Axboe <jaxboe@fusionio.com>2011-01-07 02:43:37 -0500
commit6c23a9681c0fe7fb7dd331b39dda11926f43746e (patch)
treebf113a475a17faa866e7e59806378107dcb3aa40 /block
parent09e099d4bafea3b15be003d548bdf94b4b6e0e17 (diff)
block: add internal hd part table references
We can't use krefs since it's apparently restricted to very basic reference counting. This reverts commit e4a683c8. Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'block')
-rw-r--r--block/blk-core.c6
-rw-r--r--block/blk-merge.c2
-rw-r--r--block/genhd.c3
3 files changed, 6 insertions, 5 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 500c080a6a6b..2f4002f79a24 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -70,7 +70,7 @@ static void drive_stat_acct(struct request *rq, int new_io)
70 part_stat_inc(cpu, part, merges[rw]); 70 part_stat_inc(cpu, part, merges[rw]);
71 } else { 71 } else {
72 part = disk_map_sector_rcu(rq->rq_disk, blk_rq_pos(rq)); 72 part = disk_map_sector_rcu(rq->rq_disk, blk_rq_pos(rq));
73 if (!kref_test_and_get(&part->ref)) { 73 if (!hd_struct_try_get(part)) {
74 /* 74 /*
75 * The partition is already being removed, 75 * The partition is already being removed,
76 * the request will be accounted on the disk only 76 * the request will be accounted on the disk only
@@ -80,7 +80,7 @@ static void drive_stat_acct(struct request *rq, int new_io)
80 * it as any other partition. 80 * it as any other partition.
81 */ 81 */
82 part = &rq->rq_disk->part0; 82 part = &rq->rq_disk->part0;
83 kref_get(&part->ref); 83 hd_struct_get(part);
84 } 84 }
85 part_round_stats(cpu, part); 85 part_round_stats(cpu, part);
86 part_inc_in_flight(part, rw); 86 part_inc_in_flight(part, rw);
@@ -1818,7 +1818,7 @@ static void blk_account_io_done(struct request *req)
1818 part_round_stats(cpu, part); 1818 part_round_stats(cpu, part);
1819 part_dec_in_flight(part, rw); 1819 part_dec_in_flight(part, rw);
1820 1820
1821 kref_put(&part->ref, __delete_partition); 1821 hd_struct_put(part);
1822 part_stat_unlock(); 1822 part_stat_unlock();
1823 } 1823 }
1824} 1824}
diff --git a/block/blk-merge.c b/block/blk-merge.c
index b06b83b89d89..00b7d31b38a2 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -356,7 +356,7 @@ static void blk_account_io_merge(struct request *req)
356 part_round_stats(cpu, part); 356 part_round_stats(cpu, part);
357 part_dec_in_flight(part, rq_data_dir(req)); 357 part_dec_in_flight(part, rq_data_dir(req));
358 358
359 kref_put(&part->ref, __delete_partition); 359 hd_struct_put(part);
360 part_stat_unlock(); 360 part_stat_unlock();
361 } 361 }
362} 362}
diff --git a/block/genhd.c b/block/genhd.c
index 85c150598830..399d37ec7412 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1192,7 +1192,8 @@ struct gendisk *alloc_disk_node(int minors, int node_id)
1192 return NULL; 1192 return NULL;
1193 } 1193 }
1194 disk->part_tbl->part[0] = &disk->part0; 1194 disk->part_tbl->part[0] = &disk->part0;
1195 kref_init(&disk->part0.ref); 1195
1196 hd_ref_init(&disk->part0);
1196 1197
1197 disk->minors = minors; 1198 disk->minors = minors;
1198 rand_initialize_disk(disk); 1199 rand_initialize_disk(disk);