• Home
  • Raw
  • Download

Lines Matching full:disk

30  * It formats the devicename of the indicated disk into
271 * Must be called either with bd_mutex held, before a disk can be opened or
272 * after all disk users are gone.
274 void delete_partition(struct gendisk *disk, int partno) in delete_partition() argument
277 rcu_dereference_protected(disk->part_tbl, 1); in delete_partition()
310 * Must be called either with bd_mutex held, before a disk can be opened or
311 * after all disk users are gone.
313 struct hd_struct *add_partition(struct gendisk *disk, int partno, in add_partition() argument
319 struct device *ddev = disk_to_dev(disk); in add_partition()
325 err = disk_expand_part_tbl(disk, partno); in add_partition()
328 ptbl = rcu_dereference_protected(disk->part_tbl, 1); in add_partition()
347 queue_limit_alignment_offset(&disk->queue->limits, start); in add_partition()
349 queue_limit_discard_alignment(&disk->queue->limits, start); in add_partition()
352 p->policy = get_disk_ro(disk); in add_partition()
355 struct partition_meta_info *pinfo = alloc_part_info(disk); in add_partition()
408 /* suppress uevent if the disk suppresses it */ in add_partition()
430 static bool disk_unlock_native_capacity(struct gendisk *disk) in disk_unlock_native_capacity() argument
432 const struct block_device_operations *bdops = disk->fops; in disk_unlock_native_capacity()
435 !(disk->flags & GENHD_FL_NATIVE_CAPACITY)) { in disk_unlock_native_capacity()
437 bdops->unlock_native_capacity(disk); in disk_unlock_native_capacity()
438 disk->flags |= GENHD_FL_NATIVE_CAPACITY; in disk_unlock_native_capacity()
446 static int drop_partitions(struct gendisk *disk, struct block_device *bdev) in drop_partitions() argument
454 res = invalidate_partition(disk, 0); in drop_partitions()
458 disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY); in drop_partitions()
460 delete_partition(disk, part->partno); in drop_partitions()
466 static bool part_zone_aligned(struct gendisk *disk, in part_zone_aligned() argument
473 * If this function is called, then the disk is a zoned block device in part_zone_aligned()
497 if ((from + size) < get_capacity(disk)) { in part_zone_aligned()
507 if ((from + size) < get_capacity(disk) && in part_zone_aligned()
516 int rescan_partitions(struct gendisk *disk, struct block_device *bdev) in rescan_partitions() argument
527 res = drop_partitions(disk, bdev); in rescan_partitions()
531 if (disk->fops->revalidate_disk) in rescan_partitions()
532 disk->fops->revalidate_disk(disk); in rescan_partitions()
533 check_disk_size_change(disk, bdev, true); in rescan_partitions()
535 if (!get_capacity(disk) || !(state = check_partition(disk, bdev))) in rescan_partitions()
545 disk->disk_name); in rescan_partitions()
546 if (disk_unlock_native_capacity(disk)) in rescan_partitions()
559 disk->disk_name); in rescan_partitions()
560 if (disk_unlock_native_capacity(disk)) in rescan_partitions()
565 kobject_uevent(&disk_to_dev(disk)->kobj, KOBJ_CHANGE); in rescan_partitions()
568 * disk->part_tbl. This is an optimization and not strictly in rescan_partitions()
575 disk_expand_part_tbl(disk, highest); in rescan_partitions()
586 if (from >= get_capacity(disk)) { in rescan_partitions()
589 disk->disk_name, p, (unsigned long long) from); in rescan_partitions()
590 if (disk_unlock_native_capacity(disk)) in rescan_partitions()
595 if (from + size > get_capacity(disk)) { in rescan_partitions()
598 disk->disk_name, p, (unsigned long long) size); in rescan_partitions()
600 if (disk_unlock_native_capacity(disk)) { in rescan_partitions()
607 * we limit them to the end of the disk to avoid in rescan_partitions()
610 size = get_capacity(disk) - from; in rescan_partitions()
621 !part_zone_aligned(disk, bdev, from, size)) { in rescan_partitions()
624 disk->disk_name, p, (unsigned long long) from, in rescan_partitions()
629 part = add_partition(disk, p, from, size, in rescan_partitions()
634 disk->disk_name, p, -PTR_ERR(part)); in rescan_partitions()
646 int invalidate_partitions(struct gendisk *disk, struct block_device *bdev) in invalidate_partitions() argument
653 res = drop_partitions(disk, bdev); in invalidate_partitions()
657 set_capacity(disk, 0); in invalidate_partitions()
658 check_disk_size_change(disk, bdev, false); in invalidate_partitions()
661 kobject_uevent(&disk_to_dev(disk)->kobj, KOBJ_CHANGE); in invalidate_partitions()