Lines Matching defs:disk
50 * Probe partition formats with tables at disk address 0
65 * disk address 0xdc0. Since these may also have stale
120 * It formats the devicename of the indicated disk into
374 void delete_partition(struct gendisk *disk, int partno)
376 struct disk_part_tbl *ptbl = disk->part_tbl;
403 struct hd_struct *add_partition(struct gendisk *disk, int partno,
408 struct device *ddev = disk_to_dev(disk);
414 err = disk_expand_part_tbl(disk, partno);
417 ptbl = disk->part_tbl;
434 queue_limit_alignment_offset(&disk->queue->limits, start);
436 queue_limit_discard_alignment(&disk->queue->limits, start);
439 p->policy = get_disk_ro(disk);
478 /* suppress uevent if the disk supresses it */
499 void register_disk(struct gendisk *disk)
501 struct device *ddev = disk_to_dev(disk);
507 ddev->parent = disk->driverfs_dev;
509 dev_set_name(ddev, disk->disk_name);
524 disk->part0.holder_dir = kobject_create_and_add("holders", &ddev->kobj);
525 disk->slave_dir = kobject_create_and_add("slaves", &ddev->kobj);
528 if (!disk_partitionable(disk))
532 if (!get_capacity(disk))
535 bdev = bdget_disk(disk, 0);
546 /* announce disk after possible partitions are created */
551 disk_part_iter_init(&piter, disk, 0);
557 static bool disk_unlock_native_capacity(struct gendisk *disk)
559 const struct block_device_operations *bdops = disk->fops;
562 !(disk->flags & GENHD_FL_NATIVE_CAPACITY)) {
564 bdops->unlock_native_capacity(disk);
565 disk->flags |= GENHD_FL_NATIVE_CAPACITY;
573 int rescan_partitions(struct gendisk *disk, struct block_device *bdev)
587 res = invalidate_partition(disk, 0);
591 disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY);
593 delete_partition(disk, part->partno);
596 if (disk->fops->revalidate_disk)
597 disk->fops->revalidate_disk(disk);
598 check_disk_size_change(disk, bdev);
600 if (!get_capacity(disk) || !(state = check_partition(disk, bdev)))
610 disk->disk_name);
611 if (disk_unlock_native_capacity(disk))
624 disk->disk_name);
625 if (disk_unlock_native_capacity(disk))
630 kobject_uevent(&disk_to_dev(disk)->kobj, KOBJ_CHANGE);
633 * disk->part_tbl. This is an optimization and not strictly
640 disk_expand_part_tbl(disk, highest);
651 if (from >= get_capacity(disk)) {
654 disk->disk_name, p, (unsigned long long) from);
655 if (disk_unlock_native_capacity(disk))
660 if (from + size > get_capacity(disk)) {
663 disk->disk_name, p, (unsigned long long) size);
665 if (disk_unlock_native_capacity(disk)) {
672 * we limit them to the end of the disk to avoid
675 size = get_capacity(disk) - from;
678 part = add_partition(disk, p, from, size,
682 disk->disk_name, p, -PTR_ERR(part));
715 void del_gendisk(struct gendisk *disk)
721 disk_part_iter_init(&piter, disk,
724 invalidate_partition(disk, part->partno);
725 delete_partition(disk, part->partno);
729 invalidate_partition(disk, 0);
730 blk_free_devt(disk_to_dev(disk)->devt);
731 set_capacity(disk, 0);
732 disk->flags &= ~GENHD_FL_UP;
733 unlink_gendisk(disk);
734 part_stat_set_all(&disk->part0, 0);
735 disk->part0.stamp = 0;
737 kobject_put(disk->part0.holder_dir);
738 kobject_put(disk->slave_dir);
739 disk->driverfs_dev = NULL;
741 sysfs_remove_link(block_depr, dev_name(disk_to_dev(disk)));
743 device_del(disk_to_dev(disk));