Searched refs:disk (Results 1 - 200 of 1017) sorted by relevance

123456

/linux-4.4.14/block/
H A Dgenhd.c42 static void disk_alloc_events(struct gendisk *disk);
43 static void disk_add_events(struct gendisk *disk);
44 static void disk_del_events(struct gendisk *disk);
45 static void disk_release_events(struct gendisk *disk);
49 * @disk: disk to look partition from
52 * Look for partition @partno from @disk. If found, increment
61 struct hd_struct *disk_get_part(struct gendisk *disk, int partno) disk_get_part() argument
71 ptbl = rcu_dereference(disk->part_tbl); disk_get_part()
87 * @disk: disk to iterate over
90 * Initialize @piter so that it iterates over partitions of @disk.
95 void disk_part_iter_init(struct disk_part_iter *piter, struct gendisk *disk, disk_part_iter_init() argument
101 ptbl = rcu_dereference(disk->part_tbl); disk_part_iter_init()
103 piter->disk = disk; disk_part_iter_init()
139 ptbl = rcu_dereference(piter->disk->part_tbl); disk_part_iter_next()
203 * @disk: gendisk of interest
206 * Find out which partition @sector maps to on @disk. This is
216 struct hd_struct *disk_map_sector_rcu(struct gendisk *disk, sector_t sector) disk_map_sector_rcu() argument
222 ptbl = rcu_dereference(disk->part_tbl); disk_map_sector_rcu()
236 return &disk->part0; disk_map_sector_rcu()
414 struct gendisk *disk = part_to_disk(part); blk_alloc_devt() local
418 if (part->partno < disk->minors) { blk_alloc_devt()
419 *devt = MKDEV(disk->major, disk->first_minor + part->partno); blk_alloc_devt()
508 static void register_disk(struct gendisk *disk) register_disk() argument
510 struct device *ddev = disk_to_dev(disk); register_disk()
516 ddev->parent = disk->driverfs_dev; register_disk()
518 dev_set_name(ddev, "%s", disk->disk_name); register_disk()
541 disk->part0.holder_dir = kobject_create_and_add("holders", &ddev->kobj); register_disk()
542 disk->slave_dir = kobject_create_and_add("slaves", &ddev->kobj); register_disk()
545 if (!disk_part_scan_enabled(disk)) register_disk()
549 if (!get_capacity(disk)) register_disk()
552 bdev = bdget_disk(disk, 0); register_disk()
563 /* announce disk after possible partitions are created */ register_disk()
568 disk_part_iter_init(&piter, disk, 0); register_disk()
576 * @disk: per-device partitioning information
578 * This function registers the partitioning information in @disk
583 void add_disk(struct gendisk *disk) add_disk() argument
593 WARN_ON(disk->minors && !(disk->major || disk->first_minor)); add_disk()
594 WARN_ON(!disk->minors && !(disk->flags & GENHD_FL_EXT_DEVT)); add_disk()
596 disk->flags |= GENHD_FL_UP; add_disk()
598 retval = blk_alloc_devt(&disk->part0, &devt); add_disk()
603 disk_to_dev(disk)->devt = devt; add_disk()
608 disk->major = MAJOR(devt); add_disk()
609 disk->first_minor = MINOR(devt); add_disk()
611 disk_alloc_events(disk); add_disk()
614 bdi = &disk->queue->backing_dev_info; add_disk()
615 bdi_register_dev(bdi, disk_devt(disk)); add_disk()
617 blk_register_region(disk_devt(disk), disk->minors, NULL, add_disk()
618 exact_match, exact_lock, disk); add_disk() local
619 register_disk(disk); add_disk()
620 blk_register_queue(disk); add_disk()
624 * so that it sticks around as long as @disk is there. add_disk()
626 WARN_ON_ONCE(!blk_get_queue(disk->queue)); add_disk()
628 retval = sysfs_create_link(&disk_to_dev(disk)->kobj, &bdi->dev->kobj, add_disk()
632 disk_add_events(disk); add_disk()
633 blk_integrity_add(disk); add_disk()
637 void del_gendisk(struct gendisk *disk) del_gendisk() argument
642 blk_integrity_del(disk); del_gendisk()
643 disk_del_events(disk); del_gendisk()
646 disk_part_iter_init(&piter, disk, del_gendisk()
649 invalidate_partition(disk, part->partno); del_gendisk()
650 delete_partition(disk, part->partno); del_gendisk()
654 invalidate_partition(disk, 0); del_gendisk()
655 set_capacity(disk, 0); del_gendisk()
656 disk->flags &= ~GENHD_FL_UP; del_gendisk()
658 sysfs_remove_link(&disk_to_dev(disk)->kobj, "bdi"); del_gendisk()
659 blk_unregister_queue(disk); del_gendisk()
660 blk_unregister_region(disk_devt(disk), disk->minors); del_gendisk()
662 part_stat_set_all(&disk->part0, 0); del_gendisk()
663 disk->part0.stamp = 0; del_gendisk()
665 kobject_put(disk->part0.holder_dir); del_gendisk()
666 kobject_put(disk->slave_dir); del_gendisk()
667 disk->driverfs_dev = NULL; del_gendisk()
669 sysfs_remove_link(block_depr, dev_name(disk_to_dev(disk))); del_gendisk()
670 pm_runtime_set_memalloc_noio(disk_to_dev(disk), false); del_gendisk()
671 device_del(disk_to_dev(disk)); del_gendisk()
685 struct gendisk *disk = NULL; get_gendisk() local
692 disk = dev_to_disk(kobj_to_dev(kobj)); get_gendisk()
700 disk = part_to_disk(part); get_gendisk()
705 return disk; get_gendisk()
711 * @disk: gendisk of interest
714 * Find partition @partno from @disk, do bdget() on it.
722 struct block_device *bdget_disk(struct gendisk *disk, int partno) bdget_disk() argument
727 part = disk_get_part(disk, partno); bdget_disk()
748 struct gendisk *disk = dev_to_disk(dev); printk_all_partitions() local
758 if (get_capacity(disk) == 0 || printk_all_partitions()
759 (disk->flags & GENHD_FL_SUPPRESS_PARTITION_INFO)) printk_all_partitions()
767 disk_part_iter_init(&piter, disk, DISK_PITER_INCL_PART0); printk_all_partitions()
769 bool is_part0 = part == &disk->part0; printk_all_partitions()
774 , disk_name(disk, part->partno, name_buf), printk_all_partitions()
777 if (disk->driverfs_dev != NULL && printk_all_partitions()
778 disk->driverfs_dev->driver != NULL) printk_all_partitions()
780 disk->driverfs_dev->driver->name); printk_all_partitions()
861 /* show the full disk and all non-0 size partitions of it */ show_partition()
926 struct gendisk *disk = dev_to_disk(dev); disk_range_show() local
928 return sprintf(buf, "%d\n", disk->minors); disk_range_show()
934 struct gendisk *disk = dev_to_disk(dev); disk_ext_range_show() local
936 return sprintf(buf, "%d\n", disk_max_parts(disk)); disk_ext_range_show()
942 struct gendisk *disk = dev_to_disk(dev); disk_removable_show() local
945 (disk->flags & GENHD_FL_REMOVABLE ? 1 : 0)); disk_removable_show()
951 struct gendisk *disk = dev_to_disk(dev); disk_ro_show() local
953 return sprintf(buf, "%d\n", get_disk_ro(disk) ? 1 : 0); disk_ro_show()
959 struct gendisk *disk = dev_to_disk(dev); disk_capability_show() local
961 return sprintf(buf, "%x\n", disk->flags); disk_capability_show()
968 struct gendisk *disk = dev_to_disk(dev); disk_alignment_offset_show() local
970 return sprintf(buf, "%d\n", queue_alignment_offset(disk->queue)); disk_alignment_offset_show()
977 struct gendisk *disk = dev_to_disk(dev); disk_discard_alignment_show() local
979 return sprintf(buf, "%d\n", queue_discard_alignment(disk->queue)); disk_discard_alignment_show()
1033 * disk_replace_part_tbl - replace disk->part_tbl in RCU-safe way
1034 * @disk: disk to replace part_tbl for
1037 * Replace disk->part_tbl with @new_ptbl in RCU-safe way. The
1043 static void disk_replace_part_tbl(struct gendisk *disk, disk_replace_part_tbl() argument
1046 struct disk_part_tbl *old_ptbl = disk->part_tbl; disk_replace_part_tbl()
1048 rcu_assign_pointer(disk->part_tbl, new_ptbl); disk_replace_part_tbl()
1057 * disk_expand_part_tbl - expand disk->part_tbl
1058 * @disk: disk to expand part_tbl for
1061 * Expand disk->part_tbl such that @partno can fit in. disk->part_tbl
1070 int disk_expand_part_tbl(struct gendisk *disk, int partno) disk_expand_part_tbl() argument
1072 struct disk_part_tbl *old_ptbl = disk->part_tbl; disk_expand_part_tbl()
1087 if (disk_max_parts(disk) && target > disk_max_parts(disk)) disk_expand_part_tbl()
1094 new_ptbl = kzalloc_node(size, GFP_KERNEL, disk->node_id); disk_expand_part_tbl()
1103 disk_replace_part_tbl(disk, new_ptbl); disk_expand_part_tbl()
1109 struct gendisk *disk = dev_to_disk(dev); disk_release() local
1112 disk_release_events(disk); disk_release()
1113 kfree(disk->random); disk_release()
1114 disk_replace_part_tbl(disk, NULL); disk_release()
1115 hd_free_part(&disk->part0); disk_release()
1116 if (disk->queue) disk_release()
1117 blk_put_queue(disk->queue); disk_release()
1118 kfree(disk); disk_release()
1127 struct gendisk *disk = dev_to_disk(dev); block_devnode() local
1129 if (disk->devnode) block_devnode()
1130 return disk->devnode(disk, mode); block_devnode()
1135 .name = "disk",
1143 * aggregate disk stat collector. Uses the same stats that the sysfs
1228 struct gendisk *disk = dev_to_disk(dev); blk_lookup_devt() local
1234 if (partno < disk->minors) { blk_lookup_devt()
1242 part = disk_get_part(disk, partno); blk_lookup_devt()
1263 struct gendisk *disk; alloc_disk_node() local
1265 disk = kzalloc_node(sizeof(struct gendisk), GFP_KERNEL, node_id); alloc_disk_node()
1266 if (disk) { alloc_disk_node()
1267 if (!init_part_stats(&disk->part0)) { alloc_disk_node()
1268 kfree(disk); alloc_disk_node()
1271 disk->node_id = node_id; alloc_disk_node()
1272 if (disk_expand_part_tbl(disk, 0)) { alloc_disk_node()
1273 free_part_stats(&disk->part0); alloc_disk_node()
1274 kfree(disk); alloc_disk_node()
1277 disk->part_tbl->part[0] = &disk->part0; alloc_disk_node()
1288 seqcount_init(&disk->part0.nr_sects_seq); alloc_disk_node()
1289 if (hd_ref_init(&disk->part0)) { alloc_disk_node()
1290 hd_free_part(&disk->part0); alloc_disk_node()
1291 kfree(disk); alloc_disk_node()
1295 disk->minors = minors; alloc_disk_node()
1296 rand_initialize_disk(disk); alloc_disk_node()
1297 disk_to_dev(disk)->class = &block_class; alloc_disk_node()
1298 disk_to_dev(disk)->type = &disk_type; alloc_disk_node()
1299 device_initialize(disk_to_dev(disk)); alloc_disk_node()
1301 return disk; alloc_disk_node()
1305 struct kobject *get_disk(struct gendisk *disk) get_disk() argument
1310 if (!disk->fops) get_disk()
1312 owner = disk->fops->owner; get_disk()
1315 kobj = kobject_get(&disk_to_dev(disk)->kobj); get_disk()
1326 void put_disk(struct gendisk *disk) put_disk() argument
1328 if (disk) put_disk()
1329 kobject_put(&disk_to_dev(disk)->kobj); put_disk()
1351 void set_disk_ro(struct gendisk *disk, int flag) set_disk_ro() argument
1356 if (disk->part0.policy != flag) { set_disk_ro()
1357 set_disk_ro_uevent(disk, flag); set_disk_ro()
1358 disk->part0.policy = flag; set_disk_ro()
1361 disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY); set_disk_ro()
1378 int invalidate_partition(struct gendisk *disk, int partno) invalidate_partition() argument
1381 struct block_device *bdev = bdget_disk(disk, partno); invalidate_partition()
1393 * Disk events - monitor disk events like media change and eject request.
1397 struct gendisk *disk; /* the associated disk */ member in struct:disk_events
1426 static unsigned long disk_events_poll_jiffies(struct gendisk *disk) disk_events_poll_jiffies() argument
1428 struct disk_events *ev = disk->ev; disk_events_poll_jiffies()
1438 else if (disk->events & ~disk->async_events) disk_events_poll_jiffies()
1445 * disk_block_events - block and flush disk event checking
1446 * @disk: disk to block events for
1459 void disk_block_events(struct gendisk *disk) disk_block_events() argument
1461 struct disk_events *ev = disk->ev; disk_block_events()
1479 cancel_delayed_work_sync(&disk->ev->dwork); disk_block_events()
1484 static void __disk_unblock_events(struct gendisk *disk, bool check_now) __disk_unblock_events() argument
1486 struct disk_events *ev = disk->ev; __disk_unblock_events()
1502 intv = disk_events_poll_jiffies(disk); __disk_unblock_events()
1515 * disk_unblock_events - unblock disk event checking
1516 * @disk: disk to unblock events for
1524 void disk_unblock_events(struct gendisk *disk) disk_unblock_events() argument
1526 if (disk->ev) disk_unblock_events()
1527 __disk_unblock_events(disk, false); disk_unblock_events()
1532 * @disk: disk to check and flush events for
1535 * Schedule immediate event checking on @disk if not blocked. Events in
1537 * doesn't clear the events from @disk->ev.
1542 void disk_flush_events(struct gendisk *disk, unsigned int mask) disk_flush_events() argument
1544 struct disk_events *ev = disk->ev; disk_flush_events()
1559 * @disk: disk to fetch and clear events from
1568 unsigned int disk_clear_events(struct gendisk *disk, unsigned int mask) disk_clear_events() argument
1570 const struct block_device_operations *bdops = disk->fops; disk_clear_events()
1571 struct disk_events *ev = disk->ev; disk_clear_events()
1578 bdops->media_changed && bdops->media_changed(disk)) disk_clear_events()
1583 disk_block_events(disk); disk_clear_events()
1600 __disk_unblock_events(disk, ev->clearing ? true : false); disk_clear_events()
1627 struct gendisk *disk = ev->disk; disk_check_events() local
1635 events = disk->fops->check_events(disk, clearing); disk_check_events()
1644 intv = disk_events_poll_jiffies(disk); disk_check_events()
1653 * @disk->events are reported. Unlisted events are processed the disk_check_events()
1657 if (events & disk->events & (1 << i)) disk_check_events()
1661 kobject_uevent_env(&disk_to_dev(disk)->kobj, KOBJ_CHANGE, envp); disk_check_events()
1665 * A disk events enabled device has the following sysfs nodes under
1692 struct gendisk *disk = dev_to_disk(dev); disk_events_show() local
1694 return __disk_events_show(disk->events, buf); disk_events_show()
1700 struct gendisk *disk = dev_to_disk(dev); disk_events_async_show() local
1702 return __disk_events_show(disk->async_events, buf); disk_events_async_show()
1709 struct gendisk *disk = dev_to_disk(dev); disk_events_poll_msecs_show() local
1711 return sprintf(buf, "%ld\n", disk->ev->poll_msecs); disk_events_poll_msecs_show()
1718 struct gendisk *disk = dev_to_disk(dev); disk_events_poll_msecs_store() local
1727 disk_block_events(disk); disk_events_poll_msecs_store()
1728 disk->ev->poll_msecs = intv; disk_events_poll_msecs_store()
1729 __disk_unblock_events(disk, true); disk_events_poll_msecs_store()
1766 disk_flush_events(ev->disk, 0); disk_events_set_dfl_poll_msecs()
1787 static void disk_alloc_events(struct gendisk *disk) disk_alloc_events() argument
1791 if (!disk->fops->check_events) disk_alloc_events()
1796 pr_warn("%s: failed to initialize events\n", disk->disk_name); disk_alloc_events()
1801 ev->disk = disk; disk_alloc_events()
1808 disk->ev = ev; disk_alloc_events()
1811 static void disk_add_events(struct gendisk *disk) disk_add_events() argument
1813 if (!disk->ev) disk_add_events()
1817 if (sysfs_create_files(&disk_to_dev(disk)->kobj, disk_events_attrs) < 0) disk_add_events()
1819 disk->disk_name); disk_add_events()
1822 list_add_tail(&disk->ev->node, &disk_events); disk_add_events()
1829 __disk_unblock_events(disk, true); disk_add_events()
1832 static void disk_del_events(struct gendisk *disk) disk_del_events() argument
1834 if (!disk->ev) disk_del_events()
1837 disk_block_events(disk); disk_del_events()
1840 list_del_init(&disk->ev->node); disk_del_events()
1843 sysfs_remove_files(&disk_to_dev(disk)->kobj, disk_events_attrs); disk_del_events()
1846 static void disk_release_events(struct gendisk *disk) disk_release_events() argument
1849 WARN_ON_ONCE(disk->ev && disk->ev->block != 1); disk_release_events()
1850 kfree(disk->ev); disk_release_events()
H A Dpartition-generic.c29 * It formats the devicename of the indicated disk into
241 void delete_partition(struct gendisk *disk, int partno) delete_partition() argument
243 struct disk_part_tbl *ptbl = disk->part_tbl; delete_partition()
269 struct hd_struct *add_partition(struct gendisk *disk, int partno, add_partition() argument
275 struct device *ddev = disk_to_dev(disk); add_partition()
281 err = disk_expand_part_tbl(disk, partno); add_partition()
284 ptbl = disk->part_tbl; add_partition()
303 queue_limit_alignment_offset(&disk->queue->limits, start); add_partition()
305 queue_limit_discard_alignment(&disk->queue->limits, start); add_partition()
308 p->policy = get_disk_ro(disk); add_partition()
311 struct partition_meta_info *pinfo = alloc_part_info(disk); add_partition()
362 /* suppress uevent if the disk suppresses it */ add_partition()
385 static bool disk_unlock_native_capacity(struct gendisk *disk) disk_unlock_native_capacity() argument
387 const struct block_device_operations *bdops = disk->fops; disk_unlock_native_capacity()
390 !(disk->flags & GENHD_FL_NATIVE_CAPACITY)) { disk_unlock_native_capacity()
392 bdops->unlock_native_capacity(disk); disk_unlock_native_capacity()
393 disk->flags |= GENHD_FL_NATIVE_CAPACITY; disk_unlock_native_capacity()
401 static int drop_partitions(struct gendisk *disk, struct block_device *bdev) drop_partitions() argument
409 res = invalidate_partition(disk, 0); drop_partitions()
413 disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY); drop_partitions()
415 delete_partition(disk, part->partno); drop_partitions()
421 int rescan_partitions(struct gendisk *disk, struct block_device *bdev) rescan_partitions() argument
432 res = drop_partitions(disk, bdev); rescan_partitions()
436 if (disk->fops->revalidate_disk) rescan_partitions()
437 disk->fops->revalidate_disk(disk); rescan_partitions()
438 blk_integrity_revalidate(disk); rescan_partitions()
439 check_disk_size_change(disk, bdev); rescan_partitions()
441 if (!get_capacity(disk) || !(state = check_partition(disk, bdev))) rescan_partitions()
451 disk->disk_name); rescan_partitions()
452 if (disk_unlock_native_capacity(disk)) rescan_partitions()
465 disk->disk_name); rescan_partitions()
466 if (disk_unlock_native_capacity(disk)) rescan_partitions()
471 kobject_uevent(&disk_to_dev(disk)->kobj, KOBJ_CHANGE); rescan_partitions()
474 * disk->part_tbl. This is an optimization and not strictly rescan_partitions()
481 disk_expand_part_tbl(disk, highest); rescan_partitions()
493 if (from >= get_capacity(disk)) { rescan_partitions()
496 disk->disk_name, p, (unsigned long long) from); rescan_partitions()
497 if (disk_unlock_native_capacity(disk)) rescan_partitions()
502 if (from + size > get_capacity(disk)) { rescan_partitions()
505 disk->disk_name, p, (unsigned long long) size); rescan_partitions()
507 if (disk_unlock_native_capacity(disk)) { rescan_partitions()
514 * we limit them to the end of the disk to avoid rescan_partitions()
517 size = get_capacity(disk) - from; rescan_partitions()
523 part = add_partition(disk, p, from, size, rescan_partitions()
528 disk->disk_name, p, -PTR_ERR(part)); rescan_partitions()
540 int invalidate_partitions(struct gendisk *disk, struct block_device *bdev) invalidate_partitions() argument
547 res = drop_partitions(disk, bdev); invalidate_partitions()
551 set_capacity(disk, 0); invalidate_partitions()
552 check_disk_size_change(disk, bdev); invalidate_partitions()
555 kobject_uevent(&disk_to_dev(disk)->kobj, KOBJ_CHANGE); invalidate_partitions()
H A Dblk-integrity.c248 struct gendisk *disk = container_of(kobj, struct gendisk, integrity_kobj); integrity_attr_show() local
249 struct blk_integrity *bi = &disk->queue->integrity; integrity_attr_show()
260 struct gendisk *disk = container_of(kobj, struct gendisk, integrity_kobj); integrity_attr_store() local
261 struct blk_integrity *bi = &disk->queue->integrity; integrity_attr_store()
400 * @disk: struct gendisk pointer to make integrity-aware
409 void blk_integrity_register(struct gendisk *disk, struct blk_integrity *template) blk_integrity_register() argument
411 struct blk_integrity *bi = &disk->queue->integrity; blk_integrity_register()
415 bi->interval_exp = ilog2(queue_logical_block_size(disk->queue)); blk_integrity_register()
420 blk_integrity_revalidate(disk); blk_integrity_register()
426 * @disk: disk whose integrity profile to unregister
431 void blk_integrity_unregister(struct gendisk *disk) blk_integrity_unregister() argument
433 blk_integrity_revalidate(disk); blk_integrity_unregister()
434 memset(&disk->queue->integrity, 0, sizeof(struct blk_integrity)); blk_integrity_unregister()
438 void blk_integrity_revalidate(struct gendisk *disk) blk_integrity_revalidate() argument
440 struct blk_integrity *bi = &disk->queue->integrity; blk_integrity_revalidate()
442 if (!(disk->flags & GENHD_FL_UP)) blk_integrity_revalidate()
446 disk->queue->backing_dev_info.capabilities |= blk_integrity_revalidate()
449 disk->queue->backing_dev_info.capabilities &= blk_integrity_revalidate()
453 void blk_integrity_add(struct gendisk *disk) blk_integrity_add() argument
455 if (kobject_init_and_add(&disk->integrity_kobj, &integrity_ktype, blk_integrity_add()
456 &disk_to_dev(disk)->kobj, "%s", "integrity")) blk_integrity_add()
459 kobject_uevent(&disk->integrity_kobj, KOBJ_ADD); blk_integrity_add()
462 void blk_integrity_del(struct gendisk *disk) blk_integrity_del() argument
464 kobject_uevent(&disk->integrity_kobj, KOBJ_REMOVE); blk_integrity_del()
465 kobject_del(&disk->integrity_kobj); blk_integrity_del()
466 kobject_put(&disk->integrity_kobj); blk_integrity_del()
H A Dioctl.c16 struct gendisk *disk; blkpg_ioctl() local
30 disk = bdev->bd_disk; blkpg_ioctl()
52 disk_part_iter_init(&piter, disk, blkpg_ioctl()
65 part = add_partition(disk, partno, start, length, blkpg_ioctl()
70 part = disk_get_part(disk, partno); blkpg_ioctl()
90 delete_partition(disk, partno); blkpg_ioctl()
108 part = disk_get_part(disk, partno); blkpg_ioctl()
126 disk_part_iter_init(&piter, disk, blkpg_ioctl()
161 struct gendisk *disk = bdev->bd_disk; __blkdev_reread_part() local
163 if (!disk_part_scan_enabled(disk) || bdev != bdev->bd_contains) __blkdev_reread_part()
170 return rescan_partitions(disk, bdev); __blkdev_reread_part()
285 struct gendisk *disk = bdev->bd_disk; __blkdev_driver_ioctl() local
287 if (disk->fops->ioctl) __blkdev_driver_ioctl()
288 return disk->fops->ioctl(bdev, mode, cmd, arg); __blkdev_driver_ioctl()
445 struct gendisk *disk = bdev->bd_disk; blkdev_getgeo() local
451 if (!disk->fops->getgeo) blkdev_getgeo()
460 ret = disk->fops->getgeo(bdev, &geo); blkdev_getgeo()
H A Dblk-timeout.c43 struct gendisk *disk = dev_to_disk(dev); part_timeout_show() local
44 int set = test_bit(QUEUE_FLAG_FAIL_IO, &disk->queue->queue_flags); part_timeout_show()
52 struct gendisk *disk = dev_to_disk(dev); part_timeout_store() local
56 struct request_queue *q = disk->queue; part_timeout_store()
H A Dblk-mq-sysfs.c383 void blk_mq_unregister_disk(struct gendisk *disk) blk_mq_unregister_disk() argument
385 struct request_queue *q = disk->queue; blk_mq_unregister_disk()
405 kobject_put(&disk_to_dev(disk)->kobj);
426 int blk_mq_register_disk(struct gendisk *disk) blk_mq_register_disk() argument
428 struct device *dev = disk_to_dev(disk); blk_mq_register_disk()
429 struct request_queue *q = disk->queue; blk_mq_register_disk()
450 blk_mq_unregister_disk(disk);
H A Dblk-sysfs.c621 int blk_register_queue(struct gendisk *disk) blk_register_queue() argument
624 struct device *dev = disk_to_dev(disk); blk_register_queue()
625 struct request_queue *q = disk->queue; blk_register_queue()
658 blk_mq_register_disk(disk); blk_register_queue()
675 void blk_unregister_queue(struct gendisk *disk) blk_unregister_queue() argument
677 struct request_queue *q = disk->queue; blk_unregister_queue()
683 blk_mq_unregister_disk(disk); blk_unregister_queue()
690 blk_trace_remove_sysfs(disk_to_dev(disk)); blk_unregister_queue()
691 kobject_put(&disk_to_dev(disk)->kobj); blk_unregister_queue()
H A Dblk-cgroup.c470 /* some drivers (floppy) instantiate a queue w/o disk registered */ blkg_dev_name()
787 __acquires(rcu) __acquires(disk->queue->queue_lock) __acquires()
789 struct gendisk *disk; __acquires() local
803 disk = get_gendisk(MKDEV(major, minor), &part); __acquires()
804 if (!disk) __acquires()
807 put_disk(disk); __acquires()
812 spin_lock_irq(disk->queue->queue_lock); __acquires()
814 if (blkcg_policy_enabled(disk->queue, pol)) __acquires()
815 blkg = blkg_lookup_create(blkcg, disk->queue); __acquires()
822 spin_unlock_irq(disk->queue->queue_lock); __acquires()
823 put_disk(disk); __acquires()
837 ctx->disk = disk; __acquires()
852 __releases(ctx->disk->queue->queue_lock) __releases(rcu) __releases()
854 spin_unlock_irq(ctx->disk->queue->queue_lock); __releases()
856 put_disk(ctx->disk); __releases()
/linux-4.4.14/drivers/block/paride/
H A Dpd.c233 int changed; /* Have we seen a disk change ? */
252 static inline int status_reg(struct pd_unit *disk) status_reg() argument
254 return pi_read_regr(disk->pi, 1, 6); status_reg()
257 static inline int read_reg(struct pd_unit *disk, int reg) read_reg() argument
259 return pi_read_regr(disk->pi, 0, reg); read_reg()
262 static inline void write_status(struct pd_unit *disk, int val) write_status() argument
264 pi_write_regr(disk->pi, 1, 6, val); write_status()
267 static inline void write_reg(struct pd_unit *disk, int reg, int val) write_reg() argument
269 pi_write_regr(disk->pi, 0, reg, val); write_reg()
272 static inline u8 DRIVE(struct pd_unit *disk) DRIVE() argument
274 return 0xa0+0x10*disk->drive; DRIVE()
279 static void pd_print_error(struct pd_unit *disk, char *msg, int status) pd_print_error() argument
283 printk("%s: %s: status = 0x%x =", disk->name, msg, status); pd_print_error()
290 static void pd_reset(struct pd_unit *disk) pd_reset() argument
292 write_status(disk, 4); pd_reset()
294 write_status(disk, 0); pd_reset()
300 static int pd_wait_for(struct pd_unit *disk, int w, char *msg) pd_wait_for() argument
306 r = status_reg(disk); pd_wait_for()
312 e = (read_reg(disk, 1) << 8) + read_reg(disk, 7); pd_wait_for()
316 pd_print_error(disk, msg, e); pd_wait_for()
320 static void pd_send_command(struct pd_unit *disk, int n, int s, int h, int c0, int c1, int func) pd_send_command() argument
322 write_reg(disk, 6, DRIVE(disk) + h); pd_send_command()
323 write_reg(disk, 1, 0); /* the IDE task file */ pd_send_command()
324 write_reg(disk, 2, n); pd_send_command()
325 write_reg(disk, 3, s); pd_send_command()
326 write_reg(disk, 4, c0); pd_send_command()
327 write_reg(disk, 5, c1); pd_send_command()
328 write_reg(disk, 7, func); pd_send_command()
333 static void pd_ide_command(struct pd_unit *disk, int func, int block, int count) pd_ide_command() argument
337 if (disk->can_lba) { pd_ide_command()
343 s = (block % disk->sectors) + 1; pd_ide_command()
344 h = (block /= disk->sectors) % disk->heads; pd_ide_command()
345 c0 = (block /= disk->heads) % 256; pd_ide_command()
348 pd_send_command(disk, count, s, h, c0, c1, func); pd_ide_command()
589 static void pd_init_dev_parms(struct pd_unit *disk) pd_init_dev_parms() argument
591 pd_wait_for(disk, 0, DBMSG("before init_dev_parms")); pd_init_dev_parms()
592 pd_send_command(disk, disk->sectors, 0, disk->heads - 1, 0, 0, pd_init_dev_parms()
595 pd_wait_for(disk, 0, "Initialise device parameters"); pd_init_dev_parms()
598 static enum action pd_door_lock(struct pd_unit *disk) pd_door_lock() argument
600 if (!(pd_wait_for(disk, STAT_READY, "Lock") & STAT_ERR)) { pd_door_lock()
601 pd_send_command(disk, 1, 0, 0, 0, 0, IDE_DOORLOCK); pd_door_lock()
602 pd_wait_for(disk, STAT_READY, "Lock done"); pd_door_lock()
607 static enum action pd_door_unlock(struct pd_unit *disk) pd_door_unlock() argument
609 if (!(pd_wait_for(disk, STAT_READY, "Lock") & STAT_ERR)) { pd_door_unlock()
610 pd_send_command(disk, 1, 0, 0, 0, 0, IDE_DOORUNLOCK); pd_door_unlock()
611 pd_wait_for(disk, STAT_READY, "Lock done"); pd_door_unlock()
616 static enum action pd_eject(struct pd_unit *disk) pd_eject() argument
618 pd_wait_for(disk, 0, DBMSG("before unlock on eject")); pd_eject()
619 pd_send_command(disk, 1, 0, 0, 0, 0, IDE_DOORUNLOCK); pd_eject()
620 pd_wait_for(disk, 0, DBMSG("after unlock on eject")); pd_eject()
621 pd_wait_for(disk, 0, DBMSG("before eject")); pd_eject()
622 pd_send_command(disk, 0, 0, 0, 0, 0, IDE_EJECT); pd_eject()
623 pd_wait_for(disk, 0, DBMSG("after eject")); pd_eject()
627 static enum action pd_media_check(struct pd_unit *disk) pd_media_check() argument
629 int r = pd_wait_for(disk, STAT_READY, DBMSG("before media_check")); pd_media_check()
631 pd_send_command(disk, 1, 1, 0, 0, 0, IDE_READ_VRFY); pd_media_check()
632 r = pd_wait_for(disk, STAT_READY, DBMSG("RDY after READ_VRFY")); pd_media_check()
634 disk->changed = 1; /* say changed if other error */ pd_media_check()
636 disk->changed = 1; pd_media_check()
637 pd_send_command(disk, 1, 0, 0, 0, 0, IDE_ACKCHANGE); pd_media_check()
638 pd_wait_for(disk, STAT_READY, DBMSG("RDY after ACKCHANGE")); pd_media_check()
639 pd_send_command(disk, 1, 1, 0, 0, 0, IDE_READ_VRFY); pd_media_check()
640 r = pd_wait_for(disk, STAT_READY, DBMSG("RDY after VRFY")); pd_media_check()
645 static void pd_standby_off(struct pd_unit *disk) pd_standby_off() argument
647 pd_wait_for(disk, 0, DBMSG("before STANDBY")); pd_standby_off()
648 pd_send_command(disk, 0, 0, 0, 0, 0, IDE_STANDBY); pd_standby_off()
649 pd_wait_for(disk, 0, DBMSG("after STANDBY")); pd_standby_off()
652 static enum action pd_identify(struct pd_unit *disk) pd_identify() argument
663 if (disk->drive == 0) pd_identify()
664 pd_reset(disk); pd_identify()
666 write_reg(disk, 6, DRIVE(disk)); pd_identify()
667 pd_wait_for(disk, 0, DBMSG("before IDENT")); pd_identify()
668 pd_send_command(disk, 1, 0, 0, 0, 0, IDE_IDENTIFY); pd_identify()
670 if (pd_wait_for(disk, STAT_DRQ, DBMSG("IDENT DRQ")) & STAT_ERR) pd_identify()
672 pi_read_block(disk->pi, pd_scratch, 512); pd_identify()
673 disk->can_lba = pd_scratch[99] & 2; pd_identify()
674 disk->sectors = le16_to_cpu(*(__le16 *) (pd_scratch + 12)); pd_identify()
675 disk->heads = le16_to_cpu(*(__le16 *) (pd_scratch + 6)); pd_identify()
676 disk->cylinders = le16_to_cpu(*(__le16 *) (pd_scratch + 2)); pd_identify()
677 if (disk->can_lba) pd_identify()
678 disk->capacity = le32_to_cpu(*(__le32 *) (pd_scratch + 120)); pd_identify()
680 disk->capacity = disk->sectors * disk->heads * disk->cylinders; pd_identify()
690 disk->removable = pd_scratch[0] & 0x80; pd_identify()
693 disk->name, id, pd_identify()
694 disk->drive ? "slave" : "master", pd_identify()
695 disk->capacity, disk->capacity / 2048, pd_identify()
696 disk->cylinders, disk->heads, disk->sectors, pd_identify()
697 disk->removable ? "removable" : "fixed"); pd_identify()
699 if (disk->capacity) pd_identify()
700 pd_init_dev_parms(disk); pd_identify()
701 if (!disk->standby) pd_identify()
702 pd_standby_off(disk); pd_identify()
720 static int pd_special_command(struct pd_unit *disk, pd_special_command() argument
721 enum action (*func)(struct pd_unit *disk)) pd_special_command()
726 rq = blk_get_request(disk->gd->queue, READ, __GFP_RECLAIM); pd_special_command()
733 err = blk_execute_rq(disk->gd->queue, disk->gd, rq, 0); pd_special_command()
743 struct pd_unit *disk = bdev->bd_disk->private_data; pd_open() local
746 disk->access++; pd_open()
748 if (disk->removable) { pd_open()
749 pd_special_command(disk, pd_media_check); pd_open()
750 pd_special_command(disk, pd_door_lock); pd_open()
758 struct pd_unit *disk = bdev->bd_disk->private_data; pd_getgeo() local
760 if (disk->alt_geom) { pd_getgeo()
763 geo->cylinders = disk->capacity / (geo->heads * geo->sectors); pd_getgeo()
765 geo->heads = disk->heads; pd_getgeo()
766 geo->sectors = disk->sectors; pd_getgeo()
767 geo->cylinders = disk->cylinders; pd_getgeo()
776 struct pd_unit *disk = bdev->bd_disk->private_data; pd_ioctl() local
781 if (disk->access == 1) pd_ioctl()
782 pd_special_command(disk, pd_eject); pd_ioctl()
792 struct pd_unit *disk = p->private_data; pd_release() local
795 if (!--disk->access && disk->removable) pd_release()
796 pd_special_command(disk, pd_door_unlock); pd_release()
802 struct pd_unit *disk = p->private_data; pd_check_events() local
804 if (!disk->removable) pd_check_events()
806 pd_special_command(disk, pd_media_check); pd_check_events()
807 r = disk->changed; pd_check_events()
808 disk->changed = 0; pd_check_events()
814 struct pd_unit *disk = p->private_data; pd_revalidate() local
815 if (pd_special_command(disk, pd_identify) == 0) pd_revalidate()
816 set_capacity(p, disk->capacity); pd_revalidate()
834 static void pd_probe_drive(struct pd_unit *disk) pd_probe_drive() argument
839 strcpy(p->disk_name, disk->name); pd_probe_drive()
842 p->first_minor = (disk - pd) << PD_BITS; pd_probe_drive()
843 disk->gd = p; pd_probe_drive()
844 p->private_data = disk; pd_probe_drive()
847 if (disk->drive == -1) { pd_probe_drive()
848 for (disk->drive = 0; disk->drive <= 1; disk->drive++) pd_probe_drive()
849 if (pd_special_command(disk, pd_identify) == 0) pd_probe_drive()
851 } else if (pd_special_command(disk, pd_identify) == 0) pd_probe_drive()
853 disk->gd = NULL; pd_probe_drive()
860 struct pd_unit *disk; pd_detect() local
864 struct pd_unit *disk = pd + unit; pd_detect() local
865 disk->pi = &disk->pia; pd_detect()
866 disk->access = 0; pd_detect()
867 disk->changed = 1; pd_detect()
868 disk->capacity = 0; pd_detect()
869 disk->drive = parm[D_SLV]; pd_detect()
870 snprintf(disk->name, PD_NAMELEN, "%s%c", name, 'a'+unit); pd_detect()
871 disk->alt_geom = parm[D_GEO]; pd_detect()
872 disk->standby = parm[D_SBY]; pd_detect()
884 disk = pd; pd_detect()
885 if (pi_init(disk->pi, 1, -1, -1, -1, -1, -1, pd_scratch, pd_detect()
886 PI_PD, verbose, disk->name)) { pd_detect()
887 pd_probe_drive(disk); pd_detect()
888 if (!disk->gd) pd_detect()
889 pi_release(disk->pi); pd_detect()
893 for (unit = 0, disk = pd; unit < PD_UNITS; unit++, disk++) { pd_detect()
897 if (pi_init(disk->pi, 0, parm[D_PRT], parm[D_MOD], pd_detect()
899 pd_scratch, PI_PD, verbose, disk->name)) { pd_detect()
900 pd_probe_drive(disk); pd_detect()
901 if (!disk->gd) pd_detect()
902 pi_release(disk->pi); pd_detect()
906 for (unit = 0, disk = pd; unit < PD_UNITS; unit++, disk++) { pd_detect()
907 if (disk->gd) { pd_detect()
908 set_capacity(disk->gd, disk->capacity); pd_detect()
909 add_disk(disk->gd); pd_detect()
951 struct pd_unit *disk; pd_exit() local
954 for (unit = 0, disk = pd; unit < PD_UNITS; unit++, disk++) { pd_exit()
955 struct gendisk *p = disk->gd; pd_exit()
957 disk->gd = NULL; pd_exit()
960 pi_release(disk->pi); pd_exit()
H A Dpcd.c201 struct gendisk *disk; member in struct:pcd_unit
240 static void pcd_block_release(struct gendisk *disk, fmode_t mode) pcd_block_release() argument
242 struct pcd_unit *cd = disk->private_data; pcd_block_release()
261 static unsigned int pcd_block_check_events(struct gendisk *disk, pcd_block_check_events() argument
264 struct pcd_unit *cd = disk->private_data; pcd_block_check_events()
300 struct gendisk *disk = alloc_disk(1); pcd_init_units() local
301 if (!disk) pcd_init_units()
303 cd->disk = disk; pcd_init_units()
319 disk->major = major; pcd_init_units()
320 disk->first_minor = unit; pcd_init_units()
321 strcpy(disk->disk_name, cd->name); /* umm... */ pcd_init_units()
322 disk->fops = &pcd_bdops; pcd_init_units()
323 disk->flags = GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE; pcd_init_units()
705 if (!pcd_probe(cd, -1, id) && cd->disk) { pcd_detect()
720 if (!pcd_probe(cd, conf[D_SLV], id) && cd->disk) { pcd_detect()
732 put_disk(cd->disk); pcd_detect()
956 put_disk(cd->disk); pcd_init()
964 put_disk(cd->disk); pcd_init()
971 cd->disk->private_data = cd; pcd_init()
972 cd->disk->queue = pcd_queue; pcd_init()
973 add_disk(cd->disk); pcd_init()
987 del_gendisk(cd->disk); pcd_exit()
991 put_disk(cd->disk); pcd_exit()
H A Dpf.c5 This is the high-level driver for parallel port ATAPI disk
9 port ATAPI disk drive, but if their individual parameters are
214 static void pf_release(struct gendisk *disk, fmode_t mode);
240 struct gendisk *disk; member in struct:pf_unit
248 static unsigned int pf_check_events(struct gendisk *disk,
287 struct gendisk *disk = alloc_disk(1); pf_init_units() local
288 if (!disk) pf_init_units()
290 pf->disk = disk; pf_init_units()
296 disk->major = major; pf_init_units()
297 disk->first_minor = unit; pf_init_units()
298 strcpy(disk->disk_name, pf->name); pf_init_units()
299 disk->fops = &pf_fops; pf_init_units()
333 sector_t capacity = get_capacity(pf->disk); pf_getgeo()
364 static void pf_release(struct gendisk *disk, fmode_t mode) pf_release() argument
366 struct pf_unit *pf = disk->private_data; pf_release()
383 static unsigned int pf_check_events(struct gendisk *disk, unsigned int clearing) pf_check_events() argument
614 set_capacity(pf->disk, xl(buf, 0) + 1); pf_get_capacity()
617 set_capacity(pf->disk, 0); pf_get_capacity()
667 (unsigned long long)get_capacity(pf->disk)); pf_identify()
716 if (!pf_probe(pf) && pf->disk) { pf_detect()
731 if (pf->disk && !pf_probe(pf)) { pf_detect()
741 printk("%s: No ATAPI disk detected\n", name); pf_detect()
743 put_disk(pf->disk); pf_detect()
972 put_disk(pf->disk); pf_init()
979 put_disk(pf->disk); pf_init()
986 struct gendisk *disk = pf->disk; pf_init() local
990 disk->private_data = pf; pf_init()
991 disk->queue = pf_queue; pf_init()
992 add_disk(disk); pf_init()
1005 del_gendisk(pf->disk); pf_exit()
1006 put_disk(pf->disk); pf_exit()
/linux-4.4.14/arch/powerpc/include/uapi/asm/
H A Dfcntl.h7 #define O_DIRECT 0400000 /* direct disk access hint */
/linux-4.4.14/fs/quota/
H A Dquotaio_v1.h16 * The following structure defines the format of the disk quota file
17 * (as it appears on disk) - the file is an array of these structures
21 __u32 dqb_bhardlimit; /* absolute limit on disk blks alloc */
22 __u32 dqb_bsoftlimit; /* preferred limit on disk blks */
27 time_t dqb_btime; /* time limit for excessive disk use */
H A Dquotaio_v2.h33 * The following structure defines the format of the disk quota file
34 * (as it appears on disk) - the file is a radix tree whose leaves point
42 __le32 dqb_bhardlimit; /* absolute limit on disk space (in QUOTABLOCK_SIZE) */
43 __le32 dqb_bsoftlimit; /* preferred limit on disk space (in QUOTABLOCK_SIZE) */
45 __le64 dqb_btime; /* time limit for excessive disk use */
55 __le64 dqb_bhardlimit; /* absolute limit on disk space (in QUOTABLOCK_SIZE) */
56 __le64 dqb_bsoftlimit; /* preferred limit on disk space (in QUOTABLOCK_SIZE) */
58 __le64 dqb_btime; /* time limit for excessive disk use */
/linux-4.4.14/drivers/md/bcache/
H A Dwriteback.c23 struct cache_set *c = dc->disk.c; __update_writeback_rate()
33 int64_t dirty = bcache_dev_sectors_dirty(&dc->disk); __update_writeback_rate()
34 int64_t derivative = dirty - dc->disk.sectors_dirty_last; __update_writeback_rate()
38 dc->disk.sectors_dirty_last = dirty; __update_writeback_rate()
47 derivative = ewma_add(dc->disk.sectors_dirty_derivative, derivative, __update_writeback_rate()
92 if (test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags) || writeback_delay()
151 atomic_inc(&PTR_BUCKET(dc->disk.c, &w->key, i)->pin); write_dirty_finish()
153 ret = bch_btree_insert(dc->disk.c, &keys, NULL, &w->key); write_dirty_finish()
159 ? &dc->disk.c->writeback_keys_failed write_dirty_finish()
160 : &dc->disk.c->writeback_keys_done); write_dirty_finish()
201 bch_count_io_errors(PTR_CACHE(io->dc->disk.c, &w->key, 0), read_dirty_endio()
237 BUG_ON(ptr_stale(dc->disk.c, &w->key, 0)); read_dirty()
257 io->bio.bi_bdev = PTR_CACHE(dc->disk.c, read_dirty()
328 BUG_ON(KEY_INODE(k) != dc->disk.id); dirty_pred()
339 stripe = offset_to_stripe(&dc->disk, KEY_OFFSET(&buf->last_scanned)); refill_full_stripes()
341 if (stripe >= dc->disk.nr_stripes) refill_full_stripes()
347 stripe = find_next_bit(dc->disk.full_dirty_stripes, refill_full_stripes()
348 dc->disk.nr_stripes, stripe); refill_full_stripes()
350 if (stripe == dc->disk.nr_stripes) refill_full_stripes()
353 next_stripe = find_next_zero_bit(dc->disk.full_dirty_stripes, refill_full_stripes()
354 dc->disk.nr_stripes, stripe); refill_full_stripes()
356 buf->last_scanned = KEY(dc->disk.id, refill_full_stripes()
357 stripe * dc->disk.stripe_size, 0); refill_full_stripes()
359 bch_refill_keybuf(dc->disk.c, buf, refill_full_stripes()
360 &KEY(dc->disk.id, refill_full_stripes()
361 next_stripe * dc->disk.stripe_size, 0), refill_full_stripes()
372 if (stripe == dc->disk.nr_stripes) { refill_full_stripes()
380 * Returns true if we scanned the entire disk
385 struct bkey start = KEY(dc->disk.id, 0, 0); refill_dirty()
386 struct bkey end = KEY(dc->disk.id, MAX_KEY_OFFSET, 0); refill_dirty()
390 * make sure keybuf pos is inside the range for this disk - at bringup refill_dirty()
391 * we might not be attached yet so this disk's inode nr isn't refill_dirty()
405 bch_refill_keybuf(dc->disk.c, buf, &end, dirty_pred); refill_dirty()
415 bch_refill_keybuf(dc->disk.c, buf, &start_pos, dirty_pred); refill_dirty()
428 (!test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags) && bch_writeback_thread()
461 !test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags)) bch_writeback_thread()
496 op.inode = dc->disk.id; bch_sectors_dirty_init()
498 bch_btree_map_keys(&op.op, dc->disk.c, &KEY(op.inode, 0, 0), bch_sectors_dirty_init()
501 dc->disk.sectors_dirty_last = bcache_dev_sectors_dirty(&dc->disk); bch_sectors_dirty_init()
H A Dwriteback.h28 unsigned stripe = offset_to_stripe(&dc->disk, offset); bcache_dev_stripe_dirty()
31 if (atomic_read(dc->disk.stripe_sectors_dirty + stripe)) bcache_dev_stripe_dirty()
34 if (nr_sectors <= dc->disk.stripe_size) bcache_dev_stripe_dirty()
37 nr_sectors -= dc->disk.stripe_size; bcache_dev_stripe_dirty()
45 unsigned in_use = dc->disk.c->gc_stats.in_use; should_writeback()
48 test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags) || should_writeback()
H A Dsuper.c468 * For each bucket, we store on disk its
481 * On disk they're stored in a packed array, and in as many buckets are required
489 * disk.
669 bd_unlink_disk_holder(ca->bdev, d->disk); bcache_device_unlink()
680 bd_link_disk_holder(ca->bdev, d->disk); bcache_device_link()
726 pr_info("%s stopped", d->disk->disk_name); bcache_device_free()
730 if (d->disk && d->disk->flags & GENHD_FL_UP) bcache_device_free()
731 del_gendisk(d->disk); bcache_device_free()
732 if (d->disk && d->disk->queue) bcache_device_free()
733 blk_cleanup_queue(d->disk->queue); bcache_device_free()
734 if (d->disk) { bcache_device_free()
735 ida_simple_remove(&bcache_minor, d->disk->first_minor); bcache_device_free()
736 put_disk(d->disk); bcache_device_free()
785 !(d->disk = alloc_disk(1))) { bcache_device_init()
790 set_capacity(d->disk, sectors); bcache_device_init()
791 snprintf(d->disk->disk_name, DISK_NAME_LEN, "bcache%i", minor); bcache_device_init()
793 d->disk->major = bcache_major; bcache_device_init()
794 d->disk->first_minor = minor; bcache_device_init()
795 d->disk->fops = &bcache_ops; bcache_device_init()
796 d->disk->private_data = d; bcache_device_init()
803 d->disk->queue = q; bcache_device_init()
815 set_bit(QUEUE_FLAG_NONROT, &d->disk->queue->queue_flags); bcache_device_init()
816 clear_bit(QUEUE_FLAG_ADD_RANDOM, &d->disk->queue->queue_flags); bcache_device_init()
817 set_bit(QUEUE_FLAG_DISCARD, &d->disk->queue->queue_flags); bcache_device_init()
839 struct bcache_device *d = &dc->disk; bch_cached_dev_run()
868 add_disk(d->disk); bch_cached_dev_run()
869 bd_link_disk_holder(dc->bdev, dc->disk.disk); bch_cached_dev_run()
872 kobject_uevent_env(&disk_to_dev(d->disk)->kobj, KOBJ_CHANGE, env); bch_cached_dev_run()
876 if (sysfs_create_link(&d->kobj, &disk_to_dev(d->disk)->kobj, "dev") || bch_cached_dev_run()
877 sysfs_create_link(&disk_to_dev(d->disk)->kobj, &d->kobj, "bcache")) bch_cached_dev_run()
888 BUG_ON(!test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags)); cached_dev_detach_finish()
899 bcache_device_detach(&dc->disk); cached_dev_detach_finish()
902 clear_bit(BCACHE_DEV_DETACHING, &dc->disk.flags); cached_dev_detach_finish()
903 clear_bit(BCACHE_DEV_UNLINK_DONE, &dc->disk.flags); cached_dev_detach_finish()
910 closure_put(&dc->disk.cl); cached_dev_detach_finish()
917 if (test_bit(BCACHE_DEV_CLOSING, &dc->disk.flags)) bch_cached_dev_detach()
920 if (test_and_set_bit(BCACHE_DEV_DETACHING, &dc->disk.flags)) bch_cached_dev_detach()
927 closure_get(&dc->disk.cl); bch_cached_dev_detach()
944 if (dc->disk.c) { bch_cached_dev_attach()
1007 bcache_device_attach(&dc->disk, c, u - c->uuids); bch_cached_dev_attach()
1033 bcache_device_link(&dc->disk, c, "bdev"); bch_cached_dev_attach()
1039 bdevname(dc->bdev, buf), dc->disk.disk->disk_name, bch_cached_dev_attach()
1040 dc->disk.c->sb.set_uuid); bch_cached_dev_attach()
1047 disk.kobj); bch_cached_dev_release()
1054 struct cached_dev *dc = container_of(cl, struct cached_dev, disk.cl); cached_dev_free()
1063 bd_unlink_disk_holder(dc->bdev, dc->disk.disk); cached_dev_free()
1064 bcache_device_free(&dc->disk); cached_dev_free()
1074 kobject_put(&dc->disk.kobj); cached_dev_free()
1079 struct cached_dev *dc = container_of(cl, struct cached_dev, disk.cl); cached_dev_flush()
1080 struct bcache_device *d = &dc->disk; cached_dev_flush()
1100 closure_init(&dc->disk.cl, NULL); cached_dev_init()
1101 set_closure_fn(&dc->disk.cl, cached_dev_flush, system_wq); cached_dev_init()
1102 kobject_init(&dc->disk.kobj, &bch_cached_dev_ktype); cached_dev_init()
1107 bch_cache_accounting_init(&dc->accounting, &dc->disk.cl); cached_dev_init()
1116 dc->disk.stripe_size = q->limits.io_opt >> 9; cached_dev_init()
1118 if (dc->disk.stripe_size) cached_dev_init()
1122 ret = bcache_device_init(&dc->disk, block_size, cached_dev_init()
1127 set_capacity(dc->disk.disk, cached_dev_init()
1130 dc->disk.disk->queue->backing_dev_info.ra_pages = cached_dev_init()
1131 max(dc->disk.disk->queue->backing_dev_info.ra_pages, cached_dev_init()
1163 if (kobject_add(&dc->disk.kobj, &part_to_dev(bdev->bd_part)->kobj, register_bdev()
1166 if (bch_cache_accounting_add_kobjs(&dc->accounting, &dc->disk.kobj)) register_bdev()
1182 bcache_device_stop(&dc->disk); register_bdev()
1231 add_disk(d->disk); flash_dev_run()
1233 if (kobject_add(&d->kobj, &disk_to_dev(d->disk)->kobj, "bcache")) flash_dev_run()
1424 struct cached_dev, disk); __cache_set_unregister()
2030 bcache_device_stop(&dc->disk); bcache_reboot()
H A Dsysfs.c112 disk.kobj); SHOW()
122 sysfs_printf(data_csum, "%i", dc->disk.data_csum); SHOW()
145 bch_hprint(dirty, bcache_dev_sectors_dirty(&dc->disk) << 9); SHOW()
167 bcache_dev_sectors_dirty(&dc->disk) << 9); SHOW()
169 sysfs_hprint(stripe_size, dc->disk.stripe_size << 9); SHOW()
193 disk.kobj); SHOW_LOCKED()
202 sysfs_strtoul(data_csum, dc->disk.data_csum); SHOW_LOCKED()
249 if (dc->disk.c) { SHOW_LOCKED()
250 memcpy(dc->disk.c->uuids[dc->disk.id].label, SHOW_LOCKED()
252 bch_uuid_write(dc->disk.c); SHOW_LOCKED()
261 &disk_to_dev(dc->disk.disk)->kobj, KOBJ_CHANGE, env->envp); SHOW_LOCKED()
279 if (attr == &sysfs_detach && dc->disk.c) SHOW_LOCKED()
283 bcache_device_stop(&dc->disk); SHOW_LOCKED()
291 disk.kobj); STORE()
374 set_capacity(d->disk, u->sectors); STORE()
H A Drequest.c373 struct cache_set *c = dc->disk.c; check_should_bypass()
379 if (test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags) || check_should_bypass()
613 &s->d->disk->part0, s->start_time); bio_complete()
682 struct cached_dev *dc = container_of(s->d, struct cached_dev, disk); cached_dev_bio_complete()
731 struct cached_dev *dc = container_of(s->d, struct cached_dev, disk); cached_dev_read_done()
771 struct cached_dev *dc = container_of(s->d, struct cached_dev, disk); cached_dev_read_done_bh()
790 struct cached_dev *dc = container_of(s->d, struct cached_dev, disk); cached_dev_cache_miss()
824 dc->disk.bio_split); cached_dev_cache_miss()
870 struct cached_dev *dc = container_of(s->d, struct cached_dev, disk); cached_dev_write_complete()
880 struct bkey start = KEY(dc->disk.id, bio->bi_iter.bi_sector, 0); cached_dev_write()
881 struct bkey end = KEY(dc->disk.id, bio_end_sector(bio), 0); cached_dev_write()
926 dc->disk.bio_split); cached_dev_write()
936 s->iop.bio = bio_clone_fast(bio, GFP_NOIO, dc->disk.bio_split); cached_dev_write()
966 struct cached_dev *dc = container_of(d, struct cached_dev, disk); cached_dev_make_request()
969 generic_start_io_acct(rw, bio_sectors(bio), &d->disk->part0); cached_dev_make_request()
1008 struct cached_dev *dc = container_of(d, struct cached_dev, disk); cached_dev_ioctl()
1015 struct cached_dev *dc = container_of(d, struct cached_dev, disk); cached_dev_congested()
1039 struct gendisk *g = dc->disk.disk; bch_cached_dev_request_init()
1043 dc->disk.cache_miss = cached_dev_cache_miss; bch_cached_dev_request_init()
1044 dc->disk.ioctl = cached_dev_ioctl; bch_cached_dev_request_init()
1084 generic_start_io_acct(rw, bio_sectors(bio), &d->disk->part0); flash_dev_make_request()
1143 struct gendisk *g = d->disk; bch_flash_dev_request_init()
H A Dstats.c201 struct cached_dev *dc = container_of(d, struct cached_dev, disk); bch_mark_cache_accounting()
208 struct cached_dev *dc = container_of(d, struct cached_dev, disk); bch_mark_cache_readahead()
215 struct cached_dev *dc = container_of(d, struct cached_dev, disk); bch_mark_cache_miss_collision()
H A Ddebug.c84 printk(KERN_ERR "*** on disk block %u:\n", block); for_each_written_bset()
129 dc->disk.c, bio_for_each_segment()
/linux-4.4.14/arch/powerpc/sysdev/
H A Daxonram.c63 struct gendisk *disk; member in struct:axon_ram_bank
216 bank->disk = alloc_disk(AXON_RAM_MINORS_PER_DISK); axon_ram_probe()
217 if (bank->disk == NULL) { axon_ram_probe()
218 dev_err(&device->dev, "Cannot register disk\n"); axon_ram_probe()
223 bank->disk->major = azfs_major; axon_ram_probe()
224 bank->disk->first_minor = azfs_minor; axon_ram_probe()
225 bank->disk->fops = &axon_ram_devops; axon_ram_probe()
226 bank->disk->private_data = bank; axon_ram_probe()
227 bank->disk->driverfs_dev = &device->dev; axon_ram_probe()
229 sprintf(bank->disk->disk_name, "%s%d", axon_ram_probe()
232 bank->disk->queue = blk_alloc_queue(GFP_KERNEL); axon_ram_probe()
233 if (bank->disk->queue == NULL) { axon_ram_probe()
234 dev_err(&device->dev, "Cannot register disk queue\n"); axon_ram_probe()
239 set_capacity(bank->disk, bank->size >> AXON_RAM_SECTOR_SHIFT); axon_ram_probe()
240 blk_queue_make_request(bank->disk->queue, axon_ram_make_request); axon_ram_probe()
241 blk_queue_logical_block_size(bank->disk->queue, AXON_RAM_SECTOR_SIZE); axon_ram_probe()
242 add_disk(bank->disk); axon_ram_probe()
252 AXON_RAM_IRQ_FLAGS, bank->disk->disk_name, device); axon_ram_probe()
267 azfs_minor += bank->disk->minors; axon_ram_probe()
275 if (bank->disk != NULL) { axon_ram_probe()
276 if (bank->disk->major > 0) axon_ram_probe()
277 unregister_blkdev(bank->disk->major, axon_ram_probe()
278 bank->disk->disk_name); axon_ram_probe()
279 del_gendisk(bank->disk); axon_ram_probe()
299 BUG_ON(!bank || !bank->disk); axon_ram_remove()
303 del_gendisk(bank->disk); axon_ram_remove()
/linux-4.4.14/drivers/md/persistent-data/
H A DMakefile7 dm-space-map-disk.o \
H A Ddm-array.h15 * more efficiently than a btree which will result in less disk space use,
39 * disk that holds a particular instance of an array. You may have a
98 * root - the root block of the array on disk
126 * value - the value to be read. Will be in on-disk format of course.
139 * value - value to be written to disk. Make sure you confirm the value is
140 * in on-disk format with__dm_bless_for_disk() before calling.
H A Ddm-transaction-manager.h19 * of the on-disk data structures by limiting access to writeable blocks.
42 * Then call dm_tm_pre_commit() to flush them to disk.
122 * Returns a tm that has an open transaction to write the new disk sm.
H A Ddm-block-manager.h71 * written back to the disk sometime after dm_bm_unlock is called.
91 * overwrite the block completely. It saves a disk read.
H A Ddm-space-map-disk.c8 #include "dm-space-map-disk.h"
17 #define DM_MSG_PREFIX "space map disk"
H A Ddm-space-map.h16 * is referenced. It needs to be fixed on disk as part of the transaction.
59 * Generally this info is small, so squirrel it away in a disk block
/linux-4.4.14/include/linux/
H A Dblkpg.h5 * Partition table and disk geometry handling
H A Ddqblk_qtree.h21 void (*mem2disk_dqblk)(void *disk, struct dquot *dquot); /* Convert given entry from in memory format to disk one */
22 void (*disk2mem_dqblk)(struct dquot *dquot, void *disk); /* Convert given entry from disk format to in memory one */
23 int (*is_id)(void *disk, struct dquot *dquot); /* Is this structure for given id? */
44 int qtree_entry_unused(struct qtree_mem_dqinfo *info, char *disk); qtree_depth()
H A Dgenhd.h6 * Generic hard disk header file by
22 #define disk_to_dev(disk) (&(disk)->part0.__dev)
253 static inline int disk_max_parts(struct gendisk *disk) disk_max_parts() argument
255 if (disk->flags & GENHD_FL_EXT_DEVT) disk_max_parts()
257 return disk->minors; disk_max_parts()
260 static inline bool disk_part_scan_enabled(struct gendisk *disk) disk_part_scan_enabled() argument
262 return disk_max_parts(disk) > 1 && disk_part_scan_enabled()
263 !(disk->flags & GENHD_FL_NO_PART_SCAN); disk_part_scan_enabled()
266 static inline dev_t disk_devt(struct gendisk *disk) disk_devt() argument
268 return disk_to_dev(disk)->devt; disk_devt()
276 extern struct hd_struct *disk_get_part(struct gendisk *disk, int partno);
293 struct gendisk *disk; member in struct:disk_part_iter
300 struct gendisk *disk, unsigned int flags);
304 extern struct hd_struct *disk_map_sector_rcu(struct gendisk *disk,
308 * Macros to operate on percpu disk statistics:
310 * {disk|part|all}_stat_{add|sub|inc|dec}() modify the stat counters
415 static inline struct partition_meta_info *alloc_part_info(struct gendisk *disk) alloc_part_info() argument
417 if (disk) alloc_part_info()
419 GFP_KERNEL, disk->node_id); alloc_part_info()
432 extern void add_disk(struct gendisk *disk);
435 extern struct block_device *bdget_disk(struct gendisk *disk, int partno);
438 extern void set_disk_ro(struct gendisk *disk, int flag);
440 static inline int get_disk_ro(struct gendisk *disk) get_disk_ro() argument
442 return disk->part0.policy; get_disk_ro()
445 extern void disk_block_events(struct gendisk *disk);
446 extern void disk_unblock_events(struct gendisk *disk);
447 extern void disk_flush_events(struct gendisk *disk, unsigned int mask);
448 extern unsigned int disk_clear_events(struct gendisk *disk, unsigned int mask);
451 extern void add_disk_randomness(struct gendisk *disk);
452 extern void rand_initialize_disk(struct gendisk *disk);
458 static inline sector_t get_capacity(struct gendisk *disk) get_capacity() argument
460 return disk->part0.nr_sects; get_capacity()
462 static inline void set_capacity(struct gendisk *disk, sector_t size) set_capacity() argument
464 disk->part0.nr_sects = size; set_capacity()
503 #define BSD_DISKMAGIC (0x82564557UL) /* The disk magic number */
558 #define UNIXWARE_DISKMAGIC (0xCA5E600DUL) /* The disk magic number */
619 extern int disk_expand_part_tbl(struct gendisk *disk, int target);
620 extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev);
621 extern int invalidate_partitions(struct gendisk *disk, struct block_device *bdev);
622 extern struct hd_struct * __must_check add_partition(struct gendisk *disk,
633 extern struct kobject *get_disk(struct gendisk *disk);
634 extern void put_disk(struct gendisk *disk);
747 static inline void blk_integrity_add(struct gendisk *disk) { } blk_integrity_del() argument
748 static inline void blk_integrity_del(struct gendisk *disk) { } blk_integrity_revalidate() argument
749 static inline void blk_integrity_revalidate(struct gendisk *disk) { } blk_integrity_revalidate() argument
H A Damifd.h50 int blocks; /* total # blocks on disk */
53 int disk; /* disk in drive (-1 == unknown) */ member in struct:amiga_floppy_struct
56 int dirty; /* true when trackbuf is not on disk */
H A Damifdreg.h8 #define DSKRDY (0x1<<5) /* disk ready when low */
10 #define DSKPROT (0x1<<3) /* disk protected when low */
11 #define DSKCHANGE (0x1<<2) /* low when disk removed */
31 #define DMAON (1<<14) /* disk DMA enabled */
32 #define DISKWRITE (1<<13) /* disk write bit in DSKLEN enabled */
H A Dadfs_fs.h9 * the disk size is non-zero!!!
H A Dtask_io_accounting.h32 * written to disk.
H A Dmg_disk.h35 /* disk resource */
H A Dsysv_fs.h25 /* Xenix super-block data on disk */
65 /* SystemV4 super-block data on disk */
97 /* SystemV2 super-block data on disk */
125 /* V7 super-block data on disk */
158 /* The disk addresses are three-byte (despite direct block addresses being
163 /* Coherent super-block data on disk */
190 /* SystemV/Coherent inode data on disk */
204 /* SystemV/Coherent directory entry on disk */
H A Ddrbd_limits.h60 /* If backing disk takes longer than disk_timeout, mark the disk as failed */
132 * If you use >= 292 kB on-disk ring buffer,
H A Dnilfs2_fs.h2 * nilfs2_fs.h - NILFS2 on-disk structures and common declarations.
49 * struct nilfs_inode - structure of an inode on disk
143 * struct nilfs_super_block - structure of super block on disk
162 __le64 s_first_data_block; /* 1st seg disk block number */
167 /*40*/ __le64 s_last_pseg; /* disk block addr pseg written last */
474 * struct nilfs_dat_entry - disk address translation entry
522 To keep the compatibility of the disk format,
841 * @vi_blocknr: disk block number
856 * @vd_blocknr: disk block number
873 * struct nilfs_bdesc - descriptor of disk block number
875 * @bd_oblocknr: disk block address (for skipping dead blocks)
876 * @bd_blocknr: disk block address
H A Dedd.h17 * information is used to identify BIOS boot disk. The code in setup.S
H A Dioprio.h24 * is only served when no one else is using the disk.
H A Dlru_cache.h51 We replicate IO (more or less synchronously) to local and remote disk.
60 This is known as "write intent log", and can be implemented as on-disk
65 in-flight WRITE IO, e.g. by only lazily clearing the on-disk write-intent
88 The on-disk "dirty bitmap" may be re-used as "write-intent" bitmap as well.
91 on-disk bitmap, while keeping the in-memory "dirty" bitmap as clean as
92 possible, flushing it to disk again when a previously "hot" (and on-disk
/linux-4.4.14/arch/m68k/include/uapi/asm/
H A Dfcntl.h6 #define O_DIRECT 0200000 /* direct disk access hint - currently ignored */
/linux-4.4.14/arch/blackfin/include/uapi/asm/
H A Dfcntl.h12 #define O_DIRECT 0200000 /* direct disk access hint - currently ignored */
/linux-4.4.14/arch/arm/include/uapi/asm/
H A Dfcntl.h6 #define O_DIRECT 0200000 /* direct disk access hint - currently ignored */
/linux-4.4.14/drivers/ide/
H A Dide-gd.c19 #include "ide-disk.h"
33 static struct ide_disk_obj *ide_disk_get(struct gendisk *disk) ide_disk_get() argument
38 idkp = ide_drv_g(disk, ide_disk_obj); ide_disk_get()
69 struct gendisk *g = idkp->disk; ide_gd_remove()
85 struct gendisk *g = idkp->disk; ide_disk_release()
96 * reinitialized on resume otherwise the disk
125 spin down the disk in this case, especially since Alpha
131 the disk to expire its write cache. */
185 struct gendisk *disk = bdev->bd_disk; ide_gd_open() local
190 idkp = ide_disk_get(disk); ide_gd_open()
204 ret = drive->disk_ops->init_media(drive, disk); ide_gd_open()
207 * Allow O_NDELAY to open a drive without a disk, or with an ide_gd_open()
208 * unreadable disk, so that we can get the format capacity ide_gd_open()
226 drive->disk_ops->set_doorlock(drive, disk, 1); ide_gd_open()
253 static void ide_gd_release(struct gendisk *disk, fmode_t mode) ide_gd_release() argument
255 struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); ide_gd_release()
265 drive->disk_ops->set_doorlock(drive, disk, 0); ide_gd_release()
286 static unsigned int ide_gd_check_events(struct gendisk *disk, ide_gd_check_events() argument
289 struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); ide_gd_check_events()
302 * genhd->events is 0. This is intended as removeable ide disk ide_gd_check_events()
311 static void ide_gd_unlock_native_capacity(struct gendisk *disk) ide_gd_unlock_native_capacity() argument
313 struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); ide_gd_unlock_native_capacity()
321 static int ide_gd_revalidate_disk(struct gendisk *disk) ide_gd_revalidate_disk() argument
323 struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); ide_gd_revalidate_disk()
326 if (ide_gd_check_events(disk, 0)) ide_gd_revalidate_disk()
329 set_capacity(disk, ide_gd_capacity(drive)); ide_gd_revalidate_disk()
382 printk(KERN_ERR PFX "%s: can't allocate a disk structure\n", ide_gd_probe()
402 idkp->disk = g; ide_gd_probe()
442 MODULE_ALIAS("ide:*m-disk*");
443 MODULE_ALIAS("ide-disk");
449 MODULE_DESCRIPTION("generic ATA/ATAPI disk driver");
H A Dide-gd.h19 struct gendisk *disk; member in struct:ide_disk_obj
36 /* Copy of the flexible disk page */
H A Dide-disk.h7 /* ide-disk.c */
H A Dide-disk_ioctl.c6 #include "ide-disk.h"
H A Dide-floppy.c306 * Look at the flexible disk page parameters. We ignore the CHS capacity
313 struct gendisk *disk = floppy->disk; ide_floppy_get_flexible_disk_page() local
321 if (ide_queue_pc_tail(drive, disk, pc, buf, pc->req_xfer)) { ide_floppy_get_flexible_disk_page()
322 printk(KERN_ERR PFX "Can't get flexible disk page params\n"); ide_floppy_get_flexible_disk_page()
331 set_disk_ro(disk, !!(drive->dev_flags & IDE_DFLAG_WP)); ide_floppy_get_flexible_disk_page()
357 printk(KERN_NOTICE PFX "%s: The disk reports a capacity of %d " ide_floppy_get_flexible_disk_page()
375 struct gendisk *disk = floppy->disk; ide_floppy_get_capacity() local
390 if (ide_queue_pc_tail(drive, disk, &pc, pc_buf, pc.req_xfer)) { ide_floppy_get_capacity()
455 printk(KERN_ERR PFX "%s: No disk in drive\n", ide_floppy_get_capacity()
459 printk(KERN_ERR PFX "%s: Invalid capacity for disk " ide_floppy_get_capacity()
467 /* Clik! disk does not support get_flexible_disk_page */ ide_floppy_get_capacity()
519 static int ide_floppy_init_media(ide_drive_t *drive, struct gendisk *disk) ide_floppy_init_media() argument
523 if (ide_do_test_unit_ready(drive, disk)) ide_floppy_init_media()
524 ide_do_start_stop(drive, disk, 1); ide_floppy_init_media()
528 set_capacity(disk, ide_gd_capacity(drive)); ide_floppy_init_media()
H A Dide-floppy_ioctl.c53 if (ide_queue_pc_tail(drive, floppy->disk, pc, pc_buf, pc->req_xfer)) { ide_floppy_get_format_capacities()
129 if (ide_queue_pc_tail(drive, floppy->disk, pc, buf, pc->req_xfer)) ide_floppy_get_sfrp_bit()
146 /* Don't format if someone is using the disk */ ide_floppy_format_unit()
178 if (ide_queue_pc_tail(drive, floppy->disk, pc, buf, pc->req_xfer)) ide_floppy_format_unit()
207 if (ide_queue_pc_tail(drive, floppy->disk, pc, sense_buf, ide_floppy_get_format_progress()
239 struct gendisk *disk = floppy->disk; ide_floppy_lockdoor() local
245 ide_set_media_lock(drive, disk, prevent); ide_floppy_lockdoor()
248 ide_do_start_stop(drive, disk, 2); ide_floppy_lockdoor()
H A Dide-tape.c143 struct gendisk *disk; member in struct:ide_tape_obj
231 static struct ide_tape_obj *ide_tape_get(struct gendisk *disk, bool cdev, ide_tape_get() argument
241 tape = ide_drv_g(disk, ide_tape_obj); ide_tape_get()
684 struct gendisk *disk = tape->disk; idetape_wait_ready() local
691 if (ide_do_test_unit_ready(drive, disk) == 0) idetape_wait_ready()
698 ide_do_start_stop(drive, disk, IDETAPE_LU_LOAD_MASK); idetape_wait_ready()
716 rc = ide_queue_pc_tail(drive, tape->disk, &pc, NULL, 0); idetape_flush_tape_buffers()
736 if (ide_queue_pc_tail(drive, tape->disk, &pc, buf, pc.req_xfer)) ide_tape_read_position()
804 struct gendisk *disk = tape->disk; idetape_position_tape() local
812 ret = ide_queue_pc_tail(drive, disk, &pc, NULL, 0); idetape_position_tape()
858 rq->rq_disk = tape->disk; idetape_queue_rw_tail()
868 blk_execute_rq(drive->queue, tape->disk, rq, 0); idetape_queue_rw_tail()
1010 struct gendisk *disk = tape->disk; idetape_rewind_tape() local
1017 ret = ide_queue_pc_tail(drive, disk, &pc, NULL, 0); idetape_rewind_tape()
1065 struct gendisk *disk = tape->disk; idetape_space_over_filemarks() local
1094 return ide_queue_pc_tail(drive, disk, &pc, NULL, 0); idetape_space_over_filemarks()
1232 if (ide_queue_pc_tail(drive, tape->disk, &pc, NULL, 0)) { idetape_write_filemark()
1255 struct gendisk *disk = tape->disk; idetape_mtioctop() local
1292 return ide_do_start_stop(drive, disk, IDETAPE_LU_LOAD_MASK); idetape_mtioctop()
1300 if (!ide_set_media_lock(drive, disk, 0)) idetape_mtioctop()
1304 retval = ide_do_start_stop(drive, disk, !IDETAPE_LU_LOAD_MASK); idetape_mtioctop()
1314 return ide_do_start_stop(drive, disk, idetape_mtioctop()
1318 return ide_queue_pc_tail(drive, disk, &pc, NULL, 0); idetape_mtioctop()
1322 return ide_queue_pc_tail(drive, disk, &pc, NULL, 0); idetape_mtioctop()
1345 retval = ide_set_media_lock(drive, disk, 1); idetape_mtioctop()
1351 retval = ide_set_media_lock(drive, disk, 0); idetape_mtioctop()
1444 if (ide_queue_pc_tail(drive, tape->disk, &pc, buf, pc.req_xfer)) { ide_tape_get_bsize_from_bdesc()
1530 if (!ide_set_media_lock(drive, tape->disk, 1)) { idetape_chrdev_open()
1589 if (!ide_set_media_lock(drive, tape->disk, 0)) idetape_chrdev_release()
1609 if (ide_queue_pc_tail(drive, tape->disk, &pc, pc_buf, pc.req_xfer)) { idetape_get_inquiry_results()
1638 if (ide_queue_pc_tail(drive, tape->disk, &pc, buf, pc.req_xfer)) { idetape_get_mode_sense_results()
1812 ide_unregister_region(tape->disk); ide_tape_remove()
1823 struct gendisk *g = tape->disk; ide_tape_release()
1921 static void idetape_release(struct gendisk *disk, fmode_t mode) idetape_release() argument
1923 struct ide_tape_obj *tape = ide_drv_g(disk, ide_tape_obj); idetape_release()
1995 tape->disk = g; ide_tape_probe()
H A Dide-cd.h42 /* Space to hold the disk TOC. */
82 struct gendisk *disk; member in struct:cdrom_info
H A Dide-cd.c58 static struct cdrom_info *ide_cd_get(struct gendisk *disk) ide_cd_get() argument
63 cd = ide_drv_g(disk, cdrom_info); ide_cd_get()
201 if (sector < get_capacity(info->disk) && cdrom_analyze_sense_data()
203 set_capacity(info->disk, sector); cdrom_analyze_sense_data()
364 /* disk appears blank? */ cdrom_decode_status()
460 error = blk_execute_rq(drive->queue, info->disk, rq, 0); ide_cd_queue_pc()
485 * a disk. Retry, but wait a little to give ide_cd_queue_pc()
714 /* disk has become write protected */ cdrom_start_rw()
715 if (get_disk_ro(cd->disk)) cdrom_start_rw()
949 /* Try to read the entire TOC for the disk into our internal buffer. */ ide_cd_read_toc()
991 set_capacity(info->disk, toc->capacity * sectors_per_frame); ide_cd_read_toc()
1108 set_capacity(info->disk, toc->capacity * sectors_per_frame); ide_cd_read_toc()
1201 devinfo->disk = info->disk; ide_cdrom_register()
1547 del_gendisk(info->disk); ide_cd_remove()
1559 struct gendisk *g = info->disk; ide_cd_release()
1609 static void idecd_release(struct gendisk *disk, fmode_t mode) idecd_release() argument
1611 struct cdrom_info *info = ide_drv_g(disk, cdrom_info); idecd_release()
1694 static unsigned int idecd_check_events(struct gendisk *disk, idecd_check_events() argument
1697 struct cdrom_info *info = ide_drv_g(disk, cdrom_info); idecd_check_events()
1701 static int idecd_revalidate_disk(struct gendisk *disk) idecd_revalidate_disk() argument
1703 struct cdrom_info *info = ide_drv_g(disk, cdrom_info); idecd_revalidate_disk()
1766 info->disk = g; ide_cd_probe()
H A Dide-probe.c399 * (e.g. crw9624 as drive0 with disk as slave) do_probe()
578 * - The firmware hard reset the disk before booting the kernel,
610 * I know of at least one disk who takes 31 seconds, I use 35 ide_port_wait_ready()
893 request_module("ide-disk"); ata_probe()
920 void ide_register_region(struct gendisk *disk) ide_register_region() argument
922 blk_register_region(MKDEV(disk->major, disk->first_minor), ide_register_region()
923 disk->minors, NULL, exact_match, exact_lock, disk); ide_register_region() local
928 void ide_unregister_region(struct gendisk *disk) ide_unregister_region() argument
930 blk_unregister_region(MKDEV(disk->major, disk->first_minor), ide_unregister_region()
931 disk->minors); ide_unregister_region()
936 void ide_init_disk(struct gendisk *disk, ide_drive_t *drive) ide_init_disk() argument
941 disk->major = hwif->major; ide_init_disk()
942 disk->first_minor = unit << PARTN_BITS; ide_init_disk()
943 sprintf(disk->disk_name, "hd%c", 'a' + hwif->index * MAX_DRIVES + unit); ide_init_disk()
944 disk->queue = drive->queue; ide_init_disk()
H A Ddtc2278.c31 * get the full speed. You better get the disk interrupts disabled ( hdparm -u0
33 * filesystem corrupted with -u1, but under heavy disk load only :-)
H A Dide-atapi.c89 int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk, ide_queue_pc_tail() argument
109 error = blk_execute_rq(drive->queue, disk, rq, 0); ide_queue_pc_tail()
116 int ide_do_test_unit_ready(ide_drive_t *drive, struct gendisk *disk) ide_do_test_unit_ready() argument
123 return ide_queue_pc_tail(drive, disk, &pc, NULL, 0); ide_do_test_unit_ready()
127 int ide_do_start_stop(ide_drive_t *drive, struct gendisk *disk, int start) ide_do_start_stop() argument
138 return ide_queue_pc_tail(drive, disk, &pc, NULL, 0); ide_do_start_stop()
142 int ide_set_media_lock(ide_drive_t *drive, struct gendisk *disk, int on) ide_set_media_lock() argument
153 return ide_queue_pc_tail(drive, disk, &pc, NULL, 0); ide_set_media_lock()
/linux-4.4.14/drivers/block/
H A Dhd.c304 static void hd_out(struct hd_i_struct *disk, hd_out() argument
320 if (!controller_ready(disk->unit, head)) { hd_out()
325 outb_p(disk->ctl, HD_CMD); hd_out()
327 outb_p(disk->wpcom >> 2, ++port); hd_out()
332 outb_p(0xA0 | (disk->unit << 4) | head, ++port); hd_out()
381 struct hd_i_struct *disk = &hd_info[i]; reset_hd() local
382 disk->special_op = disk->recalibrate = 1; reset_hd()
383 hd_out(disk, disk->sect, disk->sect, disk->head-1, reset_hd()
384 disk->cyl, ATA_CMD_INIT_DEV_PARAMS, &reset_hd); reset_hd()
420 struct hd_i_struct *disk = req->rq_disk->private_data; bad_rw_intr() local
423 disk->special_op = disk->recalibrate = 1; bad_rw_intr()
427 disk->special_op = disk->recalibrate = 1; bad_rw_intr()
554 static int do_special_op(struct hd_i_struct *disk, struct request *req) do_special_op() argument
556 if (disk->recalibrate) { do_special_op()
557 disk->recalibrate = 0; do_special_op()
558 hd_out(disk, disk->sect, 0, 0, 0, ATA_CMD_RESTORE, &recal_intr); do_special_op()
561 if (disk->head > 16) { do_special_op()
565 disk->special_op = 0; do_special_op()
582 struct hd_i_struct *disk; hd_request() local
603 disk = req->rq_disk->private_data; hd_request()
614 if (disk->special_op) { hd_request()
615 if (do_special_op(disk, req)) hd_request()
619 sec = block % disk->sect + 1; hd_request()
620 track = block / disk->sect; hd_request()
621 head = track % disk->head; hd_request()
622 cyl = track / disk->head; hd_request()
632 hd_out(disk, nsect, sec, head, cyl, ATA_CMD_PIO_READ, hd_request()
638 hd_out(disk, nsect, sec, head, cyl, ATA_CMD_PIO_WRITE, hd_request()
663 struct hd_i_struct *disk = bdev->bd_disk->private_data; hd_getgeo() local
665 geo->heads = disk->head; hd_getgeo()
666 geo->sectors = disk->sect; hd_getgeo()
667 geo->cylinders = disk->cyl; hd_getgeo()
736 struct gendisk *disk = alloc_disk(64); hd_init() local
738 if (!disk) hd_init()
740 disk->major = HD_MAJOR; hd_init()
741 disk->first_minor = drive << 6; hd_init()
742 disk->fops = &hd_fops; hd_init()
743 sprintf(disk->disk_name, "hd%c", 'a'+drive); hd_init()
744 disk->private_data = p; hd_init()
745 set_capacity(disk, p->head * p->sect * p->cyl); hd_init()
746 disk->queue = hd_queue; hd_init()
748 hd_gendisk[drive] = disk; hd_init()
750 disk->disk_name, (unsigned long)get_capacity(disk)/2048, hd_init()
755 printk("hd: unable to get IRQ%d for the hard disk driver\n", hd_init()
H A Dvirtio_blk.c34 /* The disk structure for the kernel. */
35 struct gendisk *disk; member in struct:virtio_blk
156 blk_mq_start_stopped_hw_queues(vblk->disk->queue, true); virtblk_done()
234 /* return id (s/n) string for *disk to *id_str
236 static int virtblk_get_id(struct gendisk *disk, char *id_str) virtblk_get_id() argument
238 struct virtio_blk *vblk = disk->private_data; virtblk_get_id()
243 bio = bio_map_kern(vblk->disk->queue, id_str, VIRTIO_BLK_ID_BYTES, virtblk_get_id()
248 req = blk_make_request(vblk->disk->queue, bio, GFP_KERNEL); virtblk_get_id()
255 err = blk_execute_rq(vblk->disk->queue, vblk->disk, req, false); virtblk_get_id()
264 struct gendisk *disk = bdev->bd_disk; virtblk_ioctl() local
265 struct virtio_blk *vblk = disk->private_data; virtblk_ioctl()
318 struct gendisk *disk = dev_to_disk(dev); virtblk_serial_show() local
325 err = virtblk_get_id(disk, buf); virtblk_serial_show()
342 struct request_queue *q = vblk->disk->queue; virtblk_config_changed_work()
368 set_capacity(vblk->disk, capacity); virtblk_config_changed_work()
369 revalidate_disk(vblk->disk); virtblk_config_changed_work()
370 kobject_uevent_env(&disk_to_dev(vblk->disk)->kobj, KOBJ_CHANGE, envp); virtblk_config_changed_work()
492 blk_queue_flush(vblk->disk->queue, REQ_FLUSH); virtblk_update_cache_mode()
494 blk_queue_flush(vblk->disk->queue, 0); virtblk_update_cache_mode()
496 revalidate_disk(vblk->disk); virtblk_update_cache_mode()
507 struct gendisk *disk = dev_to_disk(dev); virtblk_cache_type_store() local
508 struct virtio_blk *vblk = disk->private_data; virtblk_cache_type_store()
529 struct gendisk *disk = dev_to_disk(dev); virtblk_cache_type_show() local
530 struct virtio_blk *vblk = disk->private_data; virtblk_cache_type_show()
615 vblk->disk = alloc_disk(1 << PART_BITS); virtblk_probe()
616 if (!vblk->disk) { virtblk_probe()
644 q = vblk->disk->queue = blk_mq_init_queue(&vblk->tag_set); virtblk_probe()
652 virtblk_name_format("vd", index, vblk->disk->disk_name, DISK_NAME_LEN); virtblk_probe()
654 vblk->disk->major = major; virtblk_probe()
655 vblk->disk->first_minor = index_to_minor(index); virtblk_probe()
656 vblk->disk->private_data = vblk; virtblk_probe()
657 vblk->disk->fops = &virtblk_fops; virtblk_probe()
658 vblk->disk->driverfs_dev = &vdev->dev; virtblk_probe()
659 vblk->disk->flags |= GENHD_FL_EXT_DEVT; virtblk_probe()
665 /* If disk is read-only in the host, the guest should obey */ virtblk_probe()
667 set_disk_ro(vblk->disk, 1); virtblk_probe()
678 set_capacity(vblk->disk, cap); virtblk_probe()
735 add_disk(vblk->disk); virtblk_probe()
736 err = device_create_file(disk_to_dev(vblk->disk), &dev_attr_serial); virtblk_probe()
741 err = device_create_file(disk_to_dev(vblk->disk), virtblk_probe()
744 err = device_create_file(disk_to_dev(vblk->disk), virtblk_probe()
751 del_gendisk(vblk->disk); virtblk_probe()
752 blk_cleanup_queue(vblk->disk->queue); virtblk_probe()
756 put_disk(vblk->disk); virtblk_probe()
776 del_gendisk(vblk->disk); virtblk_remove()
777 blk_cleanup_queue(vblk->disk->queue); virtblk_remove()
784 refc = atomic_read(&disk_to_dev(vblk->disk)->kobj.kref.refcount); virtblk_remove()
785 put_disk(vblk->disk); virtblk_remove()
806 blk_mq_stop_hw_queues(vblk->disk->queue); virtblk_freeze()
823 blk_mq_start_stopped_hw_queues(vblk->disk->queue, true); virtblk_restore()
H A Dnbd.c56 struct gendisk *disk; member in struct:nbd_device
76 #define nbd_name(nbd) ((nbd)->disk->disk_name)
98 return disk_to_dev(nbd->disk); nbd_to_dev()
135 dev_warn(disk_to_dev(nbd->disk), "shutting down socket\n"); sock_shutdown()
178 dev_err(disk_to_dev(nbd->disk), sock_xmit()
269 dev_err(disk_to_dev(nbd->disk), nbd_send_req()
289 dev_err(disk_to_dev(nbd->disk), rq_for_each_segment()
342 dev_err(disk_to_dev(nbd->disk), nbd_read_stat()
348 dev_err(disk_to_dev(nbd->disk), "Wrong magic (0x%lx)\n", nbd_read_stat()
359 dev_err(disk_to_dev(nbd->disk), "Unexpected reply (%p)\n", nbd_read_stat()
365 dev_err(disk_to_dev(nbd->disk), "Other side returned error (%d)\n", nbd_read_stat()
379 dev_err(disk_to_dev(nbd->disk), "Receive data failed (result %d)\n", rq_for_each_segment()
394 struct gendisk *disk = dev_to_disk(dev); pid_show() local
395 struct nbd_device *nbd = (struct nbd_device *)disk->private_data; pid_show()
419 ret = device_create_file(disk_to_dev(nbd->disk), &pid_attr); nbd_thread_recv()
421 dev_err(disk_to_dev(nbd->disk), "device_create_file failed!\n"); nbd_thread_recv()
440 device_remove_file(disk_to_dev(nbd->disk), &pid_attr); nbd_thread_recv()
491 dev_dbg(disk_to_dev(nbd->disk), "queue cleared\n"); nbd_clear_que()
502 dev_err(disk_to_dev(nbd->disk), nbd_handle_req()
512 dev_err(disk_to_dev(nbd->disk), nbd_handle_req()
523 dev_err(disk_to_dev(nbd->disk), "Request send failed\n"); nbd_handle_req()
621 dev_err_ratelimited(disk_to_dev(nbd->disk),
651 dev_info(disk_to_dev(nbd->disk), "NBD_DISCONNECT\n"); __nbd_ioctl()
704 set_capacity(nbd->disk, nbd->bytesize >> 9); __nbd_ioctl()
711 set_capacity(nbd->disk, nbd->bytesize >> 9); __nbd_ioctl()
732 set_capacity(nbd->disk, nbd->bytesize >> 9); __nbd_ioctl()
751 nbd->disk->queue); __nbd_ioctl()
753 blk_queue_flush(nbd->disk->queue, REQ_FLUSH); __nbd_ioctl()
755 blk_queue_flush(nbd->disk->queue, 0); __nbd_ioctl()
776 queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, nbd->disk->queue); __nbd_ioctl()
783 set_capacity(nbd->disk, 0); __nbd_ioctl()
799 dev_info(disk_to_dev(nbd->disk), __nbd_ioctl()
1015 * for the whole disk. nbd_init()
1031 struct gendisk *disk = alloc_disk(1 << part_shift); nbd_init() local
1032 if (!disk) nbd_init()
1034 nbd_dev[i].disk = disk; nbd_init()
1040 disk->queue = blk_init_queue(nbd_request_handler, &nbd_lock); nbd_init()
1041 if (!disk->queue) { nbd_init()
1042 put_disk(disk); nbd_init()
1048 queue_flag_set_unlocked(QUEUE_FLAG_NONROT, disk->queue); nbd_init()
1049 queue_flag_clear_unlocked(QUEUE_FLAG_ADD_RANDOM, disk->queue); nbd_init()
1050 disk->queue->limits.discard_granularity = 512; nbd_init()
1051 blk_queue_max_discard_sectors(disk->queue, UINT_MAX); nbd_init()
1052 disk->queue->limits.discard_zeroes_data = 0; nbd_init()
1053 blk_queue_max_hw_sectors(disk->queue, 65536); nbd_init()
1054 disk->queue->limits.max_sectors = 256; nbd_init()
1067 struct gendisk *disk = nbd_dev[i].disk; nbd_init() local
1081 disk->major = NBD_MAJOR; nbd_init()
1082 disk->first_minor = i << part_shift; nbd_init()
1083 disk->fops = &nbd_fops; nbd_init()
1084 disk->private_data = &nbd_dev[i]; nbd_init()
1085 sprintf(disk->disk_name, "nbd%d", i); nbd_init()
1086 set_capacity(disk, 0); nbd_init()
1087 add_disk(disk); nbd_init()
1093 blk_cleanup_queue(nbd_dev[i].disk->queue); nbd_init()
1094 put_disk(nbd_dev[i].disk); nbd_init()
1107 struct gendisk *disk = nbd_dev[i].disk; nbd_cleanup() local
1109 if (disk) { nbd_cleanup()
1110 del_gendisk(disk); nbd_cleanup()
1111 blk_cleanup_queue(disk->queue); nbd_cleanup()
1112 put_disk(disk); nbd_cleanup()
H A Dosdblk.c106 struct gendisk *disk; /* blkdev's gendisk and rq */ member in struct:osdblk_device
383 struct gendisk *disk = osdev->disk; osdblk_free_disk() local
385 if (!disk) osdblk_free_disk()
388 if (disk->flags & GENHD_FL_UP) osdblk_free_disk()
389 del_gendisk(disk); osdblk_free_disk()
390 if (disk->queue) osdblk_free_disk()
391 blk_cleanup_queue(disk->queue); osdblk_free_disk()
392 put_disk(disk); osdblk_free_disk()
397 struct gendisk *disk; osdblk_init_disk() local
408 disk = alloc_disk(OSDBLK_MINORS_PER_MAJOR); osdblk_init_disk()
409 if (!disk) osdblk_init_disk()
412 sprintf(disk->disk_name, DRV_NAME "%d", osdev->id); osdblk_init_disk()
413 disk->major = osdev->major; osdblk_init_disk()
414 disk->first_minor = 0; osdblk_init_disk()
415 disk->fops = &osdblk_bd_ops; osdblk_init_disk()
416 disk->private_data = osdev; osdblk_init_disk()
421 put_disk(disk); osdblk_init_disk()
429 put_disk(disk); osdblk_init_disk()
442 disk->queue = q; osdblk_init_disk()
446 osdev->disk = disk; osdblk_init_disk()
449 /* finally, announce the disk to the world */ osdblk_init_disk()
450 set_capacity(disk, obj_size / 512ULL); osdblk_init_disk()
451 add_disk(disk); osdblk_init_disk()
454 disk->disk_name, (unsigned long long)obj_size); osdblk_init_disk()
H A Dataflop.c13 * - Autodetection of disk format (DD/HD); untested yet, because I
32 * the FDC will otherwise wait forever when no disk is inserted...
36 * - more/other disk formats
41 * - Make disk format numbering independent from minors
47 * - disk formatting
60 * - Maybe a better strategy for disk change detection (does anyone
99 { "D820", 10,1640, 0, 0}, /* 3: DD disk with 82 tracks/10 sectors */
147 /* Array for translating minors into disk formats */
189 * Maximum disk size (in kilobytes). This default is used whenever the
190 * current disk size is unknown.
203 * restored upon disk change by floppy_revalidate() if valid (as seen by
213 struct atari_disk_type *disktype; /* current type of disk */
219 disk change detection) */
221 struct gendisk *disk; member in struct:atari_floppy_struct
259 * of the disk to save read operations. These are two separate buffers
372 static void floppy_release(struct gendisk *disk, fmode_t mode);
426 * clock speed for this disk's type.
504 /* Test again later; if tested too often, it seems there is no disk fd_motor_off_timer()
506 * at least until a disk is inserted). So we'll test only twice fd_motor_off_timer()
514 /* This function is repeatedly called to detect disk changes (as good
955 /* If reading a whole track, wait about one disk rotation and fd_rwsec()
1074 /* try another disk type */ fd_rwsec_done1()
1076 set_capacity(unit[SelectedDrive].disk, fd_rwsec_done1()
1091 set_capacity(unit[SelectedDrive].disk, fd_rwsec_done1()
1262 * FDC status register accessible for check_change. If the last disk
1296 /* If the check for a disk change is done too early after this finish_fdc_done()
1313 /* The detection of disk changes is a dark chapter in Atari history :-(
1320 * filesystem used on the disk and thus the contents of block 0. I've
1321 * chosen the method to always say "The disk was changed" if it is
1323 * invalidates the disk buffers if you work with write protected
1325 * due to unrecognised disk changes.
1328 static unsigned int floppy_check_events(struct gendisk *disk, floppy_check_events() argument
1331 struct atari_floppy_struct *p = disk->private_data; floppy_check_events()
1351 static int floppy_revalidate(struct gendisk *disk) floppy_revalidate() argument
1353 struct atari_floppy_struct *p = disk->private_data; floppy_revalidate()
1407 q = unit[fdc_queue].disk->queue; set_next_request()
1454 set_capacity(floppy->disk, UDT->blocks); redo_fd_request()
1459 /* user supplied disk type */ redo_fd_request()
1461 printk(KERN_WARNING "fd%d: invalid disk format", drive ); redo_fd_request()
1466 printk(KERN_WARNING "fd%d: unsupported disk format", drive ); redo_fd_request()
1472 set_capacity(floppy->disk, UDT->blocks); redo_fd_request()
1512 struct gendisk *disk = bdev->bd_disk; fd_locked_ioctl() local
1513 struct atari_floppy_struct *floppy = disk->private_data; fd_locked_ioctl()
1559 * disk change and subsequent revalidate()! simple fd_locked_ioctl()
1574 if (floppy_check_events(disk, 0)) fd_locked_ioctl()
1575 floppy_revalidate(disk); fd_locked_ioctl()
1612 set_capacity(floppy->disk, UDT->blocks); fd_locked_ioctl()
1628 /* no matching disk type found above - setting user_params */ fd_locked_ioctl()
1634 /* set user type (reset by disk change!) */ fd_locked_ioctl()
1658 set_capacity(floppy->disk, UDT->blocks); fd_locked_ioctl()
1681 set_capacity(floppy->disk, MAX_DISK_SIZE * 2); fd_locked_ioctl()
1743 * whether a disk is inserted). This is done by issuing a restore
1745 * head across the whole disk) and looking at the state of the "TR00"
1795 * floppies, additionally start the disk-change and motor-off timers.
1889 static void floppy_release(struct gendisk *disk, fmode_t mode) floppy_release() argument
1891 struct atari_floppy_struct *p = disk->private_data; floppy_release()
1918 return get_disk(unit[drive].disk); floppy_find()
1933 unit[i].disk = alloc_disk(1); atari_floppy_init()
1934 if (!unit[i].disk) atari_floppy_init()
1962 unit[i].disk->major = FLOPPY_MAJOR; atari_floppy_init()
1963 unit[i].disk->first_minor = i; atari_floppy_init()
1964 sprintf(unit[i].disk->disk_name, "fd%d", i); atari_floppy_init()
1965 unit[i].disk->fops = &floppy_fops; atari_floppy_init()
1966 unit[i].disk->private_data = &unit[i]; atari_floppy_init()
1967 unit[i].disk->queue = blk_init_queue(do_fd_request, atari_floppy_init()
1969 if (!unit[i].disk->queue) atari_floppy_init()
1971 set_capacity(unit[i].disk, MAX_DISK_SIZE * 2); atari_floppy_init()
1972 add_disk(unit[i].disk); atari_floppy_init()
1986 struct request_queue *q = unit[i].disk->queue; atari_floppy_init()
1988 put_disk(unit[i].disk); atari_floppy_init()
2041 struct request_queue *q = unit[i].disk->queue; atari_floppy_exit()
2043 del_gendisk(unit[i].disk); atari_floppy_exit()
2044 put_disk(unit[i].disk); atari_floppy_exit()
H A Dswim.c192 struct gendisk *disk; member in struct:floppy_state
676 static void floppy_release(struct gendisk *disk, fmode_t mode) floppy_release() argument
678 struct floppy_state *fs = disk->private_data; floppy_release()
741 static unsigned int floppy_check_events(struct gendisk *disk, floppy_check_events() argument
744 struct floppy_state *fs = disk->private_data; floppy_check_events()
749 static int floppy_revalidate(struct gendisk *disk) floppy_revalidate() argument
751 struct floppy_state *fs = disk->private_data; floppy_revalidate()
786 return get_disk(swd->unit[drive].disk); floppy_find()
837 swd->unit[drive].disk = alloc_disk(1); swim_floppy_init()
838 if (swd->unit[drive].disk == NULL) { swim_floppy_init()
853 swd->unit[drive].disk->flags = GENHD_FL_REMOVABLE; swim_floppy_init()
854 swd->unit[drive].disk->major = FLOPPY_MAJOR; swim_floppy_init()
855 swd->unit[drive].disk->first_minor = drive; swim_floppy_init()
856 sprintf(swd->unit[drive].disk->disk_name, "fd%d", drive); swim_floppy_init()
857 swd->unit[drive].disk->fops = &floppy_fops; swim_floppy_init()
858 swd->unit[drive].disk->private_data = &swd->unit[drive]; swim_floppy_init()
859 swd->unit[drive].disk->queue = swd->queue; swim_floppy_init()
860 set_capacity(swd->unit[drive].disk, 2880); swim_floppy_init()
861 add_disk(swd->unit[drive].disk); swim_floppy_init()
872 put_disk(swd->unit[drive].disk); swim_floppy_init()
945 del_gendisk(swd->unit[drive].disk); swim_remove()
946 put_disk(swd->unit[drive].disk); swim_remove()
H A Dswim3.c193 int secpercyl; /* disk geometry information */
255 static void floppy_release(struct gendisk *disk, fmode_t mode);
256 static unsigned int floppy_check_events(struct gendisk *disk,
258 static int floppy_revalidate(struct gendisk *disk);
357 swim3_dbg("%s", " disk ejected\n"); start_request()
366 swim3_dbg("%s", " try to write, disk write protected\n"); start_request()
1024 static void floppy_release(struct gendisk *disk, fmode_t mode) floppy_release() argument
1026 struct floppy_state *fs = disk->private_data; floppy_release()
1038 static unsigned int floppy_check_events(struct gendisk *disk, floppy_check_events() argument
1041 struct floppy_state *fs = disk->private_data; floppy_check_events()
1045 static int floppy_revalidate(struct gendisk *disk) floppy_revalidate() argument
1047 struct floppy_state *fs = disk->private_data; floppy_revalidate()
1206 struct gendisk *disk; swim3_attach() local
1217 /* Now register that disk. Same comment about failure handling */ swim3_attach()
1218 disk = disks[index] = alloc_disk(1); swim3_attach()
1219 if (disk == NULL) swim3_attach()
1221 disk->queue = blk_init_queue(do_fd_request, &swim3_lock); swim3_attach()
1222 if (disk->queue == NULL) { swim3_attach()
1223 put_disk(disk); swim3_attach()
1226 disk->queue->queuedata = &floppy_states[index]; swim3_attach()
1236 disk->major = FLOPPY_MAJOR; swim3_attach()
1237 disk->first_minor = index; swim3_attach()
1238 disk->fops = &floppy_fops; swim3_attach()
1239 disk->private_data = &floppy_states[index]; swim3_attach()
1240 disk->flags |= GENHD_FL_REMOVABLE; swim3_attach()
1241 sprintf(disk->disk_name, "fd%d", index); swim3_attach()
1242 set_capacity(disk, 2880); swim3_attach()
1243 add_disk(disk); swim3_attach()
H A Damiflop.c33 * needed for the disk mechanic.
35 * february 1996 fixed error recovery and multiple disk access
97 #define FD_NOTREADY 4 /* unit is not ready (motor not on/no disk) */
170 #define RAW_BUF_SIZE 30000 /* size of raw disk data */
531 /* loop and read disk ID */ fd_get_drive_id()
658 * written to disk and vice versa.
814 static unsigned long *putsec(int disk, unsigned long *raw, int cnt) putsec() argument
819 disk&=3; putsec()
825 hdr.track = unit[disk].track; putsec()
827 hdr.ord = unit[disk].dtype->sects * unit[disk].type->sect_mult - cnt; putsec()
832 hdr.datachk = checksum((ulong *)(unit[disk].trackbuf+cnt*512), 512); putsec()
842 encode_block(raw, (ulong *)(unit[disk].trackbuf+cnt*512), 512); putsec()
848 static void amiga_write(int disk) amiga_write() argument
853 disk&=3; amiga_write()
855 for (cnt = 0; cnt < 415 * unit[disk].type->sect_mult; cnt++) amiga_write()
859 for (cnt = 0; cnt < unit[disk].dtype->sects * unit[disk].type->sect_mult; cnt++) amiga_write()
860 ptr = putsec (disk, ptr, cnt); amiga_write()
1095 "%d, unit %d for sector%d, disk sector %d\n", dos_read()
1205 static void dos_write(int disk) dos_write() argument
1211 disk&=3; dos_write()
1217 if (unit[disk].type->sect_mult==2) /* check for HD-Disks */ dos_write()
1232 for(cnt = 0; cnt < unit[disk].dtype->sects * unit[disk].type->sect_mult; cnt++) dos_write()
1233 ptr=ms_putsec(disk,ptr,cnt); dos_write()
1261 printk (KERN_NOTICE "floppy disk write protected\n"); flush_track_callback()
1286 printk (KERN_NOTICE "floppy disk write protected " non_int_flush_track()
1576 unit[drive].disk = -1; fd_probe()
1630 printk(KERN_INFO "fd%d: accessing %s-disk with %s-layout\n",drive, floppy_open()
1637 static void floppy_release(struct gendisk *disk, fmode_t mode) floppy_release() argument
1639 struct amiga_floppy_struct *p = disk->private_data; floppy_release()
1665 static unsigned amiga_check_events(struct gendisk *disk, unsigned int clearing) amiga_check_events() argument
1667 struct amiga_floppy_struct *p = disk->private_data; amiga_check_events()
1710 struct gendisk *disk; fd_probe_drives() local
1714 disk = alloc_disk(1); fd_probe_drives()
1715 if (!disk) { fd_probe_drives()
1719 unit[drive].gendisk = disk; fd_probe_drives()
1721 disk->queue = blk_init_queue(do_fd_request, &amiflop_lock); fd_probe_drives()
1722 if (!disk->queue) { fd_probe_drives()
1735 disk->major = FLOPPY_MAJOR; fd_probe_drives()
1736 disk->first_minor = drive; fd_probe_drives()
1737 disk->fops = &floppy_fops; fd_probe_drives()
1738 sprintf(disk->disk_name, "fd%d", drive); fd_probe_drives()
1739 disk->private_data = &unit[drive]; fd_probe_drives()
1740 set_capacity(disk, 880*2); fd_probe_drives()
1741 add_disk(disk); fd_probe_drives()
1822 /* make sure that disk DMA is enabled */ amiga_floppy_probe()
H A Dbrd.c450 MODULE_PARM_DESC(rd_size, "Size of each RAM disk in kbytes.");
480 struct gendisk *disk; brd_alloc() local
510 disk = brd->brd_disk = alloc_disk(max_part); brd_alloc()
511 if (!disk) brd_alloc()
513 disk->major = RAMDISK_MAJOR; brd_alloc()
514 disk->first_minor = i * max_part; brd_alloc()
515 disk->fops = &brd_fops; brd_alloc()
516 disk->private_data = brd; brd_alloc()
517 disk->queue = brd->brd_queue; brd_alloc()
518 disk->flags = GENHD_FL_EXT_DEVT; brd_alloc()
519 sprintf(disk->disk_name, "ram%d", i); brd_alloc()
520 set_capacity(disk, rd_size * 2); brd_alloc()
H A Dnull_blk.c36 struct gendisk *disk; member in struct:nullb
424 del_gendisk(nullb->disk); null_del_dev()
429 put_disk(nullb->disk); null_del_dev()
577 static void null_release(struct gendisk *disk, fmode_t mode) null_release() argument
646 struct gendisk *disk; null_add_dev() local
730 disk = nullb->disk = alloc_disk_node(1, home_node); null_add_dev()
731 if (!disk) { null_add_dev()
736 set_capacity(disk, size >> 9); null_add_dev()
738 disk->flags |= GENHD_FL_EXT_DEVT | GENHD_FL_SUPPRESS_PARTITION_INFO; null_add_dev()
739 disk->major = null_major; null_add_dev()
740 disk->first_minor = nullb->index; null_add_dev()
741 disk->fops = &null_fops; null_add_dev()
742 disk->private_data = nullb; null_add_dev()
743 disk->queue = nullb->q; null_add_dev()
744 strncpy(disk->disk_name, nullb->disk_name, DISK_NAME_LEN); null_add_dev()
746 add_disk(disk); null_add_dev()
H A Dcciss.c168 static void cciss_release(struct gendisk *disk, fmode_t mode);
173 static int cciss_revalidate(struct gendisk *disk);
1081 static inline ctlr_info_t *get_host(struct gendisk *disk) get_host() argument
1083 return disk->queue->queuedata; get_host()
1086 static inline drive_info_struct *get_drv(struct gendisk *disk) get_drv() argument
1088 return disk->private_data; get_drv()
1106 * disk information. I don't think I really like this cciss_open()
1143 static void cciss_release(struct gendisk *disk, fmode_t mode) cciss_release() argument
1149 h = get_host(disk); cciss_release()
1150 drv = get_drv(disk); cciss_release()
1151 dev_dbg(&h->pdev->dev, "cciss_release %s\n", disk->disk_name); cciss_release()
1462 struct gendisk *disk, void __user *argp) cciss_getluninfo()
1465 drive_info_struct *drv = get_drv(disk); cciss_getluninfo()
1719 struct gendisk *disk = bdev->bd_disk; cciss_ioctl() local
1720 ctlr_info_t *h = get_host(disk); cciss_ioctl()
1749 return cciss_getluninfo(h, disk, argp); cciss_ioctl()
1802 /* make sure the disk has been added and the drive is real cciss_check_queues()
1947 static int cciss_add_disk(ctlr_info_t *h, struct gendisk *disk, cciss_add_disk() argument
1950 disk->queue = blk_init_queue(do_cciss_request, &h->lock); cciss_add_disk()
1951 if (!disk->queue) cciss_add_disk()
1953 sprintf(disk->disk_name, "cciss/c%dd%d", h->ctlr, drv_index); cciss_add_disk()
1954 disk->major = h->major; cciss_add_disk()
1955 disk->first_minor = drv_index << NWD_SHIFT; cciss_add_disk()
1956 disk->fops = &cciss_fops; cciss_add_disk()
1959 disk->private_data = h->drv[drv_index]; cciss_add_disk()
1960 disk->driverfs_dev = &h->drv[drv_index]->dev; cciss_add_disk()
1963 blk_queue_bounce_limit(disk->queue, h->pdev->dma_mask); cciss_add_disk()
1966 blk_queue_max_segments(disk->queue, h->maxsgentries); cciss_add_disk()
1968 blk_queue_max_hw_sectors(disk->queue, h->cciss_max_sectors); cciss_add_disk()
1970 blk_queue_softirq_done(disk->queue, cciss_softirq_done); cciss_add_disk()
1972 disk->queue->queuedata = h; cciss_add_disk()
1974 blk_queue_logical_block_size(disk->queue, cciss_add_disk()
1981 h->drv[drv_index]->queue = disk->queue; cciss_add_disk()
1982 add_disk(disk); cciss_add_disk()
1986 blk_cleanup_queue(disk->queue); cciss_add_disk()
1987 disk->queue = NULL; cciss_add_disk()
1995 * then the drive information will be updated and the disk will be
1998 * is disk 0 which will always be left registered with the kernel since it
1999 * is also the controller node. Any changes to disk 0 will show up on
2005 struct gendisk *disk; cciss_update_drive_info() local
2013 /* Get information about the disk and modify the driver structure */ cciss_update_drive_info()
2049 /* Save the lunid in case we deregister the disk, below. */ cciss_update_drive_info()
2053 /* Is it the same disk we already know, and nothing's changed? */ cciss_update_drive_info()
2062 /* The disk is unchanged, nothing to update */ cciss_update_drive_info()
2065 /* If we get here it's not the same disk, or something's changed, cciss_update_drive_info()
2068 * If the disk already exists then deregister it before proceeding cciss_update_drive_info()
2069 * (unless it's the first disk (for the controller node). cciss_update_drive_info()
2072 dev_warn(&h->pdev->dev, "disk %d has changed.\n", drv_index); cciss_update_drive_info()
2084 /* If the disk is in use return */ cciss_update_drive_info()
2089 * and serial number inquiry. If the disk was deregistered cciss_update_drive_info()
2112 disk = h->gendisk[drv_index]; cciss_update_drive_info()
2113 set_capacity(disk, h->drv[drv_index]->nr_blocks); cciss_update_drive_info()
2115 /* If it's not disk 0 (drv_index != 0) cciss_update_drive_info()
2116 * or if it was disk 0, but there was previously cciss_update_drive_info()
2122 if (cciss_add_disk(h, disk, drv_index) != 0) { cciss_update_drive_info()
2125 dev_warn(&h->pdev->dev, "could not update disk %d\n", cciss_update_drive_info()
2163 * disk is configured there, skip it. cciss_alloc_drive_info()
2175 /* If adding a real disk at cxd0, and it's already alloc'ed */ cciss_alloc_drive_info()
2210 * count this disk, or if it's only being added to provide
2229 "could not allocate a new disk %d\n", cciss_add_gendisk()
2239 /* else knows about this disk yet to contend */ cciss_add_gendisk()
2254 * to register a disk so the controller can be accessed
2259 struct gendisk *disk; cciss_add_controller_node() local
2275 disk = h->gendisk[drv_index]; cciss_add_controller_node()
2276 if (cciss_add_disk(h, disk, drv_index) == 0) cciss_add_controller_node()
2281 dev_warn(&h->pdev->dev, "could not add disk 0.\n"); cciss_add_controller_node()
2429 /* zero out the disk size info */ cciss_clear_drive_info()
2446 /* This function will deregister the disk and it's queue from the
2450 * disk = This is the disk to be deregistered
2451 * drv = This is the drive_info_struct associated with the disk to be
2452 * deregistered. It contains information about the disk used
2454 * clear_all = This flag determines whether or not the disk information
2457 * the disk in preparation for re-adding it. In this case
2471 struct gendisk *disk; deregister_disk() local
2479 disk = h->gendisk[drv_index]; deregister_disk()
2482 if (clear_all || (h->gendisk[0] == disk)) { deregister_disk()
2490 /* invalidate the devices and deregister the disk. If it is disk deregister_disk()
2492 * allows us to delete disk zero but keep the controller registered. deregister_disk()
2494 if (h->gendisk[0] != disk) { deregister_disk()
2495 struct request_queue *q = disk->queue; deregister_disk()
2496 if (disk->flags & GENHD_FL_UP) { deregister_disk()
2498 del_gendisk(disk); deregister_disk()
2504 * other than disk 0 we will call put_disk. We do not deregister_disk()
2505 * do this for disk 0 as we need it to be able to deregister_disk()
2510 * disk in our array and NULL our the pointer. deregister_disk()
2515 if (h->gendisk[i] == disk) { deregister_disk()
2520 put_disk(disk); deregister_disk()
2523 set_capacity(disk, 0); deregister_disk()
2529 /* if it was the last disk, find the new hightest lun */ deregister_disk()
2533 /* if the disk has size > 0, it is available */ deregister_disk()
2959 static int cciss_revalidate(struct gendisk *disk) cciss_revalidate() argument
2961 ctlr_info_t *h = get_host(disk); cciss_revalidate()
2962 drive_info_struct *drv = get_drv(disk); cciss_revalidate()
2998 set_capacity(disk, drv->nr_blocks); cciss_revalidate()
5229 /* write all data in the battery backed cache to disk */ cciss_shutdown()
5284 /* remove it from the disk list */ cciss_remove_one()
5286 struct gendisk *disk = h->gendisk[j]; cciss_remove_one() local
5287 if (disk) { cciss_remove_one()
5288 struct request_queue *q = disk->queue; cciss_remove_one()
5290 if (disk->flags & GENHD_FL_UP) { cciss_remove_one()
5292 del_gendisk(disk); cciss_remove_one()
1461 cciss_getluninfo(ctlr_info_t *h, struct gendisk *disk, void __user *argp) cciss_getluninfo() argument
H A Dsunvdc.c32 MODULE_DESCRIPTION("Sun LDOM virtual disk client driver");
52 struct gendisk *disk; member in struct:vdc_port
69 /* The server fills these in for us in the disk attribute
112 struct gendisk *disk = bdev->bd_disk; vdc_getgeo() local
113 sector_t nsect = get_capacity(disk); vdc_getgeo()
134 struct gendisk *disk; vdc_ioctl() local
145 disk = bdev->bd_disk; vdc_ioctl()
147 if (bdev->bd_disk && (disk->flags & GENHD_FL_CD)) vdc_ioctl()
169 * allocated a disk. vdc_blk_queue_start()
171 if (port->disk && blk_queue_stopped(port->disk->queue) && vdc_blk_queue_start()
173 blk_start_queue(port->disk->queue); vdc_blk_queue_start()
759 * then the underlying disk is reserved by another system probe_disk()
792 port->disk = g; probe_disk()
828 pr_info(PFX "Virtual Hard disk %s\n", port->disk_name); probe_disk()
959 blk_stop_queue(port->disk->queue); vdc_port_remove()
966 del_gendisk(port->disk); vdc_port_remove()
967 blk_cleanup_queue(port->disk->queue); vdc_port_remove()
968 put_disk(port->disk); vdc_port_remove()
969 port->disk = NULL; vdc_port_remove()
1002 blk_requeue_request(port->disk->queue, req); vdc_requeue_inflight()
1010 while ((req = blk_fetch_request(port->disk->queue)) != NULL) vdc_queue_drain()
1051 blk_stop_queue(port->disk->queue); vdc_ldc_reset()
H A Dcpqarray.c163 static void ida_release(struct gendisk *disk, fmode_t mode);
177 static int ida_revalidate(struct gendisk *disk);
187 static inline drv_info_t *get_drv(struct gendisk *disk) get_drv() argument
189 return disk->private_data; get_drv()
192 static inline ctlr_info_t *get_host(struct gendisk *disk) get_host() argument
194 return disk->queue->queuedata; get_host()
465 struct gendisk *disk = ida_gendisk[i][j]; cpqarray_register_ctlr() local
467 sprintf(disk->disk_name, "ida/c%dd%d", i, j); cpqarray_register_ctlr()
468 disk->major = COMPAQ_SMART2_MAJOR + i; cpqarray_register_ctlr()
469 disk->first_minor = j<<NWD_SHIFT; cpqarray_register_ctlr()
470 disk->fops = &ida_fops; cpqarray_register_ctlr()
474 set_capacity(disk, drv->nr_blks); cpqarray_register_ctlr()
475 disk->queue = hba[i]->queue; cpqarray_register_ctlr()
476 disk->private_data = drv; cpqarray_register_ctlr()
477 add_disk(disk); cpqarray_register_ctlr()
859 static void ida_release(struct gendisk *disk, fmode_t mode) ida_release() argument
864 host = get_host(disk); ida_release()
1510 * (through an ioctl) to make the driver zap any previous disk structs for
1540 struct gendisk *disk = ida_gendisk[ctlr][i]; revalidate_allvol() local
1541 if (disk->flags & GENHD_FL_UP) revalidate_allvol()
1542 del_gendisk(disk); revalidate_allvol()
1556 struct gendisk *disk = ida_gendisk[ctlr][i]; revalidate_allvol() local
1561 set_capacity(disk, drv->nr_blks); revalidate_allvol()
1562 disk->queue = host->queue; revalidate_allvol()
1563 disk->private_data = drv; revalidate_allvol()
1565 add_disk(disk); revalidate_allvol()
1572 static int ida_revalidate(struct gendisk *disk) ida_revalidate() argument
1574 drv_info_t *drv = disk->private_data; ida_revalidate()
1575 set_capacity(disk, drv->nr_blks); ida_revalidate()
H A Dsx8.c245 struct gendisk *disk; member in struct:carm_port
1018 /* TODO: scan and support non-disk devices */ carm_handle_scan_chan()
1020 if (msg_data[i] == 0) { /* direct-access device (disk) */ carm_handle_scan_chan()
1334 struct gendisk *disk = port->disk; carm_fsm_task() local
1336 set_capacity(disk, port->capacity); carm_fsm_task()
1337 add_disk(disk); carm_fsm_task()
1497 struct gendisk *disk; carm_init_disks() local
1505 disk = alloc_disk(CARM_MINORS_PER_MAJOR); carm_init_disks()
1506 if (!disk) { carm_init_disks()
1511 port->disk = disk; carm_init_disks()
1512 sprintf(disk->disk_name, DRV_NAME "/%u", carm_init_disks()
1514 disk->major = host->major; carm_init_disks()
1515 disk->first_minor = i * CARM_MINORS_PER_MAJOR; carm_init_disks()
1516 disk->fops = &carm_bd_ops; carm_init_disks()
1517 disk->private_data = port; carm_init_disks()
1524 disk->queue = q; carm_init_disks()
1539 struct gendisk *disk = host->port[i].disk; carm_free_disks() local
1540 if (disk) { carm_free_disks()
1541 struct request_queue *q = disk->queue; carm_free_disks()
1543 if (disk->flags & GENHD_FL_UP) carm_free_disks()
1544 del_gendisk(disk); carm_free_disks()
1547 put_disk(disk); carm_free_disks()
H A Dumem.c18 * 10/22/01: Phap Nguyen - v2.1 Added disk partitioning
20 * - use stand disk partitioning (so fdisk works).
762 static int mm_revalidate(struct gendisk *disk) mm_revalidate() argument
764 struct cardinfo *card = disk->private_data; mm_revalidate()
765 set_capacity(disk, card->mm_size << 1); mm_revalidate()
1092 struct gendisk *disk = mm_gendisk[i]; mm_init() local
1093 sprintf(disk->disk_name, "umem%c", 'a'+i); mm_init()
1095 disk->major = major_nr; mm_init()
1096 disk->first_minor = i << MM_SHIFT; mm_init()
1097 disk->fops = &mm_fops; mm_init()
1098 disk->private_data = &cards[i]; mm_init()
1099 disk->queue = cards[i].queue; mm_init()
1100 set_capacity(disk, cards[i].mm_size << 1); mm_init()
1101 add_disk(disk); mm_init()
H A Dfloppy.c74 * disk types.
88 * opposite side of the disk, leaving the sector IDs alone (i.e. Commodore's
156 #define DCL_DEBUG /* debug disk change line */
336 * Maximum disk size (in kilobytes).
337 * This default is used whenever the current disk size is unknown.
374 | | | | | | | Spindown offset (where disk stops)
404 * Frequency of disk change checks */
422 * tells if the disk is in Commodore 1581 format, which means side 0 sectors
423 * are located on side 1 of the disk but with a side 0 ID, and vice-versa.
424 * This is the same as the Sharp MZ-80 5.25" CP/M disk format, except that the
709 * disk change.
713 * last_checked is the date of the last check which showed 'no disk change'
717 * 2. No floppy disk is in the drive. This is done in order to ensure that
718 * requests are quickly flushed in case there is no disk in the drive. It
719 * follows that FD_DISK_CHANGE can only be cleared if there is a disk in
724 * each seek. If a disk is present, the disk change line should also be
725 * cleared on each seek. Thus, if FD_DISK_NEWCHANGE is clear, but the disk
726 * change line is set, this means either that no disk is in the drive, or
738 DPRINT("WARNING disk change called early\n"); disk_change()
741 DPRINT("probing disk change on unselected drive\n"); disk_change()
747 "checking disk change line for drive %d\n", drive); disk_change()
749 debug_dcl(UDP->flags, "disk change line=%x\n", fd_inb(FD_DIR) & 0x80); disk_change()
765 DPRINT("Disk type is undefined after disk change\n"); disk_change()
806 "calling disk change from set_dor\n"); set_dor()
932 * cycle through all N_DRIVE floppy drives, for disk change testing.
934 * be sure to have up to date disk change information.
997 /* this function makes sure that the disk stays in the drive during the
1001 debug_dcl(DP->flags, "calling disk change from watchdog\n"); fd_watchdog()
1004 DPRINT("disk removed during i/o\n"); fd_watchdog()
1547 "checking whether disk is write protected\n"); check_wp()
1562 debug_dcl(DP->flags, "calling disk change from %s\n", __func__); seek_floppy()
1567 * If it isn't, this means that there is really no disk in seek_floppy()
1894 debug_dcl(DP->flags, "calling disk change from floppy_ready\n"); floppy_ready()
2851 DPRINT("disk absent or changed during operation\n"); redo_fd_request()
3207 debug_dcl(DP->flags, "calling disk change from raw_cmd ioctl\n"); raw_cmd_ioctl()
3269 /* notice a disk change immediately, else set_geometry()
3287 * mtools often changes the geometry of the disk after set_geometry()
3621 static void floppy_release(struct gendisk *disk, fmode_t mode) floppy_release() argument
3623 int drive = (long)disk->private_data; floppy_release()
3738 * Check if the disk has been changed or if a change has been faked.
3740 static unsigned int floppy_check_events(struct gendisk *disk, floppy_check_events() argument
3743 int drive = (long)disk->private_data; floppy_check_events()
3766 * a disk in the drive, and whether that disk is writable.
3831 /* revalidate the floppy disk, i.e. trigger format autodetection by reading
3833 * there is a disk in the drive at all... Thus we also do it for fixed
3835 static int floppy_revalidate(struct gendisk *disk) floppy_revalidate() argument
3837 int drive = (long)disk->private_data; floppy_revalidate()
3873 set_capacity(disk, floppy_sizes[UDRS->fd_device]); floppy_revalidate()
3892 /* Determine the floppy disk controller type */
4619 /* eject disk, if any */ floppy_module_exit()
/linux-4.4.14/arch/m68k/emu/
H A Dnfblock.c59 struct gendisk *disk; member in struct:nfhd_device
129 dev->disk = alloc_disk(16); nfhd_init_one()
130 if (!dev->disk) nfhd_init_one()
133 dev->disk->major = major_num; nfhd_init_one()
134 dev->disk->first_minor = dev_id * 16; nfhd_init_one()
135 dev->disk->fops = &nfhd_ops; nfhd_init_one()
136 dev->disk->private_data = dev; nfhd_init_one()
137 sprintf(dev->disk->disk_name, "nfhd%u", dev_id); nfhd_init_one()
138 set_capacity(dev->disk, (sector_t)blocks * (bsize / 512)); nfhd_init_one()
139 dev->disk->queue = dev->queue; nfhd_init_one()
141 add_disk(dev->disk); nfhd_init_one()
185 del_gendisk(dev->disk); nfhd_exit()
186 put_disk(dev->disk); nfhd_exit()
/linux-4.4.14/drivers/nvdimm/
H A Dblk.c26 struct gendisk *disk; member in struct:nd_blk_device
167 struct gendisk *disk = bdev->bd_disk; nd_blk_make_request() local
188 blk_dev = disk->private_data; nd_blk_make_request()
244 struct gendisk *disk; nd_blk_attach_disk() local
260 disk = blk_dev->disk = alloc_disk(0); nd_blk_attach_disk()
261 if (!disk) { nd_blk_attach_disk()
266 disk->driverfs_dev = &ndns->dev; nd_blk_attach_disk()
267 disk->major = nd_blk_major; nd_blk_attach_disk()
268 disk->first_minor = 0; nd_blk_attach_disk()
269 disk->fops = &nd_blk_fops; nd_blk_attach_disk()
270 disk->private_data = blk_dev; nd_blk_attach_disk()
271 disk->queue = blk_dev->queue; nd_blk_attach_disk()
272 disk->flags = GENHD_FL_EXT_DEVT; nd_blk_attach_disk()
273 nvdimm_namespace_disk_name(ndns, disk->disk_name); nd_blk_attach_disk()
274 set_capacity(disk, 0); nd_blk_attach_disk()
275 add_disk(disk); nd_blk_attach_disk()
278 int rc = nd_integrity_init(disk, nd_blk_meta_size(blk_dev)); nd_blk_attach_disk()
281 del_gendisk(disk); nd_blk_attach_disk()
282 put_disk(disk); nd_blk_attach_disk()
288 set_capacity(disk, available_disk_size >> SECTOR_SHIFT); nd_blk_attach_disk()
289 revalidate_disk(disk); nd_blk_attach_disk()
332 del_gendisk(blk_dev->disk); nd_blk_detach_disk()
333 put_disk(blk_dev->disk); nd_blk_detach_disk()
H A Dpmem.c170 struct gendisk *disk; pmem_attach_disk() local
182 disk = alloc_disk_node(0, nid); pmem_attach_disk()
183 if (!disk) { pmem_attach_disk()
188 disk->major = pmem_major; pmem_attach_disk()
189 disk->first_minor = 0; pmem_attach_disk()
190 disk->fops = &pmem_fops; pmem_attach_disk()
191 disk->private_data = pmem; pmem_attach_disk()
192 disk->queue = pmem->pmem_queue; pmem_attach_disk()
193 disk->flags = GENHD_FL_EXT_DEVT; pmem_attach_disk()
194 nvdimm_namespace_disk_name(ndns, disk->disk_name); pmem_attach_disk()
195 disk->driverfs_dev = dev; pmem_attach_disk()
196 set_capacity(disk, (pmem->size - pmem->data_offset) / 512); pmem_attach_disk()
197 pmem->pmem_disk = disk; pmem_attach_disk()
199 add_disk(disk); pmem_attach_disk()
200 revalidate_disk(disk); pmem_attach_disk()
298 /* free pmem disk */ nvdimm_namespace_detach_pfn()
361 /* attach pmem disk in "pfn-mode" */ nvdimm_namespace_attach_pfn()
H A Dcore.c219 struct gendisk *disk = bio->bi_bdev->bd_disk; __nd_iostat_start() local
224 part_round_stats(cpu, &disk->part0); __nd_iostat_start()
225 part_stat_inc(cpu, &disk->part0, ios[rw]); __nd_iostat_start()
226 part_stat_add(cpu, &disk->part0, sectors[rw], bio_sectors(bio)); __nd_iostat_start()
227 part_inc_in_flight(&disk->part0, rw); __nd_iostat_start()
234 struct gendisk *disk = bio->bi_bdev->bd_disk; nd_iostat_end() local
239 part_stat_add(cpu, &disk->part0, ticks[rw], duration); nd_iostat_end()
240 part_round_stats(cpu, &disk->part0); nd_iostat_end()
241 part_dec_in_flight(&disk->part0, rw); nd_iostat_end()
395 int nd_integrity_init(struct gendisk *disk, unsigned long meta_size) nd_integrity_init() argument
406 blk_integrity_register(disk, &bi); nd_integrity_init()
407 blk_queue_max_integrity_segments(disk->queue, 1); nd_integrity_init()
414 int nd_integrity_init(struct gendisk *disk, unsigned long meta_size) nd_integrity_init() argument
H A Dnd.h26 * support and is an input to the geometry/on-disk-format of a
167 int nd_integrity_init(struct gendisk *disk, unsigned long meta_size);
251 int nvdimm_revalidate_disk(struct gendisk *disk);
269 struct gendisk *disk = bio->bi_bdev->bd_disk; nd_iostat_start() local
271 if (!blk_queue_io_stat(disk->queue)) nd_iostat_start()
/linux-4.4.14/init/
H A Ddo_mounts_rd.c27 int __initdata rd_prompt = 1;/* 1 = prompt for RAM disk, 0 = don't prompt */
48 * This routine tries to find a RAM disk image to load, and returns the
176 "RAMDISK: Couldn't find valid RAM disk image starting at %d.\n", identify_ramdisk_image()
190 int nblocks, i, disk; rd_load_image() local
260 printk(KERN_NOTICE "RAMDISK: Loading %dKiB [%ld disk%s] into ram disk... ", rd_load_image()
262 for (i = 0, disk = 1; i < nblocks; i++) { rd_load_image()
264 printk("done disk #%d.\n", disk++); rd_load_image()
267 printk("Error closing the disk.\n"); rd_load_image()
270 change_floppy("disk #%d", disk); rd_load_image()
273 printk("Error opening disk.\n"); rd_load_image()
276 printk("Loading disk #%d... ", disk); rd_load_image()
304 change_floppy("root floppy disk to be loaded into RAM disk"); rd_load_disk()
H A Ddo_mounts.c38 int __initdata rd_doload; /* 1 = load RAM disk, 0 = don't load */
121 struct gendisk *disk; devt_from_partuuid() local
161 disk = part_to_disk(dev_to_part(dev)); devt_from_partuuid()
162 part = disk_get_part(disk, dev_to_part(dev)->partno + offset); devt_from_partuuid()
188 * 3) /dev/<disk_name> represents the device number of disk
190 * of partition - device number of disk plus the partition number
192 * used when disk name of partitioned disk ends on a digit.
197 * filled hex representation of the 32-bit "NT disk signature", and PP
205 * block_class is used to check if something is a disk name. If the disk
264 * after revalidating the disk, like partitioned md devices name_to_dev_t()
271 /* try disk name without <part number> */ name_to_dev_t()
278 /* try disk name without p<part number> */ name_to_dev_t()
H A Ddo_mounts_initrd.c69 * In case that a resume from disk is carried out by linuxrc or one of handle_initrd()
126 * in that case the ram disk is just set up here, and gets initrd_load()
/linux-4.4.14/Documentation/laptops/
H A Ddslm.c26 /* Check if the disk is in powersave-mode
128 puts("usage: dslm [-w <time>] <disk>"); usage()
135 char *disk = 0; main() local
140 disk = argv[1]; main()
143 disk = argv[3]; main()
147 if (!(fd = open(disk, O_RDONLY|O_NONBLOCK))) { main()
148 printf("Can't open %s, because: %s\n", disk, strerror(errno)); main()
/linux-4.4.14/drivers/md/
H A Ddm-era-target.c37 * disk.
43 * This does not free off the on disk bitset as this will normally be done
85 * Wipes the in-core bitset, and creates a new on disk bitset.
150 * On disk metadata layout
194 struct superblock_disk *disk = dm_block_data(b); sb_prepare_for_write() local
196 disk->blocknr = cpu_to_le64(dm_block_location(b)); sb_prepare_for_write()
197 disk->csum = cpu_to_le32(dm_bm_checksum(&disk->flags, sb_prepare_for_write()
202 static int check_metadata_version(struct superblock_disk *disk) check_metadata_version() argument
204 uint32_t metadata_version = le32_to_cpu(disk->version); check_metadata_version()
218 struct superblock_disk *disk = dm_block_data(b); sb_check() local
221 if (dm_block_location(b) != le64_to_cpu(disk->blocknr)) { sb_check()
223 le64_to_cpu(disk->blocknr), sb_check()
228 if (le64_to_cpu(disk->magic) != SUPERBLOCK_MAGIC) { sb_check()
230 le64_to_cpu(disk->magic), sb_check()
235 csum_le = cpu_to_le32(dm_bm_checksum(&disk->flags, sb_check()
238 if (csum_le != disk->csum) { sb_check()
240 le32_to_cpu(csum_le), le32_to_cpu(disk->csum)); sb_check()
244 return check_metadata_version(disk); sb_check()
353 static void ws_pack(const struct writeset_metadata *core, struct writeset_disk *disk) ws_pack() argument
355 disk->nr_bits = cpu_to_le32(core->nr_bits); ws_pack()
356 disk->root = cpu_to_le64(core->root); ws_pack()
359 static void ws_unpack(const struct writeset_disk *disk, struct writeset_metadata *core) ws_unpack() argument
361 core->nr_bits = le32_to_cpu(disk->nr_bits); ws_unpack()
362 core->root = le64_to_cpu(disk->root); ws_unpack()
477 static void copy_sm_root(struct era_metadata *md, struct superblock_disk *disk) copy_sm_root() argument
479 memcpy(&disk->metadata_space_map_root, copy_sm_root()
489 static void prepare_superblock(struct era_metadata *md, struct superblock_disk *disk) prepare_superblock() argument
491 disk->magic = cpu_to_le64(SUPERBLOCK_MAGIC); prepare_superblock()
492 disk->flags = cpu_to_le32(0ul); prepare_superblock()
495 memset(disk->uuid, 0, sizeof(disk->uuid)); prepare_superblock()
496 disk->version = cpu_to_le32(MAX_ERA_VERSION); prepare_superblock()
498 copy_sm_root(md, disk); prepare_superblock()
500 disk->data_block_size = cpu_to_le32(md->block_size); prepare_superblock()
501 disk->metadata_block_size = cpu_to_le32(DM_ERA_METADATA_BLOCK_SIZE >> SECTOR_SHIFT); prepare_superblock()
502 disk->nr_blocks = cpu_to_le32(md->nr_blocks); prepare_superblock()
503 disk->current_era = cpu_to_le32(md->current_era); prepare_superblock()
505 ws_pack(&md->current_writeset->md, &disk->current_writeset); prepare_superblock()
506 disk->writeset_tree_root = cpu_to_le64(md->writeset_tree_root); prepare_superblock()
507 disk->era_array_root = cpu_to_le64(md->era_array_root); prepare_superblock()
508 disk->metadata_snap = cpu_to_le64(md->metadata_snap); prepare_superblock()
515 struct superblock_disk *disk; write_superblock() local
527 disk = dm_block_data(sblock); write_superblock()
528 prepare_superblock(md, disk); write_superblock()
558 struct superblock_disk *disk; open_metadata() local
566 disk = dm_block_data(sblock); open_metadata()
568 disk->metadata_space_map_root, open_metadata()
569 sizeof(disk->metadata_space_map_root), open_metadata()
578 md->block_size = le32_to_cpu(disk->data_block_size); open_metadata()
579 md->nr_blocks = le32_to_cpu(disk->nr_blocks); open_metadata()
580 md->current_era = le32_to_cpu(disk->current_era); open_metadata()
582 md->writeset_tree_root = le64_to_cpu(disk->writeset_tree_root); open_metadata()
583 md->era_array_root = le64_to_cpu(disk->era_array_root); open_metadata()
584 md->metadata_snap = le64_to_cpu(disk->metadata_snap); open_metadata()
726 struct writeset_disk disk; metadata_digest_lookup_writeset() local
736 md->writeset_tree_root, &key, &disk); metadata_digest_lookup_writeset()
747 ws_unpack(&disk, &d->writeset); metadata_digest_lookup_writeset()
1063 struct superblock_disk *disk; metadata_drop_snap() local
1082 disk = dm_block_data(clone); metadata_drop_snap()
1084 le64_to_cpu(disk->writeset_tree_root)); metadata_drop_snap()
1091 r = dm_array_del(&md->era_array_info, le64_to_cpu(disk->era_array_root)); metadata_drop_snap()
H A Ddm-bufio.h44 * Read a given block from disk. Returns pointer to data. Returns a
59 * Like dm_bufio_read, but don't read anything from the disk. It is
84 * dm_bufio_write_dirty_buffers guarantees that the buffer is on-disk but
96 * to this call are on disk when this call exits.
101 * Send an empty write barrier to the device to flush hardware disk cache.
H A Ddm-log.c60 * For example, if type_name was "clustered-disk", it would search
61 * 'dm-log-clustered-disk' then 'dm-log-clustered'.
195 * The on-disk version of the metadata.
280 static void header_to_disk(struct log_header_core *core, struct log_header_disk *disk) header_to_disk() argument
282 disk->magic = cpu_to_le32(core->magic); header_to_disk()
283 disk->version = cpu_to_le32(core->version); header_to_disk()
284 disk->nr_regions = cpu_to_le64(core->nr_regions); header_to_disk()
287 static void header_from_disk(struct log_header_core *core, struct log_header_disk *disk) header_from_disk() argument
289 core->magic = le32_to_cpu(disk->magic); header_from_disk()
290 core->version = le32_to_cpu(disk->version); header_from_disk()
291 core->nr_regions = le64_to_cpu(disk->nr_regions); header_from_disk()
337 DMWARN("incompatible disk log version"); read_header()
462 DMWARN("couldn't allocate disk io client"); create_log_context()
469 DMWARN("couldn't allocate disk log buffer"); create_log_context()
536 * disk log constructor/destructor
547 DMWARN("wrong number of arguments to disk dirty region log"); disk_ctr()
590 /* read the disk header */ disk_resume()
692 * re-reading the log off disk). So mark all of them disk_flush()
842 .name = "disk",
870 DMWARN("couldn't register disk type"); dm_dirty_log_init()
H A Draid1.c289 * Update disk head position estimator based on IRQ completion info.
291 static inline void update_head_pos(int disk, struct r1bio *r1_bio) update_head_pos() argument
295 conf->mirrors[disk].head_position = update_head_pos()
300 * Find the disk number which triggered given bio
500 * This routine returns the disk from which the requested read should
502 * number - if this matches on the next IO then we use the last disk.
503 * There is also a per-disk 'last know head position' sector that is
506 * perfect sequential match then we pick the disk whose head is closest.
520 int disk; read_balance() local
531 * We take the first readable disk when above the resync window. read_balance()
552 for (disk = 0 ; disk < conf->raid_disks * 2 ; disk++) { read_balance()
559 rdev = rcu_dereference(conf->mirrors[disk].rdev); read_balance()
560 if (r1_bio->bios[disk] == IO_BLOCKED read_balance()
579 best_dist_disk = disk; read_balance()
580 best_pending_disk = disk; read_balance()
607 best_disk = disk; read_balance()
619 dist = abs(this_sector - conf->mirrors[disk].head_position); read_balance()
621 best_disk = disk; read_balance()
624 /* Don't change to another disk for sequential reads */ read_balance()
625 if (conf->mirrors[disk].next_seq_sect == this_sector read_balance()
628 struct raid1_info *mirror = &conf->mirrors[disk]; read_balance()
630 best_disk = disk; read_balance()
633 * iosize, check if there is idle disk. If yes, choose read_balance()
634 * the idle disk. read_balance could already choose an read_balance()
635 * idle disk before noticing it's a sequential IO in read_balance()
636 * this disk. This doesn't matter because this disk read_balance()
638 * first disk has IO size exceeds optimal iosize. In read_balance()
639 * this way, iosize of the first disk will be optimal read_balance()
640 * iosize at least. iosize of the second disk might be read_balance()
641 * small, but not a big deal since when the second disk read_balance()
642 * starts IO, the first disk is likely still busy. read_balance()
656 best_disk = disk; read_balance()
665 best_pending_disk = disk; read_balance()
670 best_dist_disk = disk; read_balance()
675 * If all disks are rotational, choose the closest disk. If any disk is read_balance()
676 * non-rotational, choose the disk with less pending request even the read_balance()
677 * disk is rotational, which might/might not be optimal for raids with read_balance()
755 * disk before proceeding w/ I/O */ flush_pending_writes()
1272 * only applies if the disk is make_request()
1503 printk(KERN_DEBUG " disk %d, wo:%d, o:%d, dev:%s\n", print_conf()
1599 * find the disk ... but prefer rdev->saved_raid_disk raid1_add_disk()
2289 int disk; handle_read_error() local
2317 disk = read_balance(conf, r1_bio, &max_sectors); handle_read_error()
2318 if (disk == -1) { handle_read_error()
2331 r1_bio->read_disk = disk; handle_read_error()
2336 rdev = conf->mirrors[disk].rdev; handle_read_error()
2484 int disk = -1; sync_request() local
2597 if (disk < 0) sync_request()
2598 disk = i; sync_request()
2625 if (disk < 0) sync_request()
2626 disk = wonly; sync_request()
2627 r1_bio->read_disk = disk; sync_request()
2729 } while (r1_bio->bios[disk]->bi_vcnt < RESYNC_PAGES); sync_request()
2778 struct raid1_info *disk; setup_conf() local
2817 disk = conf->mirrors + mddev->raid_disks + disk_idx; rdev_for_each()
2819 disk = conf->mirrors + disk_idx; rdev_for_each()
2821 if (disk->rdev) rdev_for_each()
2823 disk->rdev = rdev; rdev_for_each()
2826 disk->head_position = 0; rdev_for_each()
2827 disk->seq_start = MaxSector; rdev_for_each()
2847 disk = conf->mirrors + i;
2850 disk[conf->raid_disks].rdev) {
2852 if (!disk->rdev) {
2856 disk->rdev =
2857 disk[conf->raid_disks].rdev;
2858 disk[conf->raid_disks].rdev = NULL;
2859 } else if (!test_bit(In_sync, &disk->rdev->flags))
2864 if (!disk->rdev ||
2865 !test_bit(In_sync, &disk->rdev->flags)) {
2866 disk->head_position = 0;
2867 if (disk->rdev &&
2868 (disk->rdev->saved_raid_disk < 0))
H A Dbitmap.h46 * The counter counts pending write requests, plus the on-disk bit.
47 * When the counter is '1' and the resync bits are clear, the on-disk
50 * 0, we first set the disk bit and set the counter to 1.
52 * If the counter is 0, the on-disk bit is clear and the stipe is clean
54 * and sets the on-disk bit (lazily).
56 * If the sweep find the counter at 1, the on-disk bit is cleared and the
131 __le32 daemon_sleep; /* 56 seconds between disk flushes */
200 struct file *file; /* backing disk file */
220 * file, cleaning up bits and flushing out pages to disk as necessary
H A Dlinear.c100 struct dev_info *disk = conf->disks + j; rdev_for_each() local
103 if (j < 0 || j >= raid_disks || disk->rdev) { rdev_for_each()
104 printk(KERN_ERR "md/linear:%s: disk numbering problem. Aborting!\n", rdev_for_each()
109 disk->rdev = rdev; rdev_for_each()
H A Dmultipath.c40 * now we use the first available disk. multipath_map()
200 * Mark disk as unusable multipath_error()
235 printk(" disk%d, o:%d, dev:%s\n", print_multipath_conf()
292 printk(KERN_ERR "hot-remove-disk, slot %d is identified" multipath_remove_disk()
379 struct multipath_info *disk; multipath_run() local
422 disk = conf->multipaths + disk_idx; rdev_for_each()
423 disk->rdev = rdev; rdev_for_each()
/linux-4.4.14/drivers/block/drbd/
H A Ddrbd_state.c74 if (device->state.disk != D_DISKLESS || conn_all_vols_unconf()
146 disk_state = max_t(enum drbd_disk_state, disk_state, device->state.disk); conn_highest_disk()
162 disk_state = min_t(enum drbd_disk_state, disk_state, device->state.disk); conn_lowest_disk()
244 (os.disk != D_FAILED && ns.disk == D_FAILED))) || cl_wide_st_chg()
448 drbd_disk_str(ns.disk), print_st()
488 if (ns.disk != os.disk && flags & CS_DC_DISK) print_state_change()
489 pbp += sprintf(pbp, "disk( %s -> %s ) ", print_state_change()
490 drbd_disk_str(os.disk), print_state_change()
491 drbd_disk_str(ns.disk)); print_state_change()
579 else if (ns.role == R_PRIMARY && ns.conn < C_CONNECTED && ns.disk < D_UP_TO_DATE) is_valid_state()
586 else if (ns.role == R_PRIMARY && ns.disk <= D_INCONSISTENT && ns.pdsk <= D_INCONSISTENT) is_valid_state()
589 else if (ns.conn > C_CONNECTED && ns.disk < D_INCONSISTENT) is_valid_state()
595 else if (ns.conn > C_CONNECTED && ns.disk < D_UP_TO_DATE && ns.pdsk < D_UP_TO_DATE) is_valid_state()
602 ns.disk == D_OUTDATED) is_valid_state()
613 else if (ns.role == R_PRIMARY && ns.disk < D_UP_TO_DATE && ns.pdsk < D_UP_TO_DATE) is_valid_state()
648 if (ns.disk > D_ATTACHING && os.disk == D_DISKLESS) is_valid_soft_transition()
654 if (ns.disk == D_OUTDATED && os.disk < D_OUTDATED && os.disk != D_ATTACHING) is_valid_soft_transition()
724 * imposed on DRBD by the environment. E.g. disk broke or network broke down.
737 if (ns.disk == D_FAILED && os.disk == D_DISKLESS) is_valid_transition()
750 [IMPLICITLY_UPGRADED_DISK] = "Implicitly upgraded disk", print_sanitize_warnings()
765 * When we loose connection, we have to set the state of the peers disk (pdsk)
794 if (ns.conn == C_STANDALONE && ns.disk == D_DISKLESS && ns.role == R_SECONDARY) sanitize_state()
797 /* An implication of the disk states onto the connection state */ sanitize_state()
798 /* Abort resync if a disk fails/detaches */ sanitize_state()
799 if (ns.conn > C_CONNECTED && (ns.disk <= D_FAILED || ns.pdsk <= D_FAILED)) { sanitize_state()
807 if (ns.conn < C_CONNECTED && ns.disk == D_NEGOTIATING && sanitize_state()
810 ns.disk = device->new_state_tmp.disk; sanitize_state()
815 ns.disk = D_DISKLESS; sanitize_state()
823 if (ns.disk == D_CONSISTENT || ns.disk == D_OUTDATED) sanitize_state()
824 ns.disk = D_UP_TO_DATE; sanitize_state()
829 /* Implications of the connection stat on the disk states */ sanitize_state()
892 if (ns.disk > disk_max) sanitize_state()
893 ns.disk = disk_max; sanitize_state()
895 if (ns.disk < disk_min) { sanitize_state()
898 ns.disk = disk_min; sanitize_state()
915 (ns.role == R_PRIMARY && ns.disk < D_UP_TO_DATE && ns.pdsk < D_UP_TO_DATE) && sanitize_state()
916 !(os.role == R_PRIMARY && os.disk < D_UP_TO_DATE && os.pdsk < D_UP_TO_DATE)) sanitize_state()
1033 if ((os.disk != D_FAILED && ns.disk == D_FAILED) || __drbd_set_state()
1034 (os.disk != D_DISKLESS && ns.disk == D_DISKLESS)) __drbd_set_state()
1055 if (os.disk == D_ATTACHING && ns.disk >= D_NEGOTIATING) __drbd_set_state()
1133 if (device->state.disk > D_INCONSISTENT) __drbd_set_state()
1135 if (device->state.disk > D_OUTDATED) __drbd_set_state()
1143 if (os.disk < D_CONSISTENT && ns.disk >= D_CONSISTENT) __drbd_set_state()
1149 if (os.disk == D_INCONSISTENT && os.pdsk == D_INCONSISTENT && __drbd_set_state()
1175 if ((os.disk == D_ATTACHING || os.disk == D_NEGOTIATING) && __drbd_set_state()
1176 ns.disk > D_NEGOTIATING) __drbd_set_state()
1267 if ((os.disk != D_UP_TO_DATE || os.pdsk != D_UP_TO_DATE) after_state_ch()
1268 && (ns.disk == D_UP_TO_DATE && ns.pdsk == D_UP_TO_DATE)) { after_state_ch()
1277 if (!(os.role == R_PRIMARY && os.disk < D_UP_TO_DATE && os.pdsk < D_UP_TO_DATE) && after_state_ch()
1278 (ns.role == R_PRIMARY && ns.disk < D_UP_TO_DATE && ns.pdsk < D_UP_TO_DATE)) after_state_ch()
1291 if ((os.disk == D_ATTACHING || os.disk == D_NEGOTIATING) && after_state_ch()
1367 device->ldev->md.uuid[UI_BITMAP] == 0 && ns.disk >= D_UP_TO_DATE) {
1381 device->ldev->md.uuid[UI_BITMAP] == 0 && ns.disk >= D_UP_TO_DATE) {
1409 os.disk == D_ATTACHING && ns.disk == D_NEGOTIATING) {
1444 if (os.disk != D_FAILED && ns.disk == D_FAILED) {
1462 * that waits for completion from the local disk,
1480 if (device->state.disk != D_FAILED)
1482 "ASSERT FAILED: disk is %s during detach\n",
1483 drbd_disk_str(device->state.disk));
1501 if (os.disk != D_DISKLESS && ns.disk == D_DISKLESS) {
1504 if (device->state.disk != D_DISKLESS)
1506 "ASSERT FAILED: disk is %s while going diskless\n",
1507 drbd_disk_str(device->state.disk));
1517 if (os.disk == D_UP_TO_DATE && ns.disk == D_INCONSISTENT && ns.conn >= C_CONNECTED)
1521 if (ns.disk > D_NEGOTIATING && ns.pdsk > D_NEGOTIATING &&
1535 if (os.disk < D_UP_TO_DATE && os.conn >= C_SYNC_SOURCE && ns.conn == C_CONNECTED)
1546 * if the resync finished cleanly, or aborted because of peer disk
1548 * For resync aborted because of local disk failure, we cannot do
1558 if (ns.disk == D_DISKLESS &&
1645 .disk = D_DISKLESS, conn_old_common_state()
1669 if (cs.disk != os.disk) conn_old_common_state()
1697 if (flags & CS_IGN_OUTD_FAIL && ns.disk == D_OUTDATED && os.disk < D_OUTDATED) conn_is_valid_transition()
1698 ns.disk = os.disk; conn_is_valid_transition()
1734 .disk = D_MASK, conn_set_state()
1759 if (flags & CS_IGN_OUTD_FAIL && ns.disk == D_OUTDATED && os.disk < D_OUTDATED) conn_set_state()
1760 ns.disk = os.disk; conn_set_state()
1770 ns_max.disk = max_t(enum drbd_disk_state, ns.disk, ns_max.disk); conn_set_state()
1776 ns_min.disk = min_t(enum drbd_disk_state, ns.disk, ns_min.disk); conn_set_state()
1786 .disk = D_DISKLESS, conn_set_state()
H A Ddrbd_strings.c77 [-SS_NO_LOCAL_DISK] = "Can not resync without local disk",
78 [-SS_NO_REMOTE_DISK] = "Can not resync without remote disk",
84 [-SS_IS_DISKLESS] = "Device is diskless, the requested operation requires a disk",
H A Ddrbd_protocol.h33 P_NEG_ACK = 0x19, /* Sent if local disk is unusable */
34 P_NEG_DREPLY = 0x1a, /* Local disk is broken... */
35 P_NEG_RS_DREPLY = 0x1b, /* Local disk is broken... */
239 u64 d_size; /* size of disk */
H A Ddrbd_proc.c259 ds .. disk state (local/remote) drbd_seq_show()
264 dw .. disk write drbd_seq_show()
265 dr .. disk read drbd_seq_show()
286 state.disk == D_DISKLESS && drbd_seq_show()
302 drbd_disk_str(state.disk), drbd_seq_show()
H A Ddrbd_actlog.c44 * in the on disk ring buffer */
101 device->state.disk <= D_FAILED); drbd_md_get_buffer()
164 if (!(rw & WRITE) && device->state.disk == D_DISKLESS && device->ldev == NULL) _drbd_md_sync_page_io()
446 /* transaction number, modulo on-disk ring buffer wrap around */ al_tr_number_to_on_disk_sector()
449 /* ... to aligned 4k on disk block */ al_tr_number_to_on_disk_sector()
455 /* ... plus offset to the on disk position */ al_tr_number_to_on_disk_sector()
470 drbd_err(device, "disk is %s, cannot start al transaction\n", al_write_transaction()
471 drbd_disk_str(device->state.disk)); al_write_transaction()
476 if (device->state.disk < D_INCONSISTENT) { al_write_transaction()
478 "disk is %s, cannot write al transaction\n", al_write_transaction()
479 drbd_disk_str(device->state.disk)); al_write_transaction()
487 drbd_err(device, "disk failed while waiting for md_io buffer\n"); al_write_transaction()
647 * TODO will be obsoleted once we have a caching lru of the on disk bitmap
849 return 0; /* no disk, no metadata, no bitmap to manipulate bits in */ __drbd_change_sync()
/linux-4.4.14/include/uapi/linux/
H A Dromfs_fs.h22 /* On-disk "super block" */
32 /* On disk inode */
H A Dbfs_fs.h2 * include/linux/bfs_fs.h - BFS data structures on disk.
22 /* BFS inode layout on disk */
49 /* BFS superblock layout on disk */
H A Dblkpg.h5 * Partition table and disk geometry handling
11 * find the device number of the encompassing disk)
12 * get_all_partitions() (given the device number of a disk, return the
H A Dminix_fs.h31 * This is the original minix inode layout on disk.
63 * minix super-block data on disk
79 * V3 minix super-block data on disk
H A Dfd.h59 /* set/get disk parameters */
77 /* begin formatting a disk */
81 /* end formatting a disk */
141 unsigned char spindown_offset; /* decides in which position the disk
156 * disk changes.
171 * used in succession to try to read the disk. If the FDC cannot lock onto
172 * the disk, the next format is tried. This uses the variable 'probing'.
176 int checkfreq; /* how often should the drive be checked for disk
187 FD_DISK_CHANGED_BIT, /* disk has been changed since last i/o */
188 FD_DISK_WRITABLE_BIT, /* disk is writable */
228 unsigned long last_checked; /* when was the drive last checked for a disk
331 #define FD_RAW_DISK_CHANGE 4 /* out: disk change flag was set */
333 #define FD_RAW_SPIN 0x10 /* spin up the disk for this command */
336 #define FD_RAW_NEED_DISK 0x40 /* this command needs a disk to be present */
379 /* eject the disk */
H A Ddqblk_xfs.h36 #define Q_XGETQUOTA XQM_CMD(3) /* get disk limits and usage */
37 #define Q_XSETQLIM XQM_CMD(4) /* set disk limits */
39 #define Q_XQUOTARM XQM_CMD(6) /* free disk space used by dquots */
56 __u64 d_blk_hardlimit;/* absolute limit on disk blks */
57 __u64 d_blk_softlimit;/* preferred limit on disk blks */
60 __u64 d_bcount; /* # disk blocks owned by the user */
64 __s32 d_btimer; /* similar to above; for disk blocks */
66 __u16 d_bwarns; /* # warnings issued wrt disk blocks */
69 __u64 d_rtb_softlimit;/* preferred limit on RT disk blks */
71 __s32 d_rtbtimer; /* similar to above; for RT disk blks */
72 __u16 d_rtbwarns; /* # warnings issued wrt RT disk blks */
H A Dparport.h42 PARPORT_CLASS_HDC, /* Hard disk controller */
45 PARPORT_CLASS_FDC, /* Floppy disk controller */
H A Dbcache.h5 * Bcache on disk data structures
53 /* Next time I change the on disk format, KEY_OFFSET() won't be 64 bits */
260 * On disk format for a journal entry:
265 * flushed to disk yet.
267 * version is for on disk format changes.
345 * On disk a btree node is a list/log of these; within each set the keys are
H A Defs_fs_sb.h24 /* efs superblock on disk */
H A Dqnx4_fs.h41 * This is the original qnx4 inode layout on disk.
H A Dresource.h69 * and other sensitive information are never written to disk.
/linux-4.4.14/fs/
H A Dblock_dev.c842 struct gendisk *disk; bd_start_claiming() local
852 disk = get_gendisk(bdev->bd_dev, &partno); bd_start_claiming()
853 if (!disk) bd_start_claiming()
865 whole = bdget_disk(disk, 0); bd_start_claiming()
869 module_put(disk->fops->owner); bd_start_claiming()
870 put_disk(disk); bd_start_claiming()
892 struct gendisk *disk; member in struct:bd_holder_disk
897 struct gendisk *disk) bd_find_holder_disk()
902 if (holder->disk == disk) bd_find_holder_disk()
918 * bd_link_disk_holder - create symlinks between holding disk and slave bdev
920 * @disk: the holding disk
926 * - from "slaves" directory of the holder @disk to the claimed @bdev
927 * - from "holders" directory of the @bdev to the holder @disk
929 * For example, if /dev/dm-0 maps to /dev/sda and disk for dm-0 is
936 * ensure that both @bdev and @disk are valid during the creation and
945 int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk) bd_link_disk_holder() argument
955 if (WARN_ON(!disk->slave_dir || !bdev->bd_part->holder_dir)) bd_link_disk_holder()
958 holder = bd_find_holder_disk(bdev, disk); bd_link_disk_holder()
971 holder->disk = disk; bd_link_disk_holder()
974 ret = add_symlink(disk->slave_dir, &part_to_dev(bdev->bd_part)->kobj); bd_link_disk_holder()
978 ret = add_symlink(bdev->bd_part->holder_dir, &disk_to_dev(disk)->kobj); bd_link_disk_holder()
991 del_symlink(disk->slave_dir, &part_to_dev(bdev->bd_part)->kobj); bd_link_disk_holder()
1003 * @disk: the holding disk
1010 void bd_unlink_disk_holder(struct block_device *bdev, struct gendisk *disk) bd_unlink_disk_holder() argument
1016 holder = bd_find_holder_disk(bdev, disk); bd_unlink_disk_holder()
1019 del_symlink(disk->slave_dir, &part_to_dev(bdev->bd_part)->kobj); bd_unlink_disk_holder()
1021 &disk_to_dev(disk)->kobj); bd_unlink_disk_holder()
1033 * flush_disk - invalidates all buffer-cache entries on a disk
1038 * Invalidates all buffer-cache entries on a disk. It should be called
1039 * when a disk has been changed -- either by a media change or online
1050 "resized disk %s\n", name); flush_disk()
1060 * check_disk_size_change - checks for disk size change and adjusts bdev size.
1061 * @disk: struct gendisk to check
1064 * This routine checks to see if the bdev size does not match the disk size
1067 void check_disk_size_change(struct gendisk *disk, struct block_device *bdev) check_disk_size_change() argument
1071 disk_size = (loff_t)get_capacity(disk) << 9; check_disk_size_change()
1076 disk_name(disk, 0, name); check_disk_size_change()
1088 * @disk: struct gendisk to be revalidated
1094 int revalidate_disk(struct gendisk *disk) revalidate_disk() argument
1099 if (disk->fops->revalidate_disk) revalidate_disk()
1100 ret = disk->fops->revalidate_disk(disk); revalidate_disk()
1101 blk_integrity_revalidate(disk); revalidate_disk()
1102 bdev = bdget_disk(disk, 0); revalidate_disk()
1107 check_disk_size_change(disk, bdev); revalidate_disk()
1126 struct gendisk *disk = bdev->bd_disk; check_disk_change() local
1127 const struct block_device_operations *bdops = disk->fops; check_disk_change()
1130 events = disk_clear_events(disk, DISK_EVENT_MEDIA_CHANGE | check_disk_change()
1171 struct gendisk *disk; __blkdev_get() local
1195 disk = get_gendisk(bdev->bd_dev, &partno); __blkdev_get()
1196 if (!disk) __blkdev_get()
1198 owner = disk->fops->owner; __blkdev_get()
1200 disk_block_events(disk); __blkdev_get()
1203 bdev->bd_disk = disk; __blkdev_get()
1204 bdev->bd_queue = disk->queue; __blkdev_get()
1206 bdev->bd_inode->i_flags = disk->fops->direct_access ? S_DAX : 0; __blkdev_get()
1209 bdev->bd_part = disk_get_part(disk, partno); __blkdev_get()
1214 if (disk->fops->open) { __blkdev_get()
1215 ret = disk->fops->open(bdev, mode); __blkdev_get()
1217 /* Lost a race with 'disk' being __blkdev_get()
1226 disk_unblock_events(disk); __blkdev_get()
1227 put_disk(disk); __blkdev_get()
1234 bd_set_size(bdev,(loff_t)get_capacity(disk)<<9); __blkdev_get()
1244 rescan_partitions(disk, bdev); __blkdev_get()
1246 invalidate_partitions(disk, bdev); __blkdev_get()
1252 whole = bdget_disk(disk, 0); __blkdev_get()
1261 bdev->bd_part = disk_get_part(disk, partno); __blkdev_get()
1262 if (!(disk->flags & GENHD_FL_UP) || __blkdev_get()
1291 /* only one opener holds refs to the module and disk */ __blkdev_get()
1292 put_disk(disk); __blkdev_get()
1299 disk_unblock_events(disk); __blkdev_get()
1312 disk_unblock_events(disk); __blkdev_get()
1313 put_disk(disk); __blkdev_get()
1358 struct gendisk *disk = whole->bd_disk; blkdev_get() local
1393 (disk->flags & GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE)) { blkdev_get()
1395 disk_block_events(disk); blkdev_get()
1515 struct gendisk *disk = bdev->bd_disk; __blkdev_put() local
1536 if (disk->fops->release) __blkdev_put()
1537 disk->fops->release(disk, mode); __blkdev_put()
1540 struct module *owner = disk->fops->owner; __blkdev_put()
1549 put_disk(disk); __blkdev_put()
896 bd_find_holder_disk(struct block_device *bdev, struct gendisk *disk) bd_find_holder_disk() argument
H A Dsync.c101 * writeback. At this point all data is on disk so metadata should be stable
173 * vfs_fsync_range - helper to sync a range of data & metadata to disk
179 * Write back data in range @start..@end and metadata for @file to disk. If
204 * Write back data and metadata for @file to disk. If @datasync is
247 * significant periods due to exhaustion of disk request structures.
259 * are not presently under writeout. This is an asynchronous flush-to-disk
270 * sys_sync_file_range() are committed to disk.
279 * already-instantiated disk blocks, there are no guarantees here that the data
H A Dmpage.c131 * This is the worker routine which does all the work of mapping the disk
133 * blocks are not contiguous on the disk.
136 * represent the validity of its disk mapping and to decide when to do the next
338 * their disk mappings, and then submits them all. That's fine, but obtaining
339 * the disk mappings may require I/O. Reads of indirect blocks, for example.
353 * This all causes the disk requests to be issued in the correct order.
415 * If the page has buffers then they will be used for obtaining the disk
459 * disk before we reach the platter. clean_buffers()
541 * The page has no buffers: map it to disk __mpage_writepage()
/linux-4.4.14/block/partitions/
H A Dsysv68.c11 * Volume ID structure: on first 256-bytes sector of disk
20 * config block: second 256-bytes sector on disk
76 slices -= 1; /* last slice is the whole disk */ sysv68_partition()
H A Defi.c34 * - check for first/last_usable_lba outside of size of disk
40 * - On-disk structure and copy in memory is *always* LE now -
55 * thing that keeps EFI GUIDs on disk.
75 * sector of an odd-sized disk from user space. No tools have ever
145 * the part[0] entry for this disk, and is the number of
146 * physical sectors available on the disk.
219 * Protective MBRs take up the lesser of the whole disk is_pmbr_valid()
220 * or 2 TiB (32bit LBA), ignoring the rest of the disk. is_pmbr_valid()
223 * the disk size. is_pmbr_valid()
228 * an image from a smaller disk to a larger disk. is_pmbr_valid()
233 pr_debug("GPT: mbr size in lba (%u) different than whole disk (%u).\n", is_pmbr_valid()
242 * read_lba(): Read bytes from disk, starting at given LBA
243 * @state: disk parsed partitions
279 * alloc_read_gpt_entries(): reads partition entries from disk
280 * @state: disk parsed partitions
314 * alloc_read_gpt_header(): Allocates GPT header, reads into it from disk
315 * @state: disk parsed partitions
343 * @state: disk parsed partitions
410 * within the disk. is_gpt_valid()
465 * @lastlba: last lba of the disk
480 * compare_gpts() - Search disk for valid GPT headers and PTEs
554 pr_warn("GPT:Primary header thinks Alt. header is not at the end of the disk.\n"); compare_gpts()
562 pr_warn("GPT:Alternate GPT header not at the end of the disk.\n"); compare_gpts()
575 * find_valid_gpt() - Search disk for valid GPT headers and PTEs
576 * @state: disk parsed partitions
668 * @state: disk parsed partitions
670 * Description: called from check.c, if the disk contains GPT
673 * If the first block on the disk is a legacy MBR,
H A Datari.h29 u32 hd_siz; /* size of disk in blocks */
H A Dldm.c167 ldm_error("PRIVHEAD disk size doesn't match real disk size"); ldm_parse_privhead()
322 * Read and compare all three privheads from disk.
324 * The privheads on disk show the size and location of the main disk area and
326 * @hd, which contains the real size of the disk.
377 ldm_crit ("Database extends beyond the end of the disk."); ldm_validate_privheads()
543 * ldm_validate_partition_table - Determine whether bdev might be a dynamic disk
547 * disk or not. It looks for an MS-DOS-style partition table containing at
555 * Return: 'true' @state->bdev is a dynamic disk
556 * 'false' @state->bdev is not a dynamic disk, or an error occurred
585 ldm_debug ("Found W2K dynamic disk partition type."); ldm_validate_partition_table()
597 * The primary PRIVHEAD, at the beginning of the physical disk, tells us
598 * the GUID of this disk. This function searches for the GUID in a linked
612 if (!memcmp (v->vblk.disk.disk_id, ldb->ph.disk_id, GUID_SIZE)) ldm_get_disk_objid()
624 * The database contains ALL the partitions for ALL disk groups, so we need to
625 * filter out this specific disk. Using the disk's object id, we can find all
626 * the partitions in the database that belong to this disk.
641 struct vblk *disk; ldm_create_data_partitions() local
647 disk = ldm_get_disk_objid (ldb); ldm_create_data_partitions()
648 if (!disk) { ldm_create_data_partitions()
649 ldm_crit ("Can't find the ID of this disk in the database."); ldm_create_data_partitions()
660 if (part->disk_id != disk->obj_id) ldm_create_data_partitions()
928 struct vblk_disk *disk; ldm_parse_dsk3() local
944 disk = &vb->vblk.disk; ldm_parse_dsk3()
945 ldm_get_vstr (buffer + 0x18 + r_diskid, disk->alt_name, ldm_parse_dsk3()
946 sizeof (disk->alt_name)); ldm_parse_dsk3()
947 if (!ldm_parse_guid (buffer + 0x19 + r_name, disk->disk_id)) ldm_parse_dsk3()
967 struct vblk_disk *disk; ldm_parse_dsk4() local
981 disk = &vb->vblk.disk; ldm_parse_dsk4()
982 memcpy (disk->disk_id, buffer + 0x18 + r_name, GUID_SIZE); ldm_parse_dsk4()
1410 * ldm_get_vblks - Read the on-disk database of VBLKs into memory
1415 * To use the information from the VBLKs, they need to be read from the disk,
1493 * ldm_partition - Find out whether a device is a dynamic disk and handle it
1496 * This determines whether the device @bdev is a dynamic disk and if so creates
1504 * Return: 1 Success, @state->bdev is a dynamic disk and we handled it
1505 * 0 Success, @state->bdev is not a dynamic disk
1507 * Or @state->bdev is a dynamic disk, but it may be corrupted
H A Dibm.c80 * - on an ECKD disk it's block 2 find_label()
81 * - on an FBA disk it's block 1 find_label()
82 * - on an CMS formatted FBA disk it is sector 1, even if the block size find_label()
150 * get start of VTOC from the disk label and then search for format1 find_vol1_partitions()
217 * the disk, otherwise we need additional information find_lnx1_partitions()
253 * VM style CMS1 labeled disk find_cms1_partitions()
260 /* disk is reserved minidisk */ find_cms1_partitions()
H A Daix.c75 * the part[0] entry for this disk, and is the number of
76 * physical sectors available on the disk.
86 * read_lba(): Read bytes from disk, starting at given LBA
126 * Allocates space for pvd and fill it with disk blocks at @lba
151 * Allocates space for lvn and fill it with disk blocks at @lba
H A Dsgi.c64 /* All SGI disk labels have 16 partitions, disks under Linux only sgi_partition()
H A Dcheck.c43 * Probe partition formats with tables at disk address 0
58 * disk address 0xdc0. Since these may also have stale
H A Dldm.h75 #define COMP_BASIC 0x02 /* Basic disk */
194 struct vblk_disk disk; member in union:vblk::__anon3262
/linux-4.4.14/arch/ia64/dig/
H A Dsetup.c34 * is physical disk 1 partition 1 and the Linux root disk is dig_setup()
35 * physical disk 1 partition 2. dig_setup()
/linux-4.4.14/drivers/block/aoe/
H A Daoeblk.c37 struct gendisk *disk = dev_to_disk(dev); aoedisk_show_state() local
38 struct aoedev *d = disk->private_data; aoedisk_show_state()
50 struct gendisk *disk = dev_to_disk(dev); aoedisk_show_mac() local
51 struct aoedev *d = disk->private_data; aoedisk_show_mac()
61 struct gendisk *disk = dev_to_disk(dev); aoedisk_show_netif() local
62 struct aoedev *d = disk->private_data; aoedisk_show_netif()
99 struct gendisk *disk = dev_to_disk(dev); aoedisk_show_fwver() local
100 struct aoedev *d = disk->private_data; aoedisk_show_fwver()
107 struct gendisk *disk = dev_to_disk(dev); aoedisk_show_payload() local
108 struct aoedev *d = disk->private_data; aoedisk_show_payload()
262 aoeblk_release(struct gendisk *disk, fmode_t mode) aoeblk_release() argument
264 struct aoedev *d = disk->private_data; aoeblk_release()
302 printk(KERN_ERR "aoe: disk not up\n"); aoeblk_getgeo()
322 pr_err("aoe: disk not up\n"); aoeblk_ioctl()
373 pr_err("aoe: cannot allocate disk structure for %ld.%d\n", aoeblk_gdalloc()
/linux-4.4.14/drivers/block/zram/
H A Dzram_drv.c819 &zram->disk->part0); zram_bvec_rw()
829 generic_end_io_acct(rw, &zram->disk->part0, start_time); zram_bvec_rw()
1014 set_capacity(zram->disk, 0); zram_reset_device()
1015 part_stat_set_all(&zram->disk->part0, 0); zram_reset_device()
1037 meta = zram_meta_alloc(zram->disk->disk_name, disksize); disksize_store()
1061 set_capacity(zram->disk, zram->disksize >> SECTOR_SHIFT); disksize_store()
1065 * Revalidate disk out of the init_lock to avoid lockdep splat. disksize_store()
1066 * It's okay because disk's capacity is protected by init_lock disksize_store()
1069 revalidate_disk(zram->disk); disksize_store()
1097 bdev = bdget_disk(zram->disk, 0); reset_store()
1116 revalidate_disk(zram->disk); reset_store()
1210 pr_err("Error allocating disk queue for device %d\n", zram_add()
1219 zram->disk = alloc_disk(1); zram_add()
1220 if (!zram->disk) { zram_add()
1221 pr_err("Error allocating disk structure for device %d\n", zram_add()
1227 zram->disk->major = zram_major; zram_add()
1228 zram->disk->first_minor = device_id; zram_add()
1229 zram->disk->fops = &zram_devops; zram_add()
1230 zram->disk->queue = queue; zram_add()
1231 zram->disk->queue->queuedata = zram; zram_add()
1232 zram->disk->private_data = zram; zram_add()
1233 snprintf(zram->disk->disk_name, 16, "zram%d", device_id); zram_add()
1236 set_capacity(zram->disk, 0); zram_add()
1238 queue_flag_set_unlocked(QUEUE_FLAG_NONROT, zram->disk->queue); zram_add()
1239 queue_flag_clear_unlocked(QUEUE_FLAG_ADD_RANDOM, zram->disk->queue); zram_add()
1244 blk_queue_physical_block_size(zram->disk->queue, PAGE_SIZE); zram_add()
1245 blk_queue_logical_block_size(zram->disk->queue, zram_add()
1247 blk_queue_io_min(zram->disk->queue, PAGE_SIZE); zram_add()
1248 blk_queue_io_opt(zram->disk->queue, PAGE_SIZE); zram_add()
1249 zram->disk->queue->limits.discard_granularity = PAGE_SIZE; zram_add()
1250 blk_queue_max_discard_sectors(zram->disk->queue, UINT_MAX); zram_add()
1260 zram->disk->queue->limits.discard_zeroes_data = 1; zram_add()
1262 zram->disk->queue->limits.discard_zeroes_data = 0; zram_add()
1263 queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, zram->disk->queue); zram_add()
1265 add_disk(zram->disk); zram_add()
1267 ret = sysfs_create_group(&disk_to_dev(zram->disk)->kobj, zram_add()
1278 pr_info("Added device: %s\n", zram->disk->disk_name); zram_add()
1282 del_gendisk(zram->disk); zram_add()
1283 put_disk(zram->disk); zram_add()
1297 bdev = bdget_disk(zram->disk, 0); zram_remove()
1318 sysfs_remove_group(&disk_to_dev(zram->disk)->kobj, zram_remove()
1326 pr_info("Removed device: %s\n", zram->disk->disk_name); zram_remove()
1328 blk_cleanup_queue(zram->disk->queue); zram_remove()
1329 del_gendisk(zram->disk); zram_remove()
1330 put_disk(zram->disk); zram_remove()
H A Dzram_drv.h71 /* Allocated for each disk page */
98 struct gendisk *disk; member in struct:zram
113 * we can store in a disk.
/linux-4.4.14/drivers/scsi/
H A Dsr.c7 * Linux scsi disk driver by
138 static inline struct scsi_cd *scsi_cd(struct gendisk *disk) scsi_cd() argument
140 return container_of(disk->private_data, struct scsi_cd, driver); scsi_cd()
160 static inline struct scsi_cd *scsi_cd_get(struct gendisk *disk) scsi_cd_get() argument
165 if (disk->private_data == NULL) scsi_cd_get()
167 cd = scsi_cd(disk); scsi_cd_get()
369 if (error_sector < get_capacity(cd->disk) && sr_done()
371 set_capacity(cd->disk, error_sector); sr_done()
536 static void sr_block_release(struct gendisk *disk, fmode_t mode) sr_block_release() argument
538 struct scsi_cd *cd = scsi_cd(disk); sr_block_release()
582 static unsigned int sr_block_check_events(struct gendisk *disk, sr_block_check_events() argument
585 struct scsi_cd *cd = scsi_cd(disk); sr_block_check_events()
593 static int sr_block_revalidate_disk(struct gendisk *disk) sr_block_revalidate_disk() argument
595 struct scsi_cd *cd = scsi_cd(disk); sr_block_revalidate_disk()
654 struct gendisk *disk; sr_probe() local
670 disk = alloc_disk(1); sr_probe()
671 if (!disk) sr_probe()
684 disk->major = SCSI_CDROM_MAJOR; sr_probe()
685 disk->first_minor = minor; sr_probe()
686 sprintf(disk->disk_name, "sr%d", minor); sr_probe()
687 disk->fops = &sr_bdops; sr_probe()
688 disk->flags = GENHD_FL_CD | GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE; sr_probe()
689 disk->events = DISK_EVENT_MEDIA_CHANGE | DISK_EVENT_EJECT_REQUEST; sr_probe()
694 cd->disk = disk; sr_probe()
696 cd->disk = disk; sr_probe()
716 disk->driverfs_dev = &sdev->sdev_gendev; sr_probe()
717 set_capacity(disk, cd->capacity); sr_probe()
718 disk->private_data = &cd->driver; sr_probe()
719 disk->queue = sdev->request_queue; sr_probe()
720 cd->cdi.disk = disk; sr_probe()
732 disk->flags |= GENHD_FL_REMOVABLE; sr_probe()
733 add_disk(disk); sr_probe()
742 put_disk(disk); sr_probe()
823 set_capacity(cd->disk, cd->capacity); get_sectorsize()
969 struct gendisk *disk = cd->disk; sr_kref_release() local
972 clear_bit(MINOR(disk_devt(disk)), sr_index_bits); sr_kref_release()
977 disk->private_data = NULL; sr_kref_release()
979 put_disk(disk); sr_kref_release()
990 del_gendisk(cd->disk); sr_remove()
H A Dsd.h66 struct gendisk *disk; member in struct:scsi_disk
83 unsigned ATO : 1; /* state of disk ATO bit */
85 unsigned WCE : 1; /* state of disk WCE bit */
86 unsigned RCD : 1; /* state of disk RCD bit, unused */
87 unsigned DPOFUA : 1; /* state of disk DPOFUA bit */
100 static inline struct scsi_disk *scsi_disk(struct gendisk *disk) scsi_disk() argument
102 return container_of(disk->private_data, struct scsi_disk, driver); scsi_disk()
106 (sdsk)->disk ? \
108 (sdsk)->disk->disk_name, fmt, ##a) : \
254 static inline void sd_dif_config_host(struct scsi_disk *disk) sd_dif_config_host() argument
H A Dsr.h3 * CD-ROM disk driver header file
7 * SCSI disk driver header file by
56 struct gendisk *disk; member in struct:scsi_cd
H A Dsd.c5 * Linux scsi disk driver
73 MODULE_DESCRIPTION("SCSI disk (sd) driver");
105 static void sd_unlock_native_capacity(struct gendisk *disk);
148 blk_queue_flush(sdkp->disk->queue, flush); sd_set_flush_flag()
216 revalidate_disk(sdkp->disk); cache_type_store()
541 * Device no to disk mapping:
549 * ones with major1, ... Disk 256 is for major0 again, disk 272
569 static struct scsi_disk *scsi_disk_get(struct gendisk *disk) scsi_disk_get() argument
575 if (disk->private_data) { scsi_disk_get()
576 sdkp = scsi_disk(disk); scsi_disk_get()
636 struct request_queue *q = sdkp->disk->queue; sd_config_discard()
779 * discarded on disk. This allows us to report completion on the full sd_setup_discard_cmnd()
794 struct request_queue *q = sdkp->disk->queue; sd_config_write_same()
902 struct gendisk *disk = rq->rq_disk; sd_setup_read_write_cmnd() local
915 sdkp = scsi_disk(disk); sd_setup_read_write_cmnd()
927 block + blk_rq_sectors(rq) > get_capacity(disk)) { sd_setup_read_write_cmnd()
941 /* printk("SCSI disk has been changed or is not present. Prohibiting further I/O.\n"); */ sd_setup_read_write_cmnd()
949 threshold = get_capacity(disk) - SD_LAST_BUGGY_SECTORS * sd_setup_read_write_cmnd()
973 * and not force the scsi disk driver to use bounce buffers sd_setup_read_write_cmnd()
1165 * sd_open - open a scsi disk device
1219 * It is possible that the disk changing stuff resulted in sd_open()
1242 * scsi disk.
1249 * on this disk.
1253 static void sd_release(struct gendisk *disk, fmode_t mode) sd_release() argument
1255 struct scsi_disk *sdkp = scsi_disk(disk); sd_release()
1315 struct gendisk *disk = bdev->bd_disk; sd_ioctl() local
1316 struct scsi_disk *sdkp = scsi_disk(disk); sd_ioctl()
1321 SCSI_LOG_IOCTL(1, sd_printk(KERN_INFO, sdkp, "sd_ioctl: disk=%s, " sd_ioctl()
1322 "cmd=0x%x\n", disk->disk_name, cmd)); sd_ioctl()
1392 * @disk: kernel device descriptor
1393 * @clearing: disk events currently being cleared
1399 static unsigned int sd_check_events(struct gendisk *disk, unsigned int clearing) sd_check_events() argument
1401 struct scsi_disk *sdkp = scsi_disk(disk); sd_check_events()
1446 * For removable scsi disk we have to recognise the presence sd_check_events()
1447 * of a disk in the drive. sd_check_events()
1525 revalidate_disk(sdkp->disk); sd_rescan()
1701 "Medium access timeout failure. Offlining disk!\n"); sd_eh_action()
1852 * spinup disk - called only in sd_revalidate_disk()
1923 sd_printk(KERN_NOTICE, sdkp, "Spinning up disk..."); sd_spinup_disk()
1977 * Determine whether disk supports Data Integrity Field.
1999 " protection type %u. Disabling disk!\n", sd_read_protection_type()
2227 * read disk capacity
2369 set_disk_ro(sdkp->disk, 0); sd_read_write_protect_flag()
2407 set_disk_ro(sdkp->disk, sdkp->write_prot); sd_read_write_protect_flag()
2641 * sd_read_block_limits - Query disk device for preferred I/O sizes.
2642 * @disk: disk to query
2655 blk_queue_io_min(sdkp->disk->queue, sd_read_block_limits()
2708 * @disk: disk to query
2726 queue_flag_set_unlocked(QUEUE_FLAG_NONROT, sdkp->disk->queue); sd_read_block_characteristics()
2727 queue_flag_clear_unlocked(QUEUE_FLAG_ADD_RANDOM, sdkp->disk->queue); sd_read_block_characteristics()
2736 * @disk: disk to query
2809 * sd_revalidate_disk - called the first time a new disk is seen,
2810 * performs disk spin up, read_capacity, etc.
2811 * @disk: struct gendisk we care about
2813 static int sd_revalidate_disk(struct gendisk *disk) sd_revalidate_disk() argument
2815 struct scsi_disk *sdkp = scsi_disk(disk); sd_revalidate_disk()
2817 struct request_queue *q = sdkp->disk->queue; sd_revalidate_disk()
2891 set_capacity(disk, logical_to_sectors(sdp, sdkp->capacity)); sd_revalidate_disk()
2901 * @disk: struct gendisk to set capacity for
2904 * on @disk reach beyond the end of the device. If the SCSI host
2911 static void sd_unlock_native_capacity(struct gendisk *disk) sd_unlock_native_capacity() argument
2913 struct scsi_device *sdev = scsi_disk(disk)->device; sd_unlock_native_capacity()
2920 * sd_format_disk_name - format disk name
2922 * @index: index of the disk to format name for
2926 * SCSI disk names starts at sda. The 26th device is sdz and the
2977 gd = sdkp->disk; sd_probe_async()
3082 sdev_printk(KERN_WARNING, sdp, "SCSI disk (sd) name length exceeded.\n"); sd_probe()
3088 sdkp->disk = gd; sd_probe()
3132 * sd_remove - called whenever a scsi disk (previously recognized by
3148 devt = disk_devt(sdkp->disk); sd_remove()
3154 del_gendisk(sdkp->disk); sd_remove()
3180 struct gendisk *disk = sdkp->disk; scsi_disk_release() local
3186 disk->private_data = NULL; scsi_disk_release()
3187 put_disk(disk); scsi_disk_release()
3249 sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n"); sd_shutdown()
3274 sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n"); sd_suspend_common()
3305 sd_printk(KERN_NOTICE, sdkp, "Starting disk\n"); sd_resume()
3401 sdkp->disk ? sdkp->disk->disk_name : NULL, sshdr); sd_print_sense_hdr()
H A Dsd_dif.c44 struct gendisk *disk = sdkp->disk; sd_dif_config_host() local
95 blk_integrity_register(disk, &bi); sd_dif_config_host()
109 * (we could be reading from real disk as opposed to MD/DM device. So
H A Dscsicam.c55 * scsicam_bios_param - Determine geometry of a disk in cylinders/heads/sectors.
57 * @capacity: size of the disk in sectors
114 * @capacity: size of the disk in sectors
201 * SCSI disk in terms of lost space of size capacity, storing
226 * of the disk while allowing for very large disks to be
H A Dimm.h31 * Have mounted disk, copied file, dismounted disk, remount disk, diff file
H A Dhpsa_cmd.h213 u32 ioaccel_handle; /**< Handle to access this disk via the
226 * disk blocks */
230 __le16 strip_size; /* blocks used on each disk / stripe */
231 __le64 disk_starting_blk; /* First disk block used in volume */
232 __le64 disk_blk_cnt; /* disk blocks used by volume / disk */
233 __le16 data_disks_per_row; /* data disk entries / row in the map */
234 __le16 metadata_disks_per_row;/* mirror/parity disk entries / row
435 * bypass the RAID stack and go directly to the physical disk
/linux-4.4.14/drivers/scsi/osd/
H A Dosd_uld.c89 struct gendisk *disk; member in struct:osd_uld_device
409 oud->disk ? oud->disk->disk_name : NULL); __remove()
411 if (oud->disk) __remove()
412 put_disk(oud->disk); __remove()
421 struct gendisk *disk; osd_probe() local
451 /* allocate a disk and set it up */ osd_probe()
453 disk = alloc_disk(1); osd_probe()
454 if (!disk) { osd_probe()
458 disk->major = SCSI_OSD_MAJOR; osd_probe()
459 disk->first_minor = oud->minor; osd_probe()
460 sprintf(disk->disk_name, "osd%d", oud->minor); osd_probe()
461 oud->disk = disk; osd_probe()
491 error = dev_set_name(&oud->class_dev, "%s", disk->disk_name); osd_probe()
505 OSD_INFO("osd_probe %s\n", disk->disk_name); osd_probe()
512 put_disk(disk); osd_probe()
/linux-4.4.14/fs/jfs/
H A Djfs_dmap.h45 * maximum l2 number of disk blocks at the various dmapctl levels.
52 * maximum number of disk blocks at the various dmapctl levels.
75 * convert disk block number to the logical block number of the dmap
76 * describing the disk block. s is the log2(number of logical blocks per page)
89 * convert disk block number to the logical block number of the LEVEL 0
90 * dmapctl describing the disk block. s is the log2(number of logical blocks
104 * convert disk block number to the logical block number of the LEVEL 1
105 * dmapctl describing the disk block. s is the log2(number of logical blocks
119 * convert disk block number to the logical block number of the dmapctl
120 * at the specified level which describes the disk block.
132 /* convert disk block number to allocation group number.
136 /* convert allocation group number to starting disk block
171 * disk map control page per level.
202 * on-disk aggregate disk allocation map descriptor.
241 * in-memory aggregate disk allocation map descriptor.
244 struct dbmap db_bmap; /* on-disk aggregate map descriptor */
H A Djfs_filsys.h45 /* mount time flag to disable journaling to disk */
112 #define DISIZE 512 /* on-disk inode size (in byte) */
123 #define INOSPERIAG 4096 /* number of disk inodes per iag */
124 #define L2INOSPERIAG 12 /* l2 number of disk inodes per iag */
125 #define INOSPEREXT 32 /* number of disk inode per extent */
126 #define L2INOSPEREXT 5 /* l2 number of disk inode per extent */
128 #define INOSPERPAGE 8 /* number of disk inodes per 4K page */
174 * SIZE_OF_SUPER defines the total amount of space reserved on disk for the
186 * SIZE_OF_MAP_PAGE defines the amount of disk space reserved for each page of
214 * The following macro is used to indicate the number of reserved disk blocks at
H A Djfs_extent.c83 * -ENOSPC - insufficient disk resources.
127 /* allocate the disk blocks for the extent. initially, extBalloc() extAlloc()
128 * will try to allocate disk blocks for the requested size (xlen). extAlloc()
185 * We need to commit the inode to get the page written disk. extAlloc()
213 * -ENOSPC - insufficient disk resources.
231 /* get the extend (partial) page's disk block address and extRealloc()
270 * and the allocated disk space is for more than one page. if this extRealloc()
276 * disk allocation occurred as an inplace extension. the second extRealloc()
294 /* if we were able to extend the disk allocation in place, extRealloc()
296 * new disk location. extRealloc()
422 * -ENOSPC - insufficient disk resources.
444 * FUNCTION: allocate disk space for a file page that represents
454 * -ENOSPC - insufficient disk resources.
480 * FUNCTION: allocate disk blocks to form an extent.
482 * initially, we will try to allocate disk blocks for the
494 * hint - disk block number to be used as an allocation hint.
506 * -ENOSPC - insufficient disk resources.
576 * will try to allocate disk blocks for the requested size
599 * -ENOSPC - insufficient disk resources.
H A Djfs_umount.c108 * Make sure all metadata makes it to disk before we mark jfs_umount()
115 * home blocks on disk (and their in-memory buffer pages are jfs_umount()
152 * Make sure all metadata makes it to disk jfs_umount_rw()
161 * disk. jfs_umount_rw()
H A Djfs_imap.c97 * brought in from disk and placed in virtual memory.
124 /* read the on-disk inode map control structure. */ diMount()
134 /* copy the on-disk version to the in-memory version. */ diMount()
180 * FUNCTION: write to disk the incore inode map control structures for
196 * update the on-disk inode map control structure diUnmount()
229 /* read the on-disk inode map control structure */ diSync()
238 /* copy the in-memory version to the on-disk version */ diSync()
274 * FUNCTION: initialize an incore inode from disk.
277 * specify the disk inode number corresponding to the
288 * for regular inodes, the iag describing the disk inode
289 * is read from disk to determine the inode extent address
290 * for the disk inode. with the inode extent address in
291 * hand, the page of the extent that contains the disk
292 * inode is read and the disk inode is copied to the
296 * ip - pointer to incore inode to be initialized from disk.
339 /* determine inode extent that holds the disk inode */ diRead()
349 /* get disk block number of the page within the inode extent diRead()
350 * that holds the disk inode. diRead()
377 /* read the page of disk inode */ diRead()
384 /* locate the disk inode requested */ diRead()
394 /* copy the disk inode to the in-memory inode */ diRead()
410 * FUNCTION: initialize a 'special' inode from disk.
457 /* read the page of fixed disk inode (AIT) in raw mode */ diReadSpecial()
465 /* get the pointer to the disk inode of interest */ diReadSpecial()
469 /* copy on-disk inode to in-memory inode */ diReadSpecial()
508 * FUNCTION: Write the special inode to disk
534 /* read the page of fixed disk inode (AIT) in raw mode */ diWriteSpecial()
542 /* get the pointer to the disk inode of interest */ diWriteSpecial()
546 /* copy on-disk inode to in-memory inode */ diWriteSpecial()
578 * FUNCTION: write the on-disk inode portion of the in-memory inode
579 * to its corresponding on-disk inode.
582 * specify the disk inode number corresponding to the
585 * the inode contains the inode extent address for the disk
587 * page of the extent that contains the disk inode is
588 * read and the disk inode portion of the incore inode
589 * is copied to the disk inode.
633 * read the page of disk inode containing the specified inode: diWrite()
655 /* read the page of disk inode */ diWrite()
661 /* get the pointer to the disk inode */ diWrite()
668 * acquire transaction lock on the on-disk inode; diWrite()
677 * copy btree root from in-memory inode to on-disk inode diWrite()
715 /* reset on-disk (metadata page) xtree XAD_NEW bit */ diWrite()
751 /* reset on-disk (metadata page) xtree XAD_NEW bit */ diWrite()
780 * copy inline symlink from in-memory inode to on-disk inode diWrite()
790 * copy inline data from in-memory inode to on-disk inode: diWrite()
816 /* release the buffer holding the updated on-disk inode. diWrite()
837 * the extent. in this case all the disk resource backing
1328 * FUNCTION: allocate a disk inode from the inode working map
1333 * dir - 'true' if the new disk inode is for a directory.
1338 * -ENOSPC - insufficient disk resources.
1370 * the same iag containing the parent disk inode: diAlloc()
1371 * try to allocate the new disk inode close to the parent disk diAlloc()
1372 * inode, using parent disk inode number + 1 as the allocation diAlloc()
1374 * moving backward on the disk.) compute the hint within the diAlloc()
1416 * has less than 32 free disk inodes and the iag has free extents. diAlloc()
1563 /* if there is no disk space for a diAlloc()
1565 * disk inode from somewhere else. diAlloc()
1622 * FUNCTION: allocate a disk inode from the allocation group.
1638 * dir - 'true' if the new disk inode is for a directory.
1640 * with the disk inode number allocated, its extent address
1645 * -ENOSPC - insufficient disk resources.
1653 /* get the number of free and the number of backed disk diAllocAG()
1698 * FUNCTION: allocate a disk inode from any other allocation group.
1708 * dir - 'true' if the new disk inode is for a directory.
1710 * with the disk inode number allocated, its extent address
1715 * -ENOSPC - insufficient disk resources.
1752 /* no free disk inodes. diAllocAny()
1761 * FUNCTION: allocate a disk inode from the allocation group's free
1775 * with the disk inode number allocated, its extent address
1780 * -ENOSPC - insufficient disk resources.
1899 * with the disk inode number allocated, its extent address
1904 * -ENOSPC - insufficient disk resources.
2021 * -ENOSPC - insufficient disk resources.
2134 * disk resources are allocated for the new extent of inodes
2167 * -ENOSPC - insufficient disk resources.
2265 /* allocate disk space for the inode extent. diNewExt()
2285 /* get a buffer for this page of disk inodes. diNewExt()
2434 * -ENOSPC - insufficient disk resources.
3040 * FUNCTION: Copies inode info from disk inode to in-memory inode
3128 * FUNCTION: Copies inode info from in-memory inode to disk inode
H A Djfs_extent.h21 /* get block allocation allocation hint as location of disk inode */
/linux-4.4.14/drivers/leds/trigger/
H A Dledtrig-ide-disk.c33 led_trigger_register_simple("ide-disk", &ledtrig_ide); ledtrig_ide_init()
H A Dledtrig-camera.c4 * based on ledtrig-ide-disk.c
/linux-4.4.14/fs/ext4/
H A Dxattr.h4 On-disk format of extended attributes for the ext4 filesystem.
31 __le32 h_blocks; /* number of disk blocks used */
45 __le16 e_value_offs; /* offset in disk block of value */
46 __le32 e_value_block; /* disk block attribute is stored on (n/i) */
H A Dtruncate.h30 * i_blocks is corrupt: we've seen disk corruptions in the past ext4_blocks_for_truncate()
/linux-4.4.14/fs/adfs/
H A Ddir_fplus.h10 * Structures of directories on the F+ format disk
H A Ddir_f.h10 * Structures of directories on the F format disk
H A Dmap.c27 * The physical disk space used by a fragment is taken from the start of
34 * from any zone on the disk.
41 * Objects stored on the disk are allocated object ids (we use these as
257 * disk. The other fragments start at zone (frag / ids_per_zone) adfs_map_lookup()
/linux-4.4.14/fs/ext2/
H A Dxattr.h4 On-disk format of extended attributes for the ext2 filesystem.
29 __le32 h_blocks; /* number of disk blocks used */
37 __le16 e_value_offs; /* offset in disk block of value */
38 __le32 e_value_block; /* disk block attribute is stored on (n/i) */
/linux-4.4.14/arch/ia64/hp/sim/
H A Dsimscsi.c80 * used to setup a new base for disk images
81 * to use /foo/bar/disk[a-z] as disk images
82 * you have to specify simscsi=/foo/bar/disk on the command line
177 * direct way of determining the disk size, so we do a binary simscsi_get_disk_size()
178 * search, assuming a maximum disk size of 128GB. simscsi_get_disk_size()
232 /* disk doesn't exist... */ simscsi_queuecommand_lck()
236 buf[0] = 0; /* magnetic disk */ simscsi_queuecommand_lck()
299 /* sd.c uses this to determine whether disk does write-caching. */ simscsi_queuecommand_lck()
/linux-4.4.14/drivers/s390/block/
H A Dxpram.c2 * Xpram.c -- the S/390 expanded memory RAM-disk
25 * generic hard disk support to replace ad-hoc partitioning
368 struct gendisk *disk = xpram_disks[i]; xpram_setup_blkdev() local
373 disk->major = XPRAM_MAJOR; xpram_setup_blkdev()
374 disk->first_minor = i; xpram_setup_blkdev()
375 disk->fops = &xpram_devops; xpram_setup_blkdev()
376 disk->private_data = &xpram_devices[i]; xpram_setup_blkdev()
377 disk->queue = xpram_queues[i]; xpram_setup_blkdev()
378 sprintf(disk->disk_name, "slram%d", i); xpram_setup_blkdev()
379 set_capacity(disk, xpram_sizes[i] << 1); xpram_setup_blkdev()
380 add_disk(disk); xpram_setup_blkdev()
/linux-4.4.14/arch/um/drivers/
H A Dubd_kern.c90 static void ubd_release(struct gendisk *disk, fmode_t mode);
195 seq_puts(m, "disk\n"); fake_ide_media_proc_show()
417 " an 's' will cause data to be written to disk on the host immediately.\n"
808 struct gendisk *disk; ubd_disk_register() local
810 disk = alloc_disk(1 << UBD_SHIFT); ubd_disk_register()
811 if(disk == NULL) ubd_disk_register()
814 disk->major = major; ubd_disk_register()
815 disk->first_minor = unit << UBD_SHIFT; ubd_disk_register()
816 disk->fops = &ubd_blops; ubd_disk_register()
817 set_capacity(disk, size / 512); ubd_disk_register()
819 sprintf(disk->disk_name, "ubd%c", 'a' + unit); ubd_disk_register()
821 sprintf(disk->disk_name, "ubd_fake%d", unit); ubd_disk_register()
830 disk->driverfs_dev = &ubd_devs[unit].pdev.dev; ubd_disk_register()
833 disk->private_data = &ubd_devs[unit]; ubd_disk_register()
834 disk->queue = ubd_devs[unit].queue; ubd_disk_register()
835 add_disk(disk); ubd_disk_register()
837 *disk_out = disk; ubd_disk_register()
979 struct gendisk *disk = ubd_gendisk[n]; ubd_remove() local
990 /* you cannot remove a open disk */ ubd_remove()
996 if(disk != NULL){ ubd_remove()
997 del_gendisk(disk); ubd_remove()
998 put_disk(disk); ubd_remove()
1115 struct gendisk *disk = bdev->bd_disk; ubd_open() local
1116 struct ubd *ubd_dev = disk->private_data; ubd_open()
1124 disk->disk_name, ubd_dev->file, -err); ubd_open()
1129 set_disk_ro(disk, !ubd_dev->openflags.w); ubd_open()
1142 static void ubd_release(struct gendisk *disk, fmode_t mode) ubd_release() argument
1144 struct ubd *ubd_dev = disk->private_data; ubd_release()
1217 struct gendisk *disk = req->rq_disk; prepare_request() local
1218 struct ubd *ubd_dev = disk->private_data; prepare_request()
1246 struct gendisk *disk = req->rq_disk; prepare_flush_request() local
1247 struct ubd *ubd_dev = disk->private_data; prepare_flush_request()
/linux-4.4.14/fs/befs/
H A Dio.c20 * Converts befs notion of disk addr to a disk offset and uses
/linux-4.4.14/fs/ocfs2/
H A Docfs2_fs.h6 * On-disk structures for OCFS2.
41 * blocksize of 2K, it is 4096 bytes into disk.
462 * On disk extent record for OCFS2
463 * It describes a range of clusters on disk.
479 __le64 e_blkno; /* Physical disk offset, in blocks */
486 __le64 c_blkno; /* Physical disk offset (blocks) of 1st group */
495 * On disk extent list for OCFS2 (node in the tree). Note that this
517 * On disk allocation chain list for OCFS2. Note that this is
531 * On disk deallocation log for OCFS2. Note that this is
543 * On disk extent block (indirect block) for OCFS2
554 __le64 h_blkno; /* Offset on disk, in blocks */
559 __le64 h_next_leaf_blk; /* Offset on disk, in blocks,
563 /* Actual on-disk size is one block */
567 * On disk slot map for OCFS2. This defines the contents of the "slot_map"
574 * Actual on-disk size is one block. OCFS2_MAX_SLOTS is 255,
620 * On disk superblock for OCFS2
700 * On disk inode for OCFS2
722 /*50*/ __le64 i_blkno; /* Offset on disk, in blocks */
774 /* Actual on-disk size is one block */
778 * On-disk directory entry structure for OCFS2
788 /* Actual on-disk length specified by rec_len */
812 /*20*/ __le64 db_blkno; /* Offset on disk, in blocks */
863 __le64 dr_blkno; /* Offset on disk, in blocks */
901 __le64 dl_blkno; /* Offset on disk, in blocks */
916 * On disk allocator group structure for OCFS2
933 __le64 bg_blkno; /* Offset on disk, in blocks */
958 /* Actual on-disk size is one block */
989 /*10*/ __le64 rf_blkno; /* Offset on disk, in blocks */
1016 /* Actual on-disk size is one block */
1020 * On disk extended attribute structure for OCFS2.
1041 * On disk structure for xattr header.
1068 * On disk structure for xattr value root.
1081 * On disk structure for xattr tree root.
1104 * On disk structure for xattr block.
1113 /*10*/ __le64 xb_blkno; /* Offset on disk, in blocks */
1159 * On disk structures for global quota file
1208 /*20*/ __le64 dqb_bhardlimit; /* absolute limit on disk space */
1209 __le64 dqb_bsoftlimit; /* preferred limit on disk space */
1211 __le64 dqb_btime; /* time limit for excessive disk use */
1218 * On-disk structures for local quota file
/linux-4.4.14/drivers/sbus/char/
H A Djsflash.c562 struct gendisk *disk = alloc_disk(1); jsfd_init() local
563 if (!disk) jsfd_init()
565 jsfd_disk[i] = disk; jsfd_init()
581 struct gendisk *disk = jsfd_disk[i]; jsfd_init() local
586 disk->major = JSFD_MAJOR; jsfd_init()
587 disk->first_minor = i; jsfd_init()
588 sprintf(disk->disk_name, "jsfd%d", i); jsfd_init()
589 disk->fops = &jsfd_fops; jsfd_init()
590 set_capacity(disk, jdp->dsize >> 9); jsfd_init()
591 disk->private_data = jdp; jsfd_init()
592 disk->queue = jsf_queue; jsfd_init()
593 add_disk(disk); jsfd_init()
594 set_disk_ro(disk, 1); jsfd_init()
/linux-4.4.14/fs/xfs/libxfs/
H A Dxfs_inode_buf.c67 * from disk. We don't report the error otherwise to avoid warnings during log
152 * This routine is called to map an inode to the buffer containing the on-disk
154 * on-disk inode in the bpp parameter, and in the dipp parameter it returns a
155 * pointer to the on-disk inode within that buffer.
335 * Read the disk inode attributes into the in-core inode structure.
341 * disk. Further, if we are using version 4 superblocks (i.e. v1/v2 inode
343 * initialised from the current on-disk value and hence we must also read the
344 * inode off disk.
368 /* initialise the on-disk inode core */ xfs_iread()
382 * Get pointers to the on-disk inode and the buffer containing it. xfs_iread()
399 * If the on-disk inode is already linked to a directory xfs_iread()
466 * Use xfs_trans_brelse() to release the buffer containing the on-disk xfs_iread()
472 * because inodes on disk are never destroyed and we will be locking the xfs_iread()
H A Dxfs_format.h24 * This header file defines all the on-disk format definitions for
63 * The size of a single extended attribute on disk is limited by
168 * the disk buffer.
193 * Superblock - on disk version. Must match the in core version above.
685 /* disk block (xfs_daddr_t) in the AG */
753 /* disk block (xfs_daddr_t) in the AG */
821 * On-disk inode structure.
890 * Size of the core inode on disk. Version 1 and 2 inodes have
1108 * This is the main portion of the on-disk representation of quota
1111 * to construct the on disk structure.
1118 __be64 d_blk_hardlimit;/* absolute limit on disk blks */
1119 __be64 d_blk_softlimit;/* preferred limit on disk blks */
1122 __be64 d_bcount; /* disk blocks owned by the user */
1126 __be32 d_btimer; /* similar to above; for disk blocks */
1128 __be16 d_bwarns; /* warnings issued wrt disk blocks */
1131 __be64 d_rtb_softlimit;/* preferred limit on RT disk blks */
1133 __be32 d_rtbtimer; /* similar to above; for RT disk blocks */
1134 __be16 d_rtbwarns; /* warnings issued wrt RT disk blocks */
1139 * This is what goes on disk. This is separated from the xfs_disk_dquot because
1189 * There are two on-disk btrees, one sorted by blockno and one sorted
1249 * The on-disk inode record structure has two formats. The original "full"
1325 * Bmap root header, on-disk form only.
1420 * This is a combination of the actual format used on disk for short and long
1473 * On-disk XFS access control list structure.
1488 * The number of ACL entries allowed is defined by the on-disk format.
1506 /* On-disk XFS extended attribute names */
H A Dxfs_alloc_btree.h22 * Freespace on-disk structures
H A Dxfs_cksum.h33 * so that it is consistent on disk.
H A Dxfs_ialloc.h58 * Allocate an inode on disk.
74 * on-disk data structures are updated. The inode itself is not read
89 * Free disk inode. Carefully avoids touching the incore inode, all
91 * The on-disk inode is not changed by this operation, only the
H A Dxfs_ialloc_btree.h22 * Inode map on-disk structures
H A Dxfs_sb.c311 * values are not written back to disk unless any quota information xfs_sb_quota_from_disk()
312 * is written to the disk. Even in that case, sb_pquotino field is xfs_sb_quota_from_disk()
313 * not written to disk unless the superblock supports pquotino. xfs_sb_quota_from_disk()
324 * with an older version of on-disk superblock. xfs_sb_quota_from_disk()
339 * In older version of superblock, on-disk superblock only xfs_sb_quota_from_disk()
342 * point of time. So, if PQUOTA is set in disk superblock, xfs_sb_quota_from_disk()
407 /* crc is only used on disk, not in memory; just init to 0 here. */ __xfs_sb_from_disk()
413 * sb_meta_uuid is only on disk if it differs from sb_uuid and the __xfs_sb_from_disk()
420 /* Convert on-disk flags to in-memory flags? */ __xfs_sb_from_disk()
450 * flags, whereas the on-disk version does. So, convert incore xfs_sb_quota_to_disk()
451 * XFS_{PG}QUOTA_* flags to on-disk XFS_OQUOTA_* flags. xfs_sb_quota_to_disk()
468 * disk. If neither are active, we should NULL the inode. xfs_sb_quota_to_disk()
575 * Use call variant which doesn't convert quota flags from disk xfs_sb_verify()
576 * format, because xfs_mount_validate_sb checks the on-disk flags. xfs_sb_verify()
610 * superblock from disk order just to check the version number xfs_sb_read_verify()
825 * Sync the superblock to disk.
/linux-4.4.14/fs/squashfs/
H A Dfragment.c29 * location on disk and compressed size using a fragment lookup table.
45 * Look-up fragment using the fragment index table. Return the on disk
71 * Read the uncompressed fragment lookup table indexes off disk into memory
H A Dxattr_id.c26 * into the on disk location of the xattr data.
64 * Read uncompressed xattr id lookup table indexes from disk into memory
H A Dexport.c28 * filehandles to an inode location on disk. This table is stored compressed
33 * The inode lookup table is used only by the export code, inode disk
121 * Read uncompressed inode lookup table indexes off disk into memory
/linux-4.4.14/drivers/cdrom/
H A Dgdrom.c95 {UNIT_ATTENTION, "Device needs attention - disk may have been changed"},
117 struct gendisk *disk; member in struct:gdrom_unit
243 * Prepare disk command
376 /* spin up the disk */ gdrom_open()
506 static void gdrom_bdops_release(struct gendisk *disk, fmode_t mode) gdrom_bdops_release() argument
513 static unsigned int gdrom_bdops_check_events(struct gendisk *disk, gdrom_bdops_check_events() argument
749 gd.disk->major = gdrom_major; probe_gdrom_setupdisk()
750 gd.disk->first_minor = 1; probe_gdrom_setupdisk()
751 gd.disk->minors = 1; probe_gdrom_setupdisk()
752 strcpy(gd.disk->disk_name, GDROM_DEV_NAME); probe_gdrom_setupdisk()
762 gd.disk->queue = gd.gdrom_rq; probe_gdrom_setupqueue()
794 gd.disk = alloc_disk(1); probe_gdrom()
795 if (!gd.disk) { probe_gdrom()
804 gd.disk->fops = &gdrom_bdops; probe_gdrom()
820 add_disk(gd.disk); probe_gdrom()
830 del_gendisk(gd.disk); probe_gdrom()
846 del_gendisk(gd.disk); remove_gdrom()
/linux-4.4.14/drivers/leds/
H A Dleds-rb532.c37 .default_trigger = "nand-disk",
H A Dleds-hp6xx.c53 .default_trigger = "ide-disk",
H A Dleds-locomo.c54 .default_trigger = "nand-disk",
/linux-4.4.14/fs/bfs/
H A Dbfs.h27 unsigned long i_dsk_ino; /* inode number from the disk, can be 0 */
/linux-4.4.14/fs/ocfs2/cluster/
H A Docfs2_heartbeat.h6 * On-disk structures for ocfs2_heartbeat
/linux-4.4.14/arch/parisc/include/asm/
H A Dled.h15 #define LED_DISK_IO LED2 /* for disk activity */
/linux-4.4.14/arch/arm64/include/uapi/asm/
H A Dfcntl.h24 #define O_DIRECT 0200000 /* direct disk access hint - currently ignored */
/linux-4.4.14/drivers/mtd/
H A Dmtd_blkdevs.c46 dev->disk->private_data = NULL; blktrans_dev_release()
48 put_disk(dev->disk); blktrans_dev_release()
53 static struct mtd_blktrans_dev *blktrans_dev_get(struct gendisk *disk) blktrans_dev_get() argument
58 dev = disk->private_data; blktrans_dev_get()
237 static void blktrans_release(struct gendisk *disk, fmode_t mode) blktrans_release() argument
239 struct mtd_blktrans_dev *dev = blktrans_dev_get(disk); blktrans_release()
359 * minor numbers and that the disk naming code below can cope add_mtd_blktrans_dev()
383 new->disk = gd; add_mtd_blktrans_dev()
450 put_disk(new->disk); add_mtd_blktrans_dev()
467 sysfs_remove_group(&disk_to_dev(old->disk)->kobj, del_mtd_blktrans_dev()
471 del_gendisk(old->disk); del_mtd_blktrans_dev()
/linux-4.4.14/include/uapi/linux/raid/
H A Dmd_p.h77 #define MD_DISK_FAULTY 0 /* disk is faulty / operational */
78 #define MD_DISK_ACTIVE 1 /* disk is running or spare disk */
79 #define MD_DISK_SYNC 2 /* disk is in sync with the raid set */
80 #define MD_DISK_REMOVED 3 /* disk is in sync with the raid set */
81 #define MD_DISK_CLUSTER_ADD 4 /* Initiate a disk add across the cluster
84 #define MD_DISK_CANDIDATE 5 /* disk is added as spare (local) until confirmed
88 #define MD_DISK_WRITEMOSTLY 9 /* disk is "write-mostly" is RAID1 config.
92 #define MD_DISK_JOURNAL 18 /* disk is used as the write journal in RAID-5/6 */
97 #define MD_DISK_ROLE_MAX 0xff00 /* max value of regular disk role */
142 __u32 size; /* 8 Apparent size of each individual disk */
/linux-4.4.14/arch/mips/fw/arc/
H A Dtree.c77 "dti adapter", "multi-func adapter", "disk controller",
81 "audio controller", "misc controller", "disk peripheral",
/linux-4.4.14/arch/sparc/include/asm/
H A Dauxio_32.h19 #define AUXIO_FLPY_DCHG 0x10 /* A disk change occurred. Read only. */
28 #define AUXIO_FLPY_EJCT 0x02 /* Eject floppy disk. Write only. */
/linux-4.4.14/drivers/memstick/core/
H A Dmspro_block.c142 struct gendisk *disk; member in struct:mspro_block_data
187 struct gendisk *disk = bdev->bd_disk; mspro_block_bd_open() local
188 struct mspro_block_data *msb = disk->private_data; mspro_block_bd_open()
207 static void mspro_block_disk_release(struct gendisk *disk) mspro_block_disk_release() argument
209 struct mspro_block_data *msb = disk->private_data; mspro_block_disk_release()
210 int disk_id = MINOR(disk_devt(disk)) >> MSPRO_BLOCK_PART_SHIFT; mspro_block_disk_release()
220 disk->private_data = NULL; mspro_block_disk_release()
222 put_disk(disk); mspro_block_disk_release()
229 static void mspro_block_bd_release(struct gendisk *disk, fmode_t mode) mspro_block_bd_release() argument
231 mspro_block_disk_release(disk); mspro_block_bd_release()
1220 msb->disk = alloc_disk(1 << MSPRO_BLOCK_PART_SHIFT); mspro_block_init_disk()
1221 if (!msb->disk) { mspro_block_init_disk()
1241 msb->disk->major = major; mspro_block_init_disk()
1242 msb->disk->first_minor = disk_id << MSPRO_BLOCK_PART_SHIFT; mspro_block_init_disk()
1243 msb->disk->fops = &ms_block_bdops; mspro_block_init_disk()
1245 msb->disk->private_data = msb; mspro_block_init_disk()
1246 msb->disk->queue = msb->queue; mspro_block_init_disk()
1247 msb->disk->driverfs_dev = &card->dev; mspro_block_init_disk()
1249 sprintf(msb->disk->disk_name, "mspblk%d", disk_id); mspro_block_init_disk()
1256 set_capacity(msb->disk, capacity); mspro_block_init_disk()
1259 add_disk(msb->disk); mspro_block_init_disk()
1264 put_disk(msb->disk); mspro_block_init_disk()
1344 del_gendisk(msb->disk); mspro_block_remove()
1356 mspro_block_disk_release(msb->disk); mspro_block_remove()
H A Dms_block.c1678 * cover whole disk.
1940 static DEFINE_IDR(msb_disk_idr); /*set of used disk numbers */
1945 struct gendisk *disk = bdev->bd_disk; msb_bd_open() local
1946 struct msb_data *msb = disk->private_data; msb_bd_open()
1968 static int msb_disk_release(struct gendisk *disk) msb_disk_release() argument
1970 struct msb_data *msb = disk->private_data; msb_disk_release()
1980 disk->private_data = NULL; msb_disk_release()
1982 put_disk(disk); msb_disk_release()
1990 static void msb_bd_release(struct gendisk *disk, fmode_t mode) msb_bd_release() argument
1992 msb_disk_release(disk); msb_bd_release()
2123 msb->disk = alloc_disk(0); msb_init_disk()
2124 if (!msb->disk) { msb_init_disk()
2145 sprintf(msb->disk->disk_name, "msblk%d", msb->disk_id); msb_init_disk()
2146 msb->disk->fops = &msb_bdops; msb_init_disk()
2147 msb->disk->private_data = msb; msb_init_disk()
2148 msb->disk->queue = msb->queue; msb_init_disk()
2149 msb->disk->driverfs_dev = &card->dev; msb_init_disk()
2150 msb->disk->flags |= GENHD_FL_EXT_DEVT; msb_init_disk()
2154 set_capacity(msb->disk, capacity); msb_init_disk()
2155 dbg("Set total disk size to %lu sectors", capacity); msb_init_disk()
2163 set_disk_ro(msb->disk, 1); msb_init_disk()
2166 add_disk(msb->disk); msb_init_disk()
2171 put_disk(msb->disk); msb_init_disk()
2217 dbg("Removing the disk device"); msb_remove()
2225 /* Remove the disk */ msb_remove()
2226 del_gendisk(msb->disk); msb_remove()
2234 msb_disk_release(msb->disk); msb_remove()
/linux-4.4.14/fs/exofs/
H A Dcommon.h51 #define EXOFS_SUPER_ID 0x10000 /* object ID for on-disk superblock */
52 #define EXOFS_DEVTABLE_ID 0x10001 /* object ID for on-disk device table */
89 * This is where the in-memory superblock is stored on disk.
167 * the in-memory inode is stored on disk.
197 * The on-disk directory entry
226 * The on-disk (optional) layout structure.
/linux-4.4.14/crypto/async_tx/
H A Draid6test.c184 pr("testing the %d-disk case...\n", disks); test()
210 /* the 4-disk and 5-disk cases are special for the recovery code */ raid6_test()
215 /* the 11 and 12 disk cases are special for ioatdma (p-disabled raid6_test()
223 /* the 24 disk case is special for ioatdma as it is the boudary point raid6_test()
/linux-4.4.14/fs/nilfs2/
H A Difile.c48 * nilfs_ifile_create_inode - create a new disk inode
51 * @out_bh: buffer_head contains newly allocated disk inode
55 * that contains newly allocated disk inode structure is stored in the
95 * nilfs_ifile_delete_inode - delete a disk inode
189 * @raw_inode: on-disk ifile inode
/linux-4.4.14/fs/freevxfs/
H A Dvxfs_olt.h81 * VxFS common OLT entry (on disk).
89 * VxFS free OLT entry (on disk).
97 * VxFS initial-inode list (on disk).
/linux-4.4.14/fs/btrfs/
H A Dbtrfs_inode.h64 /* key used to find this inode on disk. This is used by the code
76 /* the extent_tree has caches of all the extent mappings to disk */
97 * to write all the delalloc pages to disk, and this list is used
145 * the size of the file stored in the metadata on disk. data=ordered
146 * means the in-memory i_size might be larger than the size on disk
173 /* flags field from the on disk inode */
H A Dtree-defrag.c21 #include "disk-io.h"
29 * better reflect disk order
H A Dorphan.c20 #include "disk-io.h"
H A Ddev-replace.c31 #include "disk-io.h"
192 * disk.
330 /* the disk copy procedure reuses the scrub code */ btrfs_dev_replace_start()
380 src_device->missing ? "<missing disk>" : btrfs_dev_replace_start()
406 /* force writing the updated state information to disk */ btrfs_dev_replace_start()
417 /* the disk copy procedure reuses the scrub code */ btrfs_dev_replace_start()
527 src_device->missing ? "<missing disk>" : btrfs_dev_replace_finishing()
544 src_device->missing ? "<missing disk>" : btrfs_dev_replace_finishing()
813 dev_replace->srcdev->missing ? "<missing disk>" : btrfs_dev_replace_kthread()
818 "<missing target disk>", btrfs_dev_replace_kthread()
H A Dsysfs.c30 #include "disk-io.h"
643 struct hd_struct *disk; btrfs_sysfs_rm_device_link() local
650 disk = one_device->bdev->bd_part; btrfs_sysfs_rm_device_link()
651 disk_kobj = &part_to_dev(disk)->kobj; btrfs_sysfs_rm_device_link()
664 disk = one_device->bdev->bd_part; btrfs_sysfs_rm_device_link()
665 disk_kobj = &part_to_dev(disk)->kobj; btrfs_sysfs_rm_device_link()
693 struct hd_struct *disk; btrfs_sysfs_add_device_link() local
702 disk = dev->bdev->bd_part; btrfs_sysfs_add_device_link()
703 disk_kobj = &part_to_dev(disk)->kobj; btrfs_sysfs_add_device_link()
/linux-4.4.14/fs/f2fs/
H A Dxattr.h9 * On-disk format of extended attributes for the ext2 filesystem.
84 * On-disk structure of f2fs_xattr
/linux-4.4.14/lib/raid6/
H A Dmmx.c46 z0 = disks - 3; /* Highest data disk */ raid6_mmx1_gen_syndrome()
94 z0 = disks - 3; /* Highest data disk */ raid6_mmx2_gen_syndrome()
/linux-4.4.14/fs/efs/
H A Defs.h34 * layout of an extent, in memory and on disk. 8 bytes exactly.
52 * extent based filesystem inode as it appears on disk. The efs inode
/linux-4.4.14/fs/udf/
H A Dudf_sb.h26 #define UDF_FLAG_UID_FORGET 11 /* save -1 for uid to disk */
27 #define UDF_FLAG_UID_IGNORE 12 /* use sb uid instead of on disk uid */
H A Dlowlevel.c40 udf_debug("XA disk: %s, vol_desc_start=%d\n", udf_get_last_session()
/linux-4.4.14/fs/xfs/
H A Dxfs_dquot.c451 * Maps a dquot to the buffer containing its on-disk version.
452 * This returns a ptr to the buffer containing the on-disk dquot
453 * in the bpp param, and a ptr to the on-disk dquot within that buffer
556 * If XFS_QMOPT_DQALLOC is set, allocate a dquot on disk if it needed.
621 * get a pointer to the on-disk dquot and the buffer containing it xfs_qm_dqread()
628 * or if the dquot didn't exist on disk and we ask to xfs_qm_dqread()
635 /* copy everything from disk dquot to the incore dquot */ xfs_qm_dqread()
759 * a (potential) disk read. Also we don't want to deal with the lock xfs_qm_dqget()
880 * flushed to disk. It is responsible for removing the dquot logitem
919 * Write a modified dquot to disk.
921 * The flush lock will not be unlocked until the dquot reaches the disk,
948 * to disk, because the log record didn't make it to disk. xfs_qm_dqflush()
964 * Get the buffer containing the on-disk dquot xfs_qm_dqflush()
1001 * copy the lsn into the on-disk dquot now while we have the in memory xfs_qm_dqflush()
1005 * We also calculate the CRC here so that the on-disk dquot in the xfs_qm_dqflush()
1007 * of a dquot without an up-to-date CRC getting to disk. xfs_qm_dqflush()
1019 * AIL and release the flush lock once the dquot is synced to disk. xfs_qm_dqflush()
/linux-4.4.14/arch/m68k/include/asm/
H A Damigaints.h32 /* floppy disk interrupts */
77 #define IF_DSKSYN 0x1000 /* disk sync interrupt */
/linux-4.4.14/arch/m68k/amiga/
H A Damiints.c59 /* if floppy disk transfer complete, interrupt */ ami_int1()
134 /* if a disk sync interrupt */ ami_int5()
/linux-4.4.14/drivers/mmc/card/
H A Dblock.c99 struct gendisk *disk; member in struct:mmc_blk_data
157 static struct mmc_blk_data *mmc_blk_get(struct gendisk *disk) mmc_blk_get() argument
162 md = disk->private_data; mmc_blk_get()
172 static inline int mmc_get_devidx(struct gendisk *disk) mmc_get_devidx() argument
174 int devmaj = MAJOR(disk_devt(disk)); mmc_get_devidx()
175 int devidx = MINOR(disk_devt(disk)) / perdev_minors; mmc_get_devidx()
178 devidx = disk->first_minor / perdev_minors; mmc_get_devidx()
187 int devidx = mmc_get_devidx(md->disk); mmc_blk_put()
192 put_disk(md->disk); mmc_blk_put()
242 pr_err("%s: Locking boot partition ro until next power on failed: %d\n", md->disk->disk_name, ret); power_ro_lock_store()
250 md->disk->disk_name); power_ro_lock_store()
251 set_disk_ro(md->disk, 1); power_ro_lock_store()
255 pr_info("%s: Locking boot partition ro until next power on\n", part_md->disk->disk_name); power_ro_lock_store()
256 set_disk_ro(part_md->disk, 1); power_ro_lock_store()
317 static void mmc_blk_release(struct gendisk *disk, fmode_t mode) mmc_blk_release() argument
319 struct mmc_blk_data *md = disk->private_data; mmc_blk_release()
2231 md->disk = alloc_disk(perdev_minors); mmc_blk_alloc_req()
2232 if (md->disk == NULL) { mmc_blk_alloc_req()
2248 md->disk->major = MMC_BLOCK_MAJOR; mmc_blk_alloc_req()
2249 md->disk->first_minor = devidx * perdev_minors; mmc_blk_alloc_req()
2250 md->disk->fops = &mmc_bdops; mmc_blk_alloc_req()
2251 md->disk->private_data = md; mmc_blk_alloc_req()
2252 md->disk->queue = md->queue.queue; mmc_blk_alloc_req()
2253 md->disk->driverfs_dev = parent; mmc_blk_alloc_req()
2254 set_disk_ro(md->disk, md->read_only || default_ro); mmc_blk_alloc_req()
2256 md->disk->flags |= GENHD_FL_NO_PART_SCAN; mmc_blk_alloc_req()
2270 snprintf(md->disk->disk_name, sizeof(md->disk->disk_name), mmc_blk_alloc_req()
2279 set_capacity(md->disk, size); mmc_blk_alloc_req()
2307 put_disk(md->disk); mmc_blk_alloc_req()
2348 part_md = mmc_blk_alloc_req(card, disk_to_dev(md->disk), size, default_ro, mmc_blk_alloc_part()
2355 string_get_size((u64)get_capacity(part_md->disk), 512, STRING_UNITS_2, mmc_blk_alloc_part()
2358 part_md->disk->disk_name, mmc_card_id(card), mmc_blk_alloc_part()
2406 if (md->disk->flags & GENHD_FL_UP) { mmc_blk_remove_req()
2407 device_remove_file(disk_to_dev(md->disk), &md->force_ro); mmc_blk_remove_req()
2410 device_remove_file(disk_to_dev(md->disk), mmc_blk_remove_req()
2413 del_gendisk(md->disk); mmc_blk_remove_req()
2438 add_disk(md->disk); mmc_add_disk()
2444 ret = device_create_file(disk_to_dev(md->disk), &md->force_ro); mmc_add_disk()
2463 ret = device_create_file(disk_to_dev(md->disk), mmc_add_disk()
2471 device_remove_file(disk_to_dev(md->disk), &md->force_ro); mmc_add_disk()
2473 del_gendisk(md->disk); mmc_add_disk()
2575 string_get_size((u64)get_capacity(md->disk), 512, STRING_UNITS_2, mmc_blk_probe()
2578 md->disk->disk_name, mmc_card_id(card), mmc_card_name(card), mmc_blk_probe()
/linux-4.4.14/arch/um/kernel/
H A Duml.lds.S93 we can shorten the on-disk segment size. */
/linux-4.4.14/arch/alpha/include/uapi/asm/
H A Dfcntl.h15 #define O_DIRECT 02000000 /* direct disk access - should check with OSF/1 */
/linux-4.4.14/arch/s390/include/uapi/asm/
H A Dkvm_virtio.h19 /* The device type: console, network, disk etc. Type 0 terminates. */
/linux-4.4.14/arch/sparc/include/uapi/asm/
H A Dfcntl.h18 #define O_DIRECT 0x100000 /* direct disk access hint */
/linux-4.4.14/drivers/nvme/host/
H A Dpci.c543 ts = ns->disk->queue->integrity.tuple_size; nvme_dif_remap()
570 blk_integrity_register(ns->disk, &integrity); nvme_init_integrity()
1975 nvme_nvm_unregister(ns->queue, ns->disk->disk_name); nvme_free_ns()
1978 ns->disk->private_data = NULL; nvme_free_ns()
1982 put_disk(ns->disk); nvme_free_ns()
2002 static void nvme_release(struct gendisk *disk, fmode_t mode) nvme_release() argument
2004 struct nvme_ns *ns = disk->private_data; nvme_release()
2027 static int nvme_revalidate_disk(struct gendisk *disk) nvme_revalidate_disk() argument
2029 struct nvme_ns *ns = disk->private_data; nvme_revalidate_disk()
2047 if (nvme_nvm_register(ns->queue, disk->disk_name)) { nvme_revalidate_disk()
2074 blk_mq_freeze_queue(disk->queue); nvme_revalidate_disk()
2075 if (blk_get_integrity(disk) && (ns->pi_type != pi_type || nvme_revalidate_disk()
2077 bs != queue_logical_block_size(disk->queue) || nvme_revalidate_disk()
2079 blk_integrity_unregister(disk); nvme_revalidate_disk()
2088 !blk_get_integrity(disk)) || nvme_revalidate_disk()
2090 set_capacity(disk, 0); nvme_revalidate_disk()
2092 set_capacity(disk, le64_to_cpup(&id->nsze) << (ns->lba_shift - 9)); nvme_revalidate_disk()
2096 blk_mq_unfreeze_queue(disk->queue); nvme_revalidate_disk()
2249 struct gendisk *disk; nvme_alloc_ns() local
2264 disk = alloc_disk_node(0, node); nvme_alloc_ns()
2265 if (!disk) nvme_alloc_ns()
2270 ns->disk = disk; nvme_alloc_ns()
2271 ns->lba_shift = 9; /* set to a default value for 512 until disk is validated */ nvme_alloc_ns()
2286 disk->major = nvme_major; nvme_alloc_ns()
2287 disk->first_minor = 0; nvme_alloc_ns()
2288 disk->fops = &nvme_fops; nvme_alloc_ns()
2289 disk->private_data = ns; nvme_alloc_ns()
2290 disk->queue = ns->queue; nvme_alloc_ns()
2291 disk->driverfs_dev = dev->device; nvme_alloc_ns()
2292 disk->flags = GENHD_FL_EXT_DEVT; nvme_alloc_ns()
2293 sprintf(disk->disk_name, "nvme%dn%d", dev->instance, nsid); nvme_alloc_ns()
2301 set_capacity(disk, 0); nvme_alloc_ns()
2302 if (nvme_revalidate_disk(ns->disk)) nvme_alloc_ns()
2307 add_disk(ns->disk); nvme_alloc_ns()
2309 struct block_device *bd = bdget_disk(ns->disk, 0); nvme_alloc_ns()
2322 kfree(disk); nvme_alloc_ns()
2554 if (ns->disk->flags & GENHD_FL_UP) nvme_ns_remove()
2555 del_gendisk(ns->disk); nvme_ns_remove()
2572 if (revalidate_disk(ns->disk)) nvme_scan_namespaces()
/linux-4.4.14/fs/hfs/
H A Dmdb.c238 * This updates the MDB on disk.
252 * The HFS MDB and on disk will be updated, by copying the possibly
254 * the disk block buffer.
256 * and the function doesn't return until it is actually on disk.
276 /* write MDB to disk */ hfs_mdb_commit()
/linux-4.4.14/drivers/staging/lustre/lustre/llite/
H A Dlloop.c599 static void lo_release(struct gendisk *disk, fmode_t mode) lo_release() argument
601 struct lloop_device *lo = disk->private_data; lo_release()
817 struct gendisk *disk = disks[i]; lloop_init() local
828 disk->major = lloop_major; lloop_init()
829 disk->first_minor = i; lloop_init()
830 disk->fops = &lo_fops; lloop_init()
831 sprintf(disk->disk_name, "lloop%d", i); lloop_init()
832 disk->private_data = lo; lloop_init()
833 disk->queue = lo->lo_queue; lloop_init()
/linux-4.4.14/fs/ufs/
H A Dufs_fs.h58 * Each disk drive contains some number of filesystems.
81 * UFS1 placed it 8K from the front to leave room for the disk label and
83 * room for the disk label and a bigger bootstrap, and for really piggy
204 * Turn file system block numbers into disk block addresses.
339 * This is the actual superblock, as it is laid out on the disk.
370 __fs32 fs_rps; /* disk revolutions per second */
414 /* this comes from the disk driver partitioning */
481 __fs32 fs_inodefmt; /* format of on-disk inodes */
501 #define UFS_OPTSPACE 1 /* minimize disk fragmentation */
600 * structure of an on-disk inode
673 __fs64 ui_db[UFS_NDADDR]; /* 112: Direct disk blocks. */
674 __fs64 ui_ib[UFS_NINDIR];/* 208: Indirect disk blocks.*/
698 * This structure is used for reading disk structures larger
945 __fs32 fs_inodefmt; /* format of on-disk inodes */

Completed in 6495 milliseconds

123456