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()
336 * we have to hold the disk device in delete_partition()
338 get_device(disk_to_dev(disk)); in delete_partition()
367 * Must be called either with bd_mutex held, before a disk can be opened or
368 * after all disk users are gone.
370 static struct hd_struct *add_partition(struct gendisk *disk, int partno, in add_partition() argument
376 struct device *ddev = disk_to_dev(disk); in add_partition()
386 switch (disk->queue->limits.zoned) { in add_partition()
389 disk->disk_name); in add_partition()
393 disk->disk_name); in add_partition()
394 disk->queue->limits.zoned = BLK_ZONED_NONE; in add_partition()
400 err = disk_expand_part_tbl(disk, partno); in add_partition()
403 ptbl = rcu_dereference_protected(disk->part_tbl, 1); in add_partition()
424 p->policy = get_disk_ro(disk); in add_partition()
429 pinfo = kzalloc_node(sizeof(*pinfo), GFP_KERNEL, disk->node_id); in add_partition()
482 /* suppress uevent if the disk suppresses it */ in add_partition()
504 static bool partition_overlaps(struct gendisk *disk, sector_t start, in partition_overlaps() argument
511 disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY); in partition_overlaps()
618 static bool disk_unlock_native_capacity(struct gendisk *disk) in disk_unlock_native_capacity() argument
620 const struct block_device_operations *bdops = disk->fops; in disk_unlock_native_capacity()
623 !(disk->flags & GENHD_FL_NATIVE_CAPACITY)) { in disk_unlock_native_capacity()
625 bdops->unlock_native_capacity(disk); in disk_unlock_native_capacity()
626 disk->flags |= GENHD_FL_NATIVE_CAPACITY; in disk_unlock_native_capacity()
657 static bool blk_add_partition(struct gendisk *disk, struct block_device *bdev, in blk_add_partition() argument
667 if (from >= get_capacity(disk)) { in blk_add_partition()
670 disk->disk_name, p, (unsigned long long) from); in blk_add_partition()
671 if (disk_unlock_native_capacity(disk)) in blk_add_partition()
676 if (from + size > get_capacity(disk)) { in blk_add_partition()
679 disk->disk_name, p, (unsigned long long) size); in blk_add_partition()
681 if (disk_unlock_native_capacity(disk)) in blk_add_partition()
687 * disk to avoid creating invalid block devices. in blk_add_partition()
689 size = get_capacity(disk) - from; in blk_add_partition()
692 part = add_partition(disk, p, from, size, state->parts[p].flags, in blk_add_partition()
696 disk->disk_name, p, -PTR_ERR(part)); in blk_add_partition()
707 int blk_add_partitions(struct gendisk *disk, struct block_device *bdev) in blk_add_partitions() argument
712 if (!disk_part_scan_enabled(disk)) in blk_add_partitions()
715 state = check_partition(disk, bdev); in blk_add_partitions()
725 disk->disk_name); in blk_add_partitions()
726 if (disk_unlock_native_capacity(disk)) in blk_add_partitions()
735 if (disk->queue->limits.zoned == BLK_ZONED_HM) { in blk_add_partitions()
737 disk->disk_name); in blk_add_partitions()
750 disk->disk_name); in blk_add_partitions()
751 if (disk_unlock_native_capacity(disk)) in blk_add_partitions()
756 kobject_uevent(&disk_to_dev(disk)->kobj, KOBJ_CHANGE); in blk_add_partitions()
759 * Detect the highest partition number and preallocate disk->part_tbl. in blk_add_partitions()
765 disk_expand_part_tbl(disk, highest); in blk_add_partitions()
768 if (!blk_add_partition(disk, bdev, state, p)) in blk_add_partitions()