aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/cmd-filter.c9
-rw-r--r--fs/block_dev.c10
-rw-r--r--fs/partitions/check.c15
-rw-r--r--include/linux/genhd.h1
4 files changed, 6 insertions, 29 deletions
diff --git a/block/cmd-filter.c b/block/cmd-filter.c
index 79c14996ac11..e669aed4c6bc 100644
--- a/block/cmd-filter.c
+++ b/block/cmd-filter.c
@@ -211,14 +211,10 @@ int blk_register_filter(struct gendisk *disk)
211{ 211{
212 int ret; 212 int ret;
213 struct blk_cmd_filter *filter = &disk->queue->cmd_filter; 213 struct blk_cmd_filter *filter = &disk->queue->cmd_filter;
214 struct kobject *parent = kobject_get(disk->holder_dir->parent);
215 214
216 if (!parent) 215 ret = kobject_init_and_add(&filter->kobj, &rcf_ktype,
217 return -ENODEV; 216 &disk_to_dev(disk)->kobj,
218
219 ret = kobject_init_and_add(&filter->kobj, &rcf_ktype, parent,
220 "%s", "cmd_filter"); 217 "%s", "cmd_filter");
221
222 if (ret < 0) 218 if (ret < 0)
223 return ret; 219 return ret;
224 220
@@ -231,7 +227,6 @@ void blk_unregister_filter(struct gendisk *disk)
231 struct blk_cmd_filter *filter = &disk->queue->cmd_filter; 227 struct blk_cmd_filter *filter = &disk->queue->cmd_filter;
232 228
233 kobject_put(&filter->kobj); 229 kobject_put(&filter->kobj);
234 kobject_put(disk->holder_dir->parent);
235} 230}
236EXPORT_SYMBOL(blk_unregister_filter); 231EXPORT_SYMBOL(blk_unregister_filter);
237#endif 232#endif
diff --git a/fs/block_dev.c b/fs/block_dev.c
index c982a9107979..57d572642854 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -548,14 +548,6 @@ static struct kobject *bdev_get_kobj(struct block_device *bdev)
548 return kobject_get(&disk_to_dev(bdev->bd_disk)->kobj); 548 return kobject_get(&disk_to_dev(bdev->bd_disk)->kobj);
549} 549}
550 550
551static struct kobject *bdev_get_holder(struct block_device *bdev)
552{
553 if (bdev->bd_contains != bdev)
554 return kobject_get(bdev->bd_part->holder_dir);
555 else
556 return kobject_get(bdev->bd_disk->holder_dir);
557}
558
559static int add_symlink(struct kobject *from, struct kobject *to) 551static int add_symlink(struct kobject *from, struct kobject *to)
560{ 552{
561 if (!from || !to) 553 if (!from || !to)
@@ -608,7 +600,7 @@ static int bd_holder_grab_dirs(struct block_device *bdev,
608 if (!bo->sdev) 600 if (!bo->sdev)
609 goto fail_put_hdev; 601 goto fail_put_hdev;
610 602
611 bo->hdir = bdev_get_holder(bdev); 603 bo->hdir = kobject_get(bdev->bd_part->holder_dir);
612 if (!bo->hdir) 604 if (!bo->hdir)
613 goto fail_put_sdev; 605 goto fail_put_sdev;
614 606
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index ace6d03602c7..f0f604950ff4 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -305,16 +305,6 @@ struct device_type part_type = {
305 .release = part_release, 305 .release = part_release,
306}; 306};
307 307
308static inline void disk_sysfs_add_subdirs(struct gendisk *disk)
309{
310 struct kobject *k;
311
312 k = kobject_get(&disk_to_dev(disk)->kobj);
313 disk->holder_dir = kobject_create_and_add("holders", k);
314 disk->slave_dir = kobject_create_and_add("slaves", k);
315 kobject_put(k);
316}
317
318static void delete_partition_rcu_cb(struct rcu_head *head) 308static void delete_partition_rcu_cb(struct rcu_head *head)
319{ 309{
320 struct hd_struct *part = container_of(head, struct hd_struct, rcu_head); 310 struct hd_struct *part = container_of(head, struct hd_struct, rcu_head);
@@ -464,7 +454,8 @@ void register_disk(struct gendisk *disk)
464 return; 454 return;
465 } 455 }
466#endif 456#endif
467 disk_sysfs_add_subdirs(disk); 457 disk->part0.holder_dir = kobject_create_and_add("holders", &ddev->kobj);
458 disk->slave_dir = kobject_create_and_add("slaves", &ddev->kobj);
468 459
469 /* No minors to use for partitions */ 460 /* No minors to use for partitions */
470 if (!disk_partitionable(disk)) 461 if (!disk_partitionable(disk))
@@ -592,7 +583,7 @@ void del_gendisk(struct gendisk *disk)
592 disk_stat_set_all(disk, 0); 583 disk_stat_set_all(disk, 0);
593 disk->stamp = 0; 584 disk->stamp = 0;
594 585
595 kobject_put(disk->holder_dir); 586 kobject_put(disk->part0.holder_dir);
596 kobject_put(disk->slave_dir); 587 kobject_put(disk->slave_dir);
597 disk->driverfs_dev = NULL; 588 disk->driverfs_dev = NULL;
598#ifndef CONFIG_SYSFS_DEPRECATED 589#ifndef CONFIG_SYSFS_DEPRECATED
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 4411bdd671dd..2c0e1b597ab4 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -141,7 +141,6 @@ struct gendisk {
141 141
142 int flags; 142 int flags;
143 struct device *driverfs_dev; // FIXME: remove 143 struct device *driverfs_dev; // FIXME: remove
144 struct kobject *holder_dir;
145 struct kobject *slave_dir; 144 struct kobject *slave_dir;
146 145
147 struct timer_rand_state *random; 146 struct timer_rand_state *random;