Lines Matching refs: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);
290 * Release the disk reference acquired in delete_partition here.
295 put_device(disk_to_dev(disk));
306 struct gendisk *disk = part_to_disk(part);
308 rcu_dereference_protected(disk->part_tbl, 1);
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);
331 rcu_dereference_protected(disk->part_tbl, 1);
336 * we have to hold the disk device
338 get_device(disk_to_dev(disk));
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,
376 struct device *ddev = disk_to_dev(disk);
386 switch (disk->queue->limits.zoned) {
389 disk->disk_name);
393 disk->disk_name);
394 disk->queue->limits.zoned = BLK_ZONED_NONE;
400 err = disk_expand_part_tbl(disk, partno);
403 ptbl = rcu_dereference_protected(disk->part_tbl, 1);
424 p->policy = get_disk_ro(disk);
429 pinfo = kzalloc_node(sizeof(*pinfo), GFP_KERNEL, disk->node_id);
482 /* suppress uevent if the disk suppresses it */
504 static bool partition_overlaps(struct gendisk *disk, sector_t start,
511 disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY);
529 struct gendisk *disk = bdev->bd_disk;
533 if (!(disk->flags & GENHD_FL_UP)) {
538 if (partition_overlaps(disk, start, length, -1)) {
543 part = add_partition(disk, partno, start, length,
627 static bool disk_unlock_native_capacity(struct gendisk *disk)
629 const struct block_device_operations *bdops = disk->fops;
632 !(disk->flags & GENHD_FL_NATIVE_CAPACITY)) {
634 bdops->unlock_native_capacity(disk);
635 disk->flags |= GENHD_FL_NATIVE_CAPACITY;
666 static bool blk_add_partition(struct gendisk *disk, struct block_device *bdev,
676 if (from >= get_capacity(disk)) {
679 disk->disk_name, p, (unsigned long long) from);
680 if (disk_unlock_native_capacity(disk))
685 if (from + size > get_capacity(disk)) {
688 disk->disk_name, p, (unsigned long long) size);
690 if (disk_unlock_native_capacity(disk))
696 * disk to avoid creating invalid block devices.
698 size = get_capacity(disk) - from;
701 part = add_partition(disk, p, from, size, state->parts[p].flags,
705 disk->disk_name, p, -PTR_ERR(part));
716 int blk_add_partitions(struct gendisk *disk, struct block_device *bdev)
721 if (!disk_part_scan_enabled(disk))
724 state = check_partition(disk, bdev);
734 disk->disk_name);
735 if (disk_unlock_native_capacity(disk))
744 if (disk->queue->limits.zoned == BLK_ZONED_HM) {
746 disk->disk_name);
759 disk->disk_name);
760 if (disk_unlock_native_capacity(disk))
765 kobject_uevent(&disk_to_dev(disk)->kobj, KOBJ_CHANGE);
768 * Detect the highest partition number and preallocate disk->part_tbl.
774 disk_expand_part_tbl(disk, highest);
777 if (!blk_add_partition(disk, bdev, state, p))