Lines Matching full:disk

17 	 * Probe partition formats with tables at disk address 0
32 * disk address 0xdc0. Since these may also have stale
287 struct gendisk *disk = part_to_disk(part); in hd_struct_free_work() local
290 * Release the disk reference acquired in delete_partition here. in hd_struct_free_work()
295 put_device(disk_to_dev(disk)); in hd_struct_free_work()
306 struct gendisk *disk = part_to_disk(part); in hd_struct_free() local
308 rcu_dereference_protected(disk->part_tbl, 1); in hd_struct_free()
324 * Must be called either with bd_mutex held, before a disk can be opened or
325 * after all disk users are gone.
329 struct gendisk *disk = part_to_disk(part); in delete_partition() local
331 rcu_dereference_protected(disk->part_tbl, 1); in delete_partition()
335 * we have to hold the disk device in delete_partition()
337 get_device(disk_to_dev(disk)); in delete_partition()
360 * Must be called either with bd_mutex held, before a disk can be opened or
361 * after all disk users are gone.
363 static struct hd_struct *add_partition(struct gendisk *disk, int partno, in add_partition() argument
369 struct device *ddev = disk_to_dev(disk); in add_partition()
379 switch (disk->queue->limits.zoned) { in add_partition()
382 disk->disk_name); in add_partition()
386 disk->disk_name); in add_partition()
387 disk->queue->limits.zoned = BLK_ZONED_NONE; in add_partition()
393 err = disk_expand_part_tbl(disk, partno); in add_partition()
396 ptbl = rcu_dereference_protected(disk->part_tbl, 1); in add_partition()
417 p->policy = get_disk_ro(disk); in add_partition()
422 pinfo = kzalloc_node(sizeof(*pinfo), GFP_KERNEL, disk->node_id); in add_partition()
475 /* suppress uevent if the disk suppresses it */ in add_partition()
497 static bool partition_overlaps(struct gendisk *disk, sector_t start, in partition_overlaps() argument
504 disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY); in partition_overlaps()
611 static bool disk_unlock_native_capacity(struct gendisk *disk) in disk_unlock_native_capacity() argument
613 const struct block_device_operations *bdops = disk->fops; in disk_unlock_native_capacity()
616 !(disk->flags & GENHD_FL_NATIVE_CAPACITY)) { in disk_unlock_native_capacity()
618 bdops->unlock_native_capacity(disk); in disk_unlock_native_capacity()
619 disk->flags |= GENHD_FL_NATIVE_CAPACITY; in disk_unlock_native_capacity()
650 static bool blk_add_partition(struct gendisk *disk, struct block_device *bdev, in blk_add_partition() argument
660 if (from >= get_capacity(disk)) { in blk_add_partition()
663 disk->disk_name, p, (unsigned long long) from); in blk_add_partition()
664 if (disk_unlock_native_capacity(disk)) in blk_add_partition()
669 if (from + size > get_capacity(disk)) { in blk_add_partition()
672 disk->disk_name, p, (unsigned long long) size); in blk_add_partition()
674 if (disk_unlock_native_capacity(disk)) in blk_add_partition()
680 * disk to avoid creating invalid block devices. in blk_add_partition()
682 size = get_capacity(disk) - from; in blk_add_partition()
685 part = add_partition(disk, p, from, size, state->parts[p].flags, in blk_add_partition()
689 disk->disk_name, p, -PTR_ERR(part)); in blk_add_partition()
700 int blk_add_partitions(struct gendisk *disk, struct block_device *bdev) in blk_add_partitions() argument
705 if (!disk_part_scan_enabled(disk)) in blk_add_partitions()
708 state = check_partition(disk, bdev); in blk_add_partitions()
718 disk->disk_name); in blk_add_partitions()
719 if (disk_unlock_native_capacity(disk)) in blk_add_partitions()
728 if (disk->queue->limits.zoned == BLK_ZONED_HM) { in blk_add_partitions()
730 disk->disk_name); in blk_add_partitions()
743 disk->disk_name); in blk_add_partitions()
744 if (disk_unlock_native_capacity(disk)) in blk_add_partitions()
749 kobject_uevent(&disk_to_dev(disk)->kobj, KOBJ_CHANGE); in blk_add_partitions()
752 * Detect the highest partition number and preallocate disk->part_tbl. in blk_add_partitions()
758 disk_expand_part_tbl(disk, highest); in blk_add_partitions()
761 if (!blk_add_partition(disk, bdev, state, p)) in blk_add_partitions()