diff options
author | Jens Axboe <jaxboe@fusionio.com> | 2011-01-13 08:47:54 -0500 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2011-01-13 08:47:54 -0500 |
commit | 81c5e2ae33c4b19e53966b427e33646bf6811830 (patch) | |
tree | a602a6dd100165c8948bfa713e6f0b422dcba5d8 /fs/partitions/check.c | |
parent | 797a455d2c682476c3797dbfecf5bf84c1e3b9d3 (diff) | |
parent | fcc57045d53edc35bcce456e60ac4aa802712934 (diff) |
Merge branch 'for-2.6.38/event-handling' into for-2.6.38/core
Diffstat (limited to 'fs/partitions/check.c')
-rw-r--r-- | fs/partitions/check.c | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 011520df71ae..9c21119512b9 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c | |||
@@ -522,65 +522,6 @@ out_put: | |||
522 | return ERR_PTR(err); | 522 | return ERR_PTR(err); |
523 | } | 523 | } |
524 | 524 | ||
525 | /* Not exported, helper to add_disk(). */ | ||
526 | void register_disk(struct gendisk *disk) | ||
527 | { | ||
528 | struct device *ddev = disk_to_dev(disk); | ||
529 | struct block_device *bdev; | ||
530 | struct disk_part_iter piter; | ||
531 | struct hd_struct *part; | ||
532 | int err; | ||
533 | |||
534 | ddev->parent = disk->driverfs_dev; | ||
535 | |||
536 | dev_set_name(ddev, disk->disk_name); | ||
537 | |||
538 | /* delay uevents, until we scanned partition table */ | ||
539 | dev_set_uevent_suppress(ddev, 1); | ||
540 | |||
541 | if (device_add(ddev)) | ||
542 | return; | ||
543 | if (!sysfs_deprecated) { | ||
544 | err = sysfs_create_link(block_depr, &ddev->kobj, | ||
545 | kobject_name(&ddev->kobj)); | ||
546 | if (err) { | ||
547 | device_del(ddev); | ||
548 | return; | ||
549 | } | ||
550 | } | ||
551 | disk->part0.holder_dir = kobject_create_and_add("holders", &ddev->kobj); | ||
552 | disk->slave_dir = kobject_create_and_add("slaves", &ddev->kobj); | ||
553 | |||
554 | /* No minors to use for partitions */ | ||
555 | if (!disk_partitionable(disk)) | ||
556 | goto exit; | ||
557 | |||
558 | /* No such device (e.g., media were just removed) */ | ||
559 | if (!get_capacity(disk)) | ||
560 | goto exit; | ||
561 | |||
562 | bdev = bdget_disk(disk, 0); | ||
563 | if (!bdev) | ||
564 | goto exit; | ||
565 | |||
566 | bdev->bd_invalidated = 1; | ||
567 | err = blkdev_get(bdev, FMODE_READ, NULL); | ||
568 | if (err < 0) | ||
569 | goto exit; | ||
570 | blkdev_put(bdev, FMODE_READ); | ||
571 | |||
572 | exit: | ||
573 | /* announce disk after possible partitions are created */ | ||
574 | dev_set_uevent_suppress(ddev, 0); | ||
575 | kobject_uevent(&ddev->kobj, KOBJ_ADD); | ||
576 | |||
577 | /* announce possible partitions */ | ||
578 | disk_part_iter_init(&piter, disk, 0); | ||
579 | while ((part = disk_part_iter_next(&piter))) | ||
580 | kobject_uevent(&part_to_dev(part)->kobj, KOBJ_ADD); | ||
581 | disk_part_iter_exit(&piter); | ||
582 | } | ||
583 | |||
584 | static bool disk_unlock_native_capacity(struct gendisk *disk) | 525 | static bool disk_unlock_native_capacity(struct gendisk *disk) |
585 | { | 526 | { |
586 | const struct block_device_operations *bdops = disk->fops; | 527 | const struct block_device_operations *bdops = disk->fops; |
@@ -743,33 +684,3 @@ fail: | |||
743 | } | 684 | } |
744 | 685 | ||
745 | EXPORT_SYMBOL(read_dev_sector); | 686 | EXPORT_SYMBOL(read_dev_sector); |
746 | |||
747 | void del_gendisk(struct gendisk *disk) | ||
748 | { | ||
749 | struct disk_part_iter piter; | ||
750 | struct hd_struct *part; | ||
751 | |||
752 | /* invalidate stuff */ | ||
753 | disk_part_iter_init(&piter, disk, | ||
754 | DISK_PITER_INCL_EMPTY | DISK_PITER_REVERSE); | ||
755 | while ((part = disk_part_iter_next(&piter))) { | ||
756 | invalidate_partition(disk, part->partno); | ||
757 | delete_partition(disk, part->partno); | ||
758 | } | ||
759 | disk_part_iter_exit(&piter); | ||
760 | |||
761 | invalidate_partition(disk, 0); | ||
762 | blk_free_devt(disk_to_dev(disk)->devt); | ||
763 | set_capacity(disk, 0); | ||
764 | disk->flags &= ~GENHD_FL_UP; | ||
765 | unlink_gendisk(disk); | ||
766 | part_stat_set_all(&disk->part0, 0); | ||
767 | disk->part0.stamp = 0; | ||
768 | |||
769 | kobject_put(disk->part0.holder_dir); | ||
770 | kobject_put(disk->slave_dir); | ||
771 | disk->driverfs_dev = NULL; | ||
772 | if (!sysfs_deprecated) | ||
773 | sysfs_remove_link(block_depr, dev_name(disk_to_dev(disk))); | ||
774 | device_del(disk_to_dev(disk)); | ||
775 | } | ||