Lines Matching +full:suspend +full:- +full:to +full:- +full:disk
3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
8 #include "dm-core.h"
9 #include "dm-rq.h"
10 #include "dm-uevent.h"
30 #include <linux/blk-crypto.h>
31 #include <linux/keyslot-manager.h>
67 * One of these is allocated (on-stack) per original bio.
112 if (!tio->inside_dm_io) in dm_per_bio_data()
113 return (char *)bio - offsetof(struct dm_target_io, clone) - data_size; in dm_per_bio_data()
114 …return (char *)bio - offsetof(struct dm_target_io, clone) - offsetof(struct dm_io, tio) - data_siz… in dm_per_bio_data()
121 if (io->magic == DM_IO_MAGIC) in dm_bio_from_per_bio_data()
123 BUG_ON(io->magic != DM_TIO_MAGIC); in dm_bio_from_per_bio_data()
130 return container_of(bio, struct dm_target_io, clone)->target_bio_nr; in dm_bio_get_target_bio_nr()
134 #define MINOR_ALLOCED ((void *)-1)
137 * Bits for the md->flags field.
163 * For mempools pre-allocation at the table loading time.
177 * Bio-based DM's mempools' reserved IOs set by the user.
232 DM_NUMA_NODE, num_online_nodes() - 1); in dm_get_numa_node()
245 r = -ENOMEM; in local_init()
317 while (i--) in dm_init()
327 while (i--) in dm_exit()
341 return test_bit(DMF_DELETING, &md->flags); in dm_deleting_md()
350 md = bdev->bd_disk->private_data; in dm_blk_open()
354 if (test_bit(DMF_FREEING, &md->flags) || in dm_blk_open()
361 atomic_inc(&md->open_count); in dm_blk_open()
365 return md ? 0 : -ENXIO; in dm_blk_open()
368 static void dm_blk_close(struct gendisk *disk, fmode_t mode) in dm_blk_close() argument
374 md = disk->private_data; in dm_blk_close()
378 if (atomic_dec_and_test(&md->open_count) && in dm_blk_close()
379 (test_bit(DMF_DEFERRED_REMOVE, &md->flags))) in dm_blk_close()
389 return atomic_read(&md->open_count); in dm_open_count()
402 r = -EBUSY; in dm_lock_for_deletion()
404 set_bit(DMF_DEFERRED_REMOVE, &md->flags); in dm_lock_for_deletion()
405 } else if (only_deferred && !test_bit(DMF_DEFERRED_REMOVE, &md->flags)) in dm_lock_for_deletion()
406 r = -EEXIST; in dm_lock_for_deletion()
408 set_bit(DMF_DELETING, &md->flags); in dm_lock_for_deletion()
421 if (test_bit(DMF_DELETING, &md->flags)) in dm_cancel_deferred_remove()
422 r = -EBUSY; in dm_cancel_deferred_remove()
424 clear_bit(DMF_DEFERRED_REMOVE, &md->flags); in dm_cancel_deferred_remove()
438 struct mapped_device *md = bdev->bd_disk->private_data; in dm_blk_getgeo()
447 sector_t sector_diff = args->tgt->begin - args->start; in dm_report_zones_cb()
452 if (zone->start >= args->start + args->tgt->len) in dm_report_zones_cb()
457 * to match its position in the target range. in dm_report_zones_cb()
459 zone->start += sector_diff; in dm_report_zones_cb()
460 if (zone->type != BLK_ZONE_TYPE_CONVENTIONAL) { in dm_report_zones_cb()
461 if (zone->cond == BLK_ZONE_COND_FULL) in dm_report_zones_cb()
462 zone->wp = zone->start + zone->len; in dm_report_zones_cb()
463 else if (zone->cond == BLK_ZONE_COND_EMPTY) in dm_report_zones_cb()
464 zone->wp = zone->start; in dm_report_zones_cb()
466 zone->wp += sector_diff; in dm_report_zones_cb()
469 args->next_sector = zone->start + zone->len; in dm_report_zones_cb()
470 return args->orig_cb(zone, args->zone_idx++, args->orig_data); in dm_report_zones_cb()
474 static int dm_blk_report_zones(struct gendisk *disk, sector_t sector, in dm_blk_report_zones() argument
477 struct mapped_device *md = disk->private_data; in dm_blk_report_zones()
487 return -EAGAIN; in dm_blk_report_zones()
491 ret = -EIO; in dm_blk_report_zones()
499 if (WARN_ON_ONCE(!tgt->type->report_zones)) { in dm_blk_report_zones()
500 ret = -EIO; in dm_blk_report_zones()
505 ret = tgt->type->report_zones(tgt, &args, in dm_blk_report_zones()
506 nr_zones - args.zone_idx); in dm_blk_report_zones()
510 args.next_sector < get_capacity(disk)); in dm_blk_report_zones()
529 r = -ENOTTY; in dm_prepare_ioctl()
539 if (!tgt->type->prepare_ioctl) in dm_prepare_ioctl()
543 return -EAGAIN; in dm_prepare_ioctl()
545 r = tgt->type->prepare_ioctl(tgt, bdev); in dm_prepare_ioctl()
546 if (r == -ENOTCONN && !fatal_signal_pending(current)) { in dm_prepare_ioctl()
563 struct mapped_device *md = bdev->bd_disk->private_data; in dm_blk_ioctl()
577 "%s: sending ioctl %x to DM device without required privilege.", in dm_blk_ioctl()
578 current->comm, cmd); in dm_blk_ioctl()
579 r = -ENOIOCTLCMD; in dm_blk_ioctl()
593 struct dm_io *io = tio->io; in dm_start_time_ns_from_clone()
595 return jiffies_to_nsecs(io->start_time); in dm_start_time_ns_from_clone()
601 struct mapped_device *md = io->md; in start_io_acct()
602 struct bio *bio = io->orig_bio; in start_io_acct()
604 io->start_time = bio_start_io_acct(bio); in start_io_acct()
605 if (unlikely(dm_stats_used(&md->stats))) in start_io_acct()
606 dm_stats_account_io(&md->stats, bio_data_dir(bio), in start_io_acct()
607 bio->bi_iter.bi_sector, bio_sectors(bio), in start_io_acct()
608 false, 0, &io->stats_aux); in start_io_acct()
614 unsigned long duration = jiffies - start_time; in end_io_acct()
616 if (unlikely(dm_stats_used(&md->stats))) in end_io_acct()
617 dm_stats_account_io(&md->stats, bio_data_dir(bio), in end_io_acct()
618 bio->bi_iter.bi_sector, bio_sectors(bio), in end_io_acct()
625 /* nudge anyone waiting on suspend queue */ in end_io_acct()
626 if (unlikely(wq_has_sleeper(&md->wait))) in end_io_acct()
627 wake_up(&md->wait); in end_io_acct()
636 clone = bio_alloc_bioset(GFP_NOIO, 0, &md->io_bs); in alloc_io()
641 tio->inside_dm_io = true; in alloc_io()
642 tio->io = NULL; in alloc_io()
645 io->magic = DM_IO_MAGIC; in alloc_io()
646 io->status = 0; in alloc_io()
647 atomic_set(&io->io_count, 1); in alloc_io()
648 io->orig_bio = bio; in alloc_io()
649 io->md = md; in alloc_io()
650 spin_lock_init(&io->endio_lock); in alloc_io()
659 bio_put(&io->tio.clone); in free_io()
667 if (!ci->io->tio.io) { in alloc_tio()
668 /* the dm_target_io embedded in ci->io is available */ in alloc_tio()
669 tio = &ci->io->tio; in alloc_tio()
671 struct bio *clone = bio_alloc_bioset(gfp_mask, 0, &ci->io->md->bs); in alloc_tio()
676 tio->inside_dm_io = false; in alloc_tio()
679 tio->magic = DM_TIO_MAGIC; in alloc_tio()
680 tio->io = ci->io; in alloc_tio()
681 tio->ti = ti; in alloc_tio()
682 tio->target_bio_nr = target_bio_nr; in alloc_tio()
689 if (tio->inside_dm_io) in free_tio()
691 bio_put(&tio->clone); in free_tio()
695 * Add the bio to the list of deferred io.
701 spin_lock_irqsave(&md->deferred_lock, flags); in queue_io()
702 bio_list_add(&md->deferred, bio); in queue_io()
703 spin_unlock_irqrestore(&md->deferred_lock, flags); in queue_io()
704 queue_work(md->wq, &md->work); in queue_io()
709 * function to access the md->map field, and make sure they call
712 struct dm_table *dm_get_live_table(struct mapped_device *md, int *srcu_idx) __acquires(md->io_barri… in dm_get_live_table()
714 *srcu_idx = srcu_read_lock(&md->io_barrier); in dm_get_live_table()
716 return srcu_dereference(md->map, &md->io_barrier); in dm_get_live_table()
719 void dm_put_live_table(struct mapped_device *md, int srcu_idx) __releases(md->io_barrier) in dm_put_live_table()
721 srcu_read_unlock(&md->io_barrier, srcu_idx); in dm_put_live_table()
726 synchronize_srcu(&md->io_barrier); in dm_sync_table()
731 * A fast alternative to dm_get_live_table/dm_put_live_table.
737 return rcu_dereference(md->map); in dm_get_live_table_fast()
745 static char *_dm_claim_ptr = "I belong to device-mapper";
757 BUG_ON(td->dm_dev.bdev); in open_table_device()
759 bdev = blkdev_get_by_dev(dev, td->dm_dev.mode | FMODE_EXCL, _dm_claim_ptr); in open_table_device()
765 blkdev_put(bdev, td->dm_dev.mode | FMODE_EXCL); in open_table_device()
769 td->dm_dev.bdev = bdev; in open_table_device()
770 td->dm_dev.dax_dev = dax_get_by_host(bdev->bd_disk->disk_name); in open_table_device()
779 if (!td->dm_dev.bdev) in close_table_device()
782 bd_unlink_disk_holder(td->dm_dev.bdev, dm_disk(md)); in close_table_device()
783 blkdev_put(td->dm_dev.bdev, td->dm_dev.mode | FMODE_EXCL); in close_table_device()
784 put_dax(td->dm_dev.dax_dev); in close_table_device()
785 td->dm_dev.bdev = NULL; in close_table_device()
786 td->dm_dev.dax_dev = NULL; in close_table_device()
795 if (td->dm_dev.bdev->bd_dev == dev && td->dm_dev.mode == mode) in find_table_device()
807 mutex_lock(&md->table_devices_lock); in dm_get_table_device()
808 td = find_table_device(&md->table_devices, dev, mode); in dm_get_table_device()
810 td = kmalloc_node(sizeof(*td), GFP_KERNEL, md->numa_node_id); in dm_get_table_device()
812 mutex_unlock(&md->table_devices_lock); in dm_get_table_device()
813 return -ENOMEM; in dm_get_table_device()
816 td->dm_dev.mode = mode; in dm_get_table_device()
817 td->dm_dev.bdev = NULL; in dm_get_table_device()
820 mutex_unlock(&md->table_devices_lock); in dm_get_table_device()
825 format_dev_t(td->dm_dev.name, dev); in dm_get_table_device()
827 refcount_set(&td->count, 1); in dm_get_table_device()
828 list_add(&td->list, &md->table_devices); in dm_get_table_device()
830 refcount_inc(&td->count); in dm_get_table_device()
832 mutex_unlock(&md->table_devices_lock); in dm_get_table_device()
834 *result = &td->dm_dev; in dm_get_table_device()
843 mutex_lock(&md->table_devices_lock); in dm_put_table_device()
844 if (refcount_dec_and_test(&td->count)) { in dm_put_table_device()
846 list_del(&td->list); in dm_put_table_device()
849 mutex_unlock(&md->table_devices_lock); in dm_put_table_device()
861 td->dm_dev.name, refcount_read(&td->count)); in free_table_devices()
871 *geo = md->geometry; in dm_get_geometry()
881 sector_t sz = (sector_t)geo->cylinders * geo->heads * geo->sectors; in dm_set_geometry()
883 if (geo->start > sz) { in dm_set_geometry()
885 return -EINVAL; in dm_set_geometry()
888 md->geometry = *geo; in dm_set_geometry()
895 return test_bit(DMF_NOFLUSH_SUSPENDING, &md->flags); in __noflush_suspending()
907 struct mapped_device *md = io->md; in dec_pending()
911 /* Push-back supersedes any I/O errors */ in dec_pending()
913 spin_lock_irqsave(&io->endio_lock, flags); in dec_pending()
914 if (!(io->status == BLK_STS_DM_REQUEUE && __noflush_suspending(md))) in dec_pending()
915 io->status = error; in dec_pending()
916 spin_unlock_irqrestore(&io->endio_lock, flags); in dec_pending()
919 if (atomic_dec_and_test(&io->io_count)) { in dec_pending()
920 if (io->status == BLK_STS_DM_REQUEUE) { in dec_pending()
924 spin_lock_irqsave(&md->deferred_lock, flags); in dec_pending()
926 /* NOTE early return due to BLK_STS_DM_REQUEUE below */ in dec_pending()
927 bio_list_add_head(&md->deferred, io->orig_bio); in dec_pending()
929 /* noflush suspend was interrupted. */ in dec_pending()
930 io->status = BLK_STS_IOERR; in dec_pending()
931 spin_unlock_irqrestore(&md->deferred_lock, flags); in dec_pending()
934 io_error = io->status; in dec_pending()
935 bio = io->orig_bio; in dec_pending()
936 start_time = io->start_time; in dec_pending()
937 stats_aux = io->stats_aux; in dec_pending()
944 if ((bio->bi_opf & REQ_PREFLUSH) && bio->bi_iter.bi_size) { in dec_pending()
949 bio->bi_opf &= ~REQ_PREFLUSH; in dec_pending()
954 bio->bi_status = io_error; in dec_pending()
965 limits->max_discard_sectors = 0; in disable_discard()
966 blk_queue_flag_clear(QUEUE_FLAG_DISCARD, md->queue); in disable_discard()
974 limits->max_write_same_sectors = 0; in disable_write_same()
982 limits->max_write_zeroes_sectors = 0; in disable_write_zeroes()
987 return unlikely((bio->bi_opf & REQ_SWAP) != 0) && unlikely(ti->limit_swap_bios); in swap_bios_limit()
992 blk_status_t error = bio->bi_status; in clone_endio()
994 struct dm_io *io = tio->io; in clone_endio()
995 struct mapped_device *md = tio->io->md; in clone_endio()
996 dm_endio_fn endio = tio->ti->type->end_io; in clone_endio()
997 struct bio *orig_bio = io->orig_bio; in clone_endio()
1001 !bio->bi_disk->queue->limits.max_discard_sectors) in clone_endio()
1004 !bio->bi_disk->queue->limits.max_write_same_sectors) in clone_endio()
1007 !bio->bi_disk->queue->limits.max_write_zeroes_sectors) in clone_endio()
1012 * For zone-append bios get offset in zone of the written in clone_endio()
1013 * sector and add that to the original bio sector pos. in clone_endio()
1016 sector_t written_sector = bio->bi_iter.bi_sector; in clone_endio()
1017 struct request_queue *q = orig_bio->bi_disk->queue; in clone_endio()
1018 u64 mask = (u64)blk_queue_zone_sectors(q) - 1; in clone_endio()
1020 orig_bio->bi_iter.bi_sector += written_sector & mask; in clone_endio()
1024 int r = endio(tio->ti, bio, &error); in clone_endio()
1040 if (unlikely(swap_bios_limit(tio->ti, bio))) { in clone_endio()
1041 struct mapped_device *md = io->md; in clone_endio()
1042 up(&md->swap_bios_semaphore); in clone_endio()
1050 * Return maximum size of I/O possible at the supplied sector up to the current
1056 return ti->len - target_offset; in max_io_len_target_boundary()
1066 * Does the target need to split IO even further? in max_io_len()
1067 * - varied (per target) IO splitting is a tenet of DM; this in max_io_len()
1070 * ti->max_io_len to override stacked chunk_sectors. in max_io_len()
1072 if (ti->max_io_len) { in max_io_len()
1073 max_len = blk_max_size_offset(ti->table->md->queue, in max_io_len()
1074 target_offset, ti->max_io_len); in max_io_len()
1087 ti->error = "Maximum size of target IO is too large"; in dm_set_target_max_io_len()
1088 return -EINVAL; in dm_set_target_max_io_len()
1091 ti->max_io_len = (uint32_t) len; in dm_set_target_max_io_len()
1099 __acquires(md->io_barrier) in dm_dax_get_live_target()
1121 long len, ret = -EIO; in dm_dax_direct_access()
1128 if (!ti->type->direct_access) in dm_dax_direct_access()
1134 ret = ti->type->direct_access(ti, pgoff, nr_pages, kaddr, pfn); in dm_dax_direct_access()
1175 if (!ti->type->dax_copy_from_iter) { in dm_dax_copy_from_iter()
1179 ret = ti->type->dax_copy_from_iter(ti, pgoff, addr, bytes, i); in dm_dax_copy_from_iter()
1199 if (!ti->type->dax_copy_to_iter) { in dm_dax_copy_to_iter()
1203 ret = ti->type->dax_copy_to_iter(ti, pgoff, addr, bytes, i); in dm_dax_copy_to_iter()
1216 int ret = -EIO; in dm_dax_zero_page_range()
1223 if (WARN_ON(!ti->type->dax_zero_page_range)) { in dm_dax_zero_page_range()
1225 * ->zero_page_range() is mandatory dax operation. If we are in dm_dax_zero_page_range()
1230 ret = ti->type->dax_zero_page_range(ti, pgoff, nr_pages); in dm_dax_zero_page_range()
1242 * dm_accept_partial_bio informs the dm that the target only wants to process
1247 * +--------------------+---------------+-------+
1249 * +--------------------+---------------+-------+
1251 * <-------------- *tio->len_ptr --------------->
1252 * <------- bi_size ------->
1253 * <-- n_sectors -->
1257 * Region 2 is the remaining bio size that the target wants to process.
1258 * (it may be empty if region 1 is non-empty, although there is no reason
1259 * to make it empty)
1260 * The target requires that region 3 is to be sent in the next bio.
1262 * If the target wants to receive multiple copies of the bio (via num_*bios, etc),
1269 unsigned bi_size = bio->bi_iter.bi_size >> SECTOR_SHIFT; in dm_accept_partial_bio()
1271 BUG_ON(bio->bi_opf & REQ_PREFLUSH); in dm_accept_partial_bio()
1274 BUG_ON(bi_size > *tio->len_ptr); in dm_accept_partial_bio()
1277 *tio->len_ptr -= bi_size - n_sectors; in dm_accept_partial_bio()
1278 bio->bi_iter.bi_size = n_sectors << SECTOR_SHIFT; in dm_accept_partial_bio()
1284 mutex_lock(&md->swap_bios_lock); in __set_swap_bios_limit()
1285 while (latch < md->swap_bios) { in __set_swap_bios_limit()
1287 down(&md->swap_bios_semaphore); in __set_swap_bios_limit()
1288 md->swap_bios--; in __set_swap_bios_limit()
1290 while (latch > md->swap_bios) { in __set_swap_bios_limit()
1292 up(&md->swap_bios_semaphore); in __set_swap_bios_limit()
1293 md->swap_bios++; in __set_swap_bios_limit()
1295 mutex_unlock(&md->swap_bios_lock); in __set_swap_bios_limit()
1302 struct bio *clone = &tio->clone; in __map_bio()
1303 struct dm_io *io = tio->io; in __map_bio()
1304 struct dm_target *ti = tio->ti; in __map_bio()
1307 clone->bi_end_io = clone_endio; in __map_bio()
1310 * Map the clone. If r == 0 we don't need to do in __map_bio()
1314 atomic_inc(&io->io_count); in __map_bio()
1315 sector = clone->bi_iter.bi_sector; in __map_bio()
1318 struct mapped_device *md = io->md; in __map_bio()
1320 if (unlikely(latch != md->swap_bios)) in __map_bio()
1322 down(&md->swap_bios_semaphore); in __map_bio()
1325 r = ti->type->map(ti, clone); in __map_bio()
1331 trace_block_bio_remap(clone->bi_disk->queue, clone, in __map_bio()
1332 bio_dev(io->orig_bio), sector); in __map_bio()
1337 struct mapped_device *md = io->md; in __map_bio()
1338 up(&md->swap_bios_semaphore); in __map_bio()
1345 struct mapped_device *md = io->md; in __map_bio()
1346 up(&md->swap_bios_semaphore); in __map_bio()
1361 bio->bi_iter.bi_sector = sector; in bio_setup_sector()
1362 bio->bi_iter.bi_size = to_bytes(len); in bio_setup_sector()
1371 struct bio *clone = &tio->clone; in clone_bio()
1381 if (unlikely(!dm_target_has_integrity(tio->ti->type) && in clone_bio()
1382 !dm_target_passes_integrity(tio->ti->type))) { in clone_bio()
1384 dm_device_name(tio->io->md), in clone_bio()
1385 tio->ti->type->name); in clone_bio()
1386 return -EIO; in clone_bio()
1394 bio_advance(clone, to_bytes(sector - clone->bi_iter.bi_sector)); in clone_bio()
1395 clone->bi_iter.bi_size = to_bytes(len); in clone_bio()
1414 bio_list_add(blist, &tio->clone); in alloc_multiple_bios()
1423 mutex_lock(&ci->io->md->table_devices_lock); in alloc_multiple_bios()
1429 bio_list_add(blist, &tio->clone); in alloc_multiple_bios()
1432 mutex_unlock(&ci->io->md->table_devices_lock); in alloc_multiple_bios()
1446 struct bio *clone = &tio->clone; in __clone_and_map_simple_bio()
1448 tio->len_ptr = len; in __clone_and_map_simple_bio()
1450 __bio_clone_fast(clone, ci->bio); in __clone_and_map_simple_bio()
1452 bio_setup_sector(clone, ci->sector, *len); in __clone_and_map_simple_bio()
1479 * Use an on-stack bio for this, it's safe since we don't in __send_empty_flush()
1480 * need to reference it after submit. It's just used as in __send_empty_flush()
1485 ci->bio = &flush_bio; in __send_empty_flush()
1486 ci->sector_count = 0; in __send_empty_flush()
1495 bio_set_dev(ci->bio, ci->io->md->bdev); in __send_empty_flush()
1497 BUG_ON(bio_has_data(ci->bio)); in __send_empty_flush()
1498 while ((ti = dm_table_get_target(ci->map, target_nr++))) in __send_empty_flush()
1499 __send_duplicate_bios(ci, ti, ti->num_flush_bios, NULL); in __send_empty_flush()
1501 bio_uninit(ci->bio); in __send_empty_flush()
1508 struct bio *bio = ci->bio; in __clone_and_map_data_bio()
1513 tio->len_ptr = len; in __clone_and_map_data_bio()
1536 return -EOPNOTSUPP; in __send_changing_extent_only()
1538 len = min_t(sector_t, ci->sector_count, in __send_changing_extent_only()
1539 max_io_len_target_boundary(ti, dm_target_offset(ti, ci->sector))); in __send_changing_extent_only()
1543 ci->sector += len; in __send_changing_extent_only()
1544 ci->sector_count -= len; in __send_changing_extent_only()
1568 struct bio *bio = ci->bio; in __process_abnormal_io()
1573 num_bios = ti->num_discard_bios; in __process_abnormal_io()
1576 num_bios = ti->num_secure_erase_bios; in __process_abnormal_io()
1579 num_bios = ti->num_write_same_bios; in __process_abnormal_io()
1582 num_bios = ti->num_write_zeroes_bios; in __process_abnormal_io()
1593 * Select the correct strategy for processing a non-flush bio.
1601 ti = dm_table_find_target(ci->map, ci->sector); in __split_and_process_non_flush()
1603 return -EIO; in __split_and_process_non_flush()
1608 len = min_t(sector_t, max_io_len(ti, ci->sector), ci->sector_count); in __split_and_process_non_flush()
1610 r = __clone_and_map_data_bio(ci, ti, ci->sector, &len); in __split_and_process_non_flush()
1614 ci->sector += len; in __split_and_process_non_flush()
1615 ci->sector_count -= len; in __split_and_process_non_flush()
1623 ci->map = map; in init_clone_info()
1624 ci->io = alloc_io(md, bio); in init_clone_info()
1625 ci->sector = bio->bi_iter.bi_sector; in init_clone_info()
1629 (part_stat_get(part, field) -= (subnd))
1632 * Entry point to split a bio into clones and submit them to the targets.
1643 if (bio->bi_opf & REQ_PREFLUSH) { in __split_and_process_bio()
1655 if (current->bio_list && ci.sector_count && !error) { in __split_and_process_bio()
1657 * Remainder must be passed to submit_bio_noacct() in __split_and_process_bio()
1660 * We take a clone of the original to store in in __split_and_process_bio()
1661 * ci.io->orig_bio to be used by end_io_acct() and in __split_and_process_bio()
1662 * for dec_pending to use for completion handling. in __split_and_process_bio()
1664 struct bio *b = bio_split(bio, bio_sectors(bio) - ci.sector_count, in __split_and_process_bio()
1665 GFP_NOIO, &md->queue->bio_split); in __split_and_process_bio()
1666 ci.io->orig_bio = b; in __split_and_process_bio()
1671 * NOTE: this is a stop-gap fix, a proper fix involves in __split_and_process_bio()
1676 __dm_part_stat_sub(&dm_disk(md)->part0, in __split_and_process_bio()
1681 trace_block_split(md->queue, b, bio->bi_iter.bi_sector); in __split_and_process_bio()
1695 struct mapped_device *md = bio->bi_disk->private_data; in dm_submit_bio()
1703 if (unlikely(test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags)) || in dm_submit_bio()
1705 if (bio->bi_opf & REQ_NOWAIT) in dm_submit_bio()
1707 else if (bio->bi_opf & REQ_RAHEAD) in dm_submit_bio()
1727 /*-----------------------------------------------------------------
1728 * An IDR is used to keep track of allocated minor numbers.
1729 *---------------------------------------------------------------*/
1745 return -EINVAL; in specific_minor()
1755 return r == -ENOSPC ? -EBUSY : r; in specific_minor()
1785 dm_destroy_keyslot_manager(q->ksm); in dm_queue_destroy_keyslot_manager()
1797 if (md->wq) in cleanup_mapped_device()
1798 destroy_workqueue(md->wq); in cleanup_mapped_device()
1799 bioset_exit(&md->bs); in cleanup_mapped_device()
1800 bioset_exit(&md->io_bs); in cleanup_mapped_device()
1802 if (md->dax_dev) { in cleanup_mapped_device()
1803 kill_dax(md->dax_dev); in cleanup_mapped_device()
1804 put_dax(md->dax_dev); in cleanup_mapped_device()
1805 md->dax_dev = NULL; in cleanup_mapped_device()
1808 if (md->disk) { in cleanup_mapped_device()
1810 md->disk->private_data = NULL; in cleanup_mapped_device()
1812 del_gendisk(md->disk); in cleanup_mapped_device()
1813 put_disk(md->disk); in cleanup_mapped_device()
1816 if (md->queue) { in cleanup_mapped_device()
1817 dm_queue_destroy_keyslot_manager(md->queue); in cleanup_mapped_device()
1818 blk_cleanup_queue(md->queue); in cleanup_mapped_device()
1821 cleanup_srcu_struct(&md->io_barrier); in cleanup_mapped_device()
1823 if (md->bdev) { in cleanup_mapped_device()
1824 bdput(md->bdev); in cleanup_mapped_device()
1825 md->bdev = NULL; in cleanup_mapped_device()
1828 mutex_destroy(&md->suspend_lock); in cleanup_mapped_device()
1829 mutex_destroy(&md->type_lock); in cleanup_mapped_device()
1830 mutex_destroy(&md->table_devices_lock); in cleanup_mapped_device()
1831 mutex_destroy(&md->swap_bios_lock); in cleanup_mapped_device()
1847 DMWARN("unable to allocate device, out of memory."); in alloc_dev()
1862 r = init_srcu_struct(&md->io_barrier); in alloc_dev()
1866 md->numa_node_id = numa_node_id; in alloc_dev()
1867 md->init_tio_pdu = false; in alloc_dev()
1868 md->type = DM_TYPE_NONE; in alloc_dev()
1869 mutex_init(&md->suspend_lock); in alloc_dev()
1870 mutex_init(&md->type_lock); in alloc_dev()
1871 mutex_init(&md->table_devices_lock); in alloc_dev()
1872 spin_lock_init(&md->deferred_lock); in alloc_dev()
1873 atomic_set(&md->holders, 1); in alloc_dev()
1874 atomic_set(&md->open_count, 0); in alloc_dev()
1875 atomic_set(&md->event_nr, 0); in alloc_dev()
1876 atomic_set(&md->uevent_seq, 0); in alloc_dev()
1877 INIT_LIST_HEAD(&md->uevent_list); in alloc_dev()
1878 INIT_LIST_HEAD(&md->table_devices); in alloc_dev()
1879 spin_lock_init(&md->uevent_lock); in alloc_dev()
1882 * default to bio-based until DM table is loaded and md->type in alloc_dev()
1883 * established. If request-based table is loaded: blk-mq will in alloc_dev()
1886 md->queue = blk_alloc_queue(numa_node_id); in alloc_dev()
1887 if (!md->queue) in alloc_dev()
1890 md->disk = alloc_disk_node(1, md->numa_node_id); in alloc_dev()
1891 if (!md->disk) in alloc_dev()
1894 init_waitqueue_head(&md->wait); in alloc_dev()
1895 INIT_WORK(&md->work, dm_wq_work); in alloc_dev()
1896 init_waitqueue_head(&md->eventq); in alloc_dev()
1897 init_completion(&md->kobj_holder.completion); in alloc_dev()
1899 md->swap_bios = get_swap_bios(); in alloc_dev()
1900 sema_init(&md->swap_bios_semaphore, md->swap_bios); in alloc_dev()
1901 mutex_init(&md->swap_bios_lock); in alloc_dev()
1903 md->disk->major = _major; in alloc_dev()
1904 md->disk->first_minor = minor; in alloc_dev()
1905 md->disk->fops = &dm_blk_dops; in alloc_dev()
1906 md->disk->queue = md->queue; in alloc_dev()
1907 md->disk->private_data = md; in alloc_dev()
1908 sprintf(md->disk->disk_name, "dm-%d", minor); in alloc_dev()
1911 md->dax_dev = alloc_dax(md, md->disk->disk_name, in alloc_dev()
1913 if (IS_ERR(md->dax_dev)) { in alloc_dev()
1914 md->dax_dev = NULL; in alloc_dev()
1919 add_disk_no_queue_reg(md->disk); in alloc_dev()
1920 format_dev_t(md->name, MKDEV(_major, minor)); in alloc_dev()
1922 md->wq = alloc_workqueue("kdmflush", WQ_MEM_RECLAIM, 0); in alloc_dev()
1923 if (!md->wq) in alloc_dev()
1926 md->bdev = bdget_disk(md->disk, 0); in alloc_dev()
1927 if (!md->bdev) in alloc_dev()
1930 dm_stats_init(&md->stats); in alloc_dev()
1956 int minor = MINOR(disk_devt(md->disk)); in free_dev()
1962 free_table_devices(&md->table_devices); in free_dev()
1963 dm_stats_cleanup(&md->stats); in free_dev()
1981 bioset_exit(&md->bs); in __bind_mempools()
1982 bioset_exit(&md->io_bs); in __bind_mempools()
1984 } else if (bioset_initialized(&md->bs)) { in __bind_mempools()
1986 * There's no need to reload with request-based dm in __bind_mempools()
1988 * Note for future: If you are to reload bioset, in __bind_mempools()
1989 * prep-ed requests in the queue may refer in __bind_mempools()
1990 * to bio from the old bioset, so you must walk in __bind_mempools()
1991 * through the queue to unprep. in __bind_mempools()
1997 bioset_initialized(&md->bs) || in __bind_mempools()
1998 bioset_initialized(&md->io_bs)); in __bind_mempools()
2000 ret = bioset_init_from_src(&md->bs, &p->bs); in __bind_mempools()
2003 ret = bioset_init_from_src(&md->io_bs, &p->io_bs); in __bind_mempools()
2005 bioset_exit(&md->bs); in __bind_mempools()
2013 * Bind a table to the device.
2021 spin_lock_irqsave(&md->uevent_lock, flags); in event_callback()
2022 list_splice_init(&md->uevent_list, &uevents); in event_callback()
2023 spin_unlock_irqrestore(&md->uevent_lock, flags); in event_callback()
2025 dm_send_uevents(&uevents, &disk_to_dev(md->disk)->kobj); in event_callback()
2027 atomic_inc(&md->event_nr); in event_callback()
2028 wake_up(&md->eventq); in event_callback()
2039 struct request_queue *q = md->queue; in __bind()
2044 lockdep_assert_held(&md->suspend_lock); in __bind()
2052 memset(&md->geometry, 0, sizeof(md->geometry)); in __bind()
2054 set_capacity(md->disk, size); in __bind()
2055 bd_set_nr_sectors(md->bdev, size); in __bind()
2061 * for request-based during suspension. So stop it to prevent in __bind()
2064 * because request-based dm may be run just after the setting. in __bind()
2071 * Leverage the fact that request-based DM targets are in __bind()
2072 * immutable singletons - used to optimize dm_mq_queue_rq. in __bind()
2074 md->immutable_target = dm_table_get_immutable_target(t); in __bind()
2083 old_map = rcu_dereference_protected(md->map, lockdep_is_held(&md->suspend_lock)); in __bind()
2084 rcu_assign_pointer(md->map, (void *)t); in __bind()
2085 md->immutable_target_type = dm_table_get_immutable_target_type(t); in __bind()
2096 * Returns unbound table for the caller to free.
2100 struct dm_table *map = rcu_dereference_protected(md->map, 1); in __unbind()
2106 RCU_INIT_POINTER(md->map, NULL); in __unbind()
2122 return -ENXIO; in dm_create()
2135 * Functions to manage md->type.
2136 * All are required to hold md->type_lock.
2140 mutex_lock(&md->type_lock); in dm_lock_md_type()
2145 mutex_unlock(&md->type_lock); in dm_unlock_md_type()
2150 BUG_ON(!mutex_is_locked(&md->type_lock)); in dm_set_md_type()
2151 md->type = type; in dm_set_md_type()
2156 return md->type; in dm_get_md_type()
2161 return md->immutable_target_type; in dm_get_immutable_target_type()
2170 BUG_ON(!atomic_read(&md->holders)); in dm_get_queue_limits()
2171 return &md->queue->limits; in dm_get_queue_limits()
2186 md->disk->fops = &dm_rq_blk_dops; in dm_setup_md_queue()
2189 DMERR("Cannot initialize queue for request-based dm mapped device"); in dm_setup_md_queue()
2206 dm_table_set_restrictions(t, md->queue, &limits); in dm_setup_md_queue()
2207 blk_register_queue(md->disk); in dm_setup_md_queue()
2224 test_bit(DMF_FREEING, &md->flags) || dm_deleting_md(md)) { in dm_get_md()
2238 return md->interface_ptr; in dm_get_mdptr()
2243 md->interface_ptr = ptr; in dm_set_mdptr()
2248 atomic_inc(&md->holders); in dm_get()
2249 BUG_ON(test_bit(DMF_FREEING, &md->flags)); in dm_get()
2255 if (test_bit(DMF_FREEING, &md->flags)) { in dm_hold()
2257 return -EBUSY; in dm_hold()
2267 return md->name; in dm_device_name()
2280 set_bit(DMF_FREEING, &md->flags); in __dm_destroy()
2283 blk_set_queue_dying(md->queue); in __dm_destroy()
2287 * do not race with internal suspend. in __dm_destroy()
2289 mutex_lock(&md->suspend_lock); in __dm_destroy()
2293 set_bit(DMF_SUSPENDED, &md->flags); in __dm_destroy()
2294 set_bit(DMF_POST_SUSPENDING, &md->flags); in __dm_destroy()
2299 mutex_unlock(&md->suspend_lock); in __dm_destroy()
2302 * Rare, but there may be I/O requests still going to complete, in __dm_destroy()
2303 * for example. Wait for all references to disappear. in __dm_destroy()
2308 while (atomic_read(&md->holders)) in __dm_destroy()
2310 else if (atomic_read(&md->holders)) in __dm_destroy()
2312 dm_device_name(md), atomic_read(&md->holders)); in __dm_destroy()
2331 atomic_dec(&md->holders); in dm_put()
2338 struct hd_struct *part = &dm_disk(md)->part0; in md_in_flight_bios()
2355 prepare_to_wait(&md->wait, &wait, task_state); in dm_wait_for_bios_completion()
2361 r = -EINTR; in dm_wait_for_bios_completion()
2367 finish_wait(&md->wait, &wait); in dm_wait_for_bios_completion()
2378 if (!queue_is_mq(md->queue)) in dm_wait_for_completion()
2382 if (!blk_mq_queue_inflight(md->queue)) in dm_wait_for_completion()
2386 r = -EINTR; in dm_wait_for_completion()
2404 while (!test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags)) { in dm_wq_work()
2405 spin_lock_irq(&md->deferred_lock); in dm_wq_work()
2406 bio = bio_list_pop(&md->deferred); in dm_wq_work()
2407 spin_unlock_irq(&md->deferred_lock); in dm_wq_work()
2418 clear_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags); in dm_queue_flush()
2420 queue_work(md->wq, &md->work); in dm_queue_flush()
2424 * Swap in a new table, returning the old one for the caller to destroy.
2428 struct dm_table *live_map = NULL, *map = ERR_PTR(-EINVAL); in dm_swap_table()
2432 mutex_lock(&md->suspend_lock); in dm_swap_table()
2447 limits = md->queue->limits; in dm_swap_table()
2463 mutex_unlock(&md->suspend_lock); in dm_swap_table()
2468 * Functions to lock and unlock any filesystem running on the
2475 WARN_ON(test_bit(DMF_FROZEN, &md->flags)); in lock_fs()
2477 r = freeze_bdev(md->bdev); in lock_fs()
2479 set_bit(DMF_FROZEN, &md->flags); in lock_fs()
2485 if (!test_bit(DMF_FROZEN, &md->flags)) in unlock_fs()
2487 thaw_bdev(md->bdev); in unlock_fs()
2488 clear_bit(DMF_FROZEN, &md->flags); in unlock_fs()
2497 * now. There is no request-processing activity. All new requests
2498 * are being added to md->deferred list.
2508 lockdep_assert_held(&md->suspend_lock); in __dm_suspend()
2515 set_bit(DMF_NOFLUSH_SUSPENDING, &md->flags); in __dm_suspend()
2526 * Flush I/O to the device. in __dm_suspend()
2529 * (lock_fs() flushes I/Os and waits for them to complete.) in __dm_suspend()
2541 * to target drivers i.e. no one may be executing in __dm_suspend()
2544 * To get all processes out of __split_and_process_bio in dm_submit_bio, in __dm_suspend()
2545 * we take the write lock. To prevent any process from reentering in __dm_suspend()
2548 * flush_workqueue(md->wq). in __dm_suspend()
2550 set_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags); in __dm_suspend()
2552 synchronize_srcu(&md->io_barrier); in __dm_suspend()
2555 * Stop md->queue before flushing md->wq in case request-based in __dm_suspend()
2556 * dm defers requests to md->wq from md->queue. in __dm_suspend()
2559 dm_stop_queue(md->queue); in __dm_suspend()
2561 flush_workqueue(md->wq); in __dm_suspend()
2565 * We call dm_wait_for_completion to wait for all existing requests in __dm_suspend()
2566 * to finish. in __dm_suspend()
2570 set_bit(dmf_suspended_flag, &md->flags); in __dm_suspend()
2573 clear_bit(DMF_NOFLUSH_SUSPENDING, &md->flags); in __dm_suspend()
2575 synchronize_srcu(&md->io_barrier); in __dm_suspend()
2582 dm_start_queue(md->queue); in __dm_suspend()
2593 * We need to be able to change a mapping table under a mounted
2594 * filesystem. For example we might want to move some data in
2596 * dm_bind_table, dm_suspend must be called to flush any in
2600 * Suspend mechanism in request-based dm.
2604 * 3. Wait for all in-flight I/Os to be completed or requeued.
2606 * To abort suspend, start the request_queue.
2614 mutex_lock_nested(&md->suspend_lock, SINGLE_DEPTH_NESTING); in dm_suspend()
2617 r = -EINVAL; in dm_suspend()
2623 mutex_unlock(&md->suspend_lock); in dm_suspend()
2624 r = wait_on_bit(&md->flags, DMF_SUSPENDED_INTERNALLY, TASK_INTERRUPTIBLE); in dm_suspend()
2630 map = rcu_dereference_protected(md->map, lockdep_is_held(&md->suspend_lock)); in dm_suspend()
2636 set_bit(DMF_POST_SUSPENDING, &md->flags); in dm_suspend()
2638 clear_bit(DMF_POST_SUSPENDING, &md->flags); in dm_suspend()
2641 mutex_unlock(&md->suspend_lock); in dm_suspend()
2658 * Request-based dm is queueing the deferred I/Os in its request_queue. in __dm_resume()
2661 dm_start_queue(md->queue); in __dm_resume()
2674 r = -EINVAL; in dm_resume()
2675 mutex_lock_nested(&md->suspend_lock, SINGLE_DEPTH_NESTING); in dm_resume()
2682 mutex_unlock(&md->suspend_lock); in dm_resume()
2683 r = wait_on_bit(&md->flags, DMF_SUSPENDED_INTERNALLY, TASK_INTERRUPTIBLE); in dm_resume()
2689 map = rcu_dereference_protected(md->map, lockdep_is_held(&md->suspend_lock)); in dm_resume()
2697 clear_bit(DMF_SUSPENDED, &md->flags); in dm_resume()
2699 mutex_unlock(&md->suspend_lock); in dm_resume()
2705 * Internal suspend/resume works like userspace-driven suspend. It waits
2706 * until all bios finish and prevents issuing new bios to the target drivers.
2714 lockdep_assert_held(&md->suspend_lock); in __dm_internal_suspend()
2716 if (md->internal_suspend_count++) in __dm_internal_suspend()
2717 return; /* nested internal suspend */ in __dm_internal_suspend()
2720 set_bit(DMF_SUSPENDED_INTERNALLY, &md->flags); in __dm_internal_suspend()
2721 return; /* nest suspend */ in __dm_internal_suspend()
2724 map = rcu_dereference_protected(md->map, lockdep_is_held(&md->suspend_lock)); in __dm_internal_suspend()
2727 * Using TASK_UNINTERRUPTIBLE because only NOFLUSH internal suspend is in __dm_internal_suspend()
2728 * supported. Properly supporting a TASK_INTERRUPTIBLE internal suspend in __dm_internal_suspend()
2729 * would require changing .presuspend to return an error -- avoid this in __dm_internal_suspend()
2730 * until there is a need for more elaborate variants of internal suspend. in __dm_internal_suspend()
2735 set_bit(DMF_POST_SUSPENDING, &md->flags); in __dm_internal_suspend()
2737 clear_bit(DMF_POST_SUSPENDING, &md->flags); in __dm_internal_suspend()
2742 BUG_ON(!md->internal_suspend_count); in __dm_internal_resume()
2744 if (--md->internal_suspend_count) in __dm_internal_resume()
2745 return; /* resume from nested internal suspend */ in __dm_internal_resume()
2748 goto done; /* resume from nested suspend */ in __dm_internal_resume()
2751 * NOTE: existing callers don't need to call dm_table_resume_targets in __dm_internal_resume()
2752 * (which may fail -- so best to avoid it for now by passing NULL map) in __dm_internal_resume()
2757 clear_bit(DMF_SUSPENDED_INTERNALLY, &md->flags); in __dm_internal_resume()
2759 wake_up_bit(&md->flags, DMF_SUSPENDED_INTERNALLY); in __dm_internal_resume()
2764 mutex_lock(&md->suspend_lock); in dm_internal_suspend_noflush()
2766 mutex_unlock(&md->suspend_lock); in dm_internal_suspend_noflush()
2772 mutex_lock(&md->suspend_lock); in dm_internal_resume()
2774 mutex_unlock(&md->suspend_lock); in dm_internal_resume()
2779 * Fast variants of internal suspend/resume hold md->suspend_lock,
2780 * which prevents interaction with userspace-driven suspend.
2785 mutex_lock(&md->suspend_lock); in dm_internal_suspend_fast()
2789 set_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags); in dm_internal_suspend_fast()
2790 synchronize_srcu(&md->io_barrier); in dm_internal_suspend_fast()
2791 flush_workqueue(md->wq); in dm_internal_suspend_fast()
2804 mutex_unlock(&md->suspend_lock); in dm_internal_resume_fast()
2808 /*-----------------------------------------------------------------
2810 *---------------------------------------------------------------*/
2822 r = kobject_uevent(&disk_to_dev(md->disk)->kobj, action); in dm_kobject_uevent()
2826 r = kobject_uevent_env(&disk_to_dev(md->disk)->kobj, in dm_kobject_uevent()
2837 return atomic_add_return(1, &md->uevent_seq); in dm_next_uevent_seq()
2842 return atomic_read(&md->event_nr); in dm_get_event_nr()
2847 return wait_event_interruptible(md->eventq, in dm_wait_event()
2848 (event_nr != atomic_read(&md->event_nr))); in dm_wait_event()
2855 spin_lock_irqsave(&md->uevent_lock, flags); in dm_uevent_add()
2856 list_add(elist, &md->uevent_list); in dm_uevent_add()
2857 spin_unlock_irqrestore(&md->uevent_lock, flags); in dm_uevent_add()
2866 return md->disk; in dm_disk()
2872 return &md->kobj_holder.kobj; in dm_kobject()
2882 if (test_bit(DMF_FREEING, &md->flags) || dm_deleting_md(md)) { in dm_get_from_kobject()
2895 return test_bit(DMF_SUSPENDED, &md->flags); in dm_suspended_md()
2900 return test_bit(DMF_POST_SUSPENDING, &md->flags); in dm_post_suspending_md()
2905 return test_bit(DMF_SUSPENDED_INTERNALLY, &md->flags); in dm_suspended_internally_md()
2910 return test_bit(DMF_DEFERRED_REMOVE, &md->flags); in dm_test_deferred_remove_flag()
2915 return dm_suspended_md(ti->table->md); in dm_suspended()
2921 return dm_post_suspending_md(ti->table->md); in dm_post_suspending()
2927 return __noflush_suspending(ti->table->md); in dm_noflush_suspending()
2935 struct dm_md_mempools *pools = kzalloc_node(sizeof(*pools), GFP_KERNEL, md->numa_node_id); in dm_alloc_md_mempools()
2949 ret = bioset_init(&pools->io_bs, pool_size, io_front_pad, 0); in dm_alloc_md_mempools()
2952 if (integrity && bioset_integrity_create(&pools->io_bs, pool_size)) in dm_alloc_md_mempools()
2958 /* per_io_data_size is used for blk-mq pdu at queue allocation */ in dm_alloc_md_mempools()
2964 ret = bioset_init(&pools->bs, pool_size, front_pad, 0); in dm_alloc_md_mempools()
2968 if (integrity && bioset_integrity_create(&pools->bs, pool_size)) in dm_alloc_md_mempools()
2984 bioset_exit(&pools->bs); in dm_free_md_mempools()
2985 bioset_exit(&pools->io_bs); in dm_free_md_mempools()
3000 struct mapped_device *md = bdev->bd_disk->private_data; in dm_call_pr()
3003 int ret = -ENOTTY, srcu_idx; in dm_call_pr()
3015 ret = -EAGAIN; in dm_call_pr()
3019 ret = -EINVAL; in dm_call_pr()
3020 if (!ti->type->iterate_devices) in dm_call_pr()
3023 ret = ti->type->iterate_devices(ti, fn, data); in dm_call_pr()
3030 * For register / unregister we need to manually call out to every path.
3036 const struct pr_ops *ops = dev->bdev->bd_disk->fops->pr_ops; in __dm_pr_register()
3038 if (!ops || !ops->pr_register) in __dm_pr_register()
3039 return -EOPNOTSUPP; in __dm_pr_register()
3040 return ops->pr_register(dev->bdev, pr->old_key, pr->new_key, pr->flags); in __dm_pr_register()
3056 /* unregister all paths if we failed to register any path */ in dm_pr_register()
3070 struct mapped_device *md = bdev->bd_disk->private_data; in dm_pr_reserve()
3078 ops = bdev->bd_disk->fops->pr_ops; in dm_pr_reserve()
3079 if (ops && ops->pr_reserve) in dm_pr_reserve()
3080 r = ops->pr_reserve(bdev, key, type, flags); in dm_pr_reserve()
3082 r = -EOPNOTSUPP; in dm_pr_reserve()
3090 struct mapped_device *md = bdev->bd_disk->private_data; in dm_pr_release()
3098 ops = bdev->bd_disk->fops->pr_ops; in dm_pr_release()
3099 if (ops && ops->pr_release) in dm_pr_release()
3100 r = ops->pr_release(bdev, key, type); in dm_pr_release()
3102 r = -EOPNOTSUPP; in dm_pr_release()
3111 struct mapped_device *md = bdev->bd_disk->private_data; in dm_pr_preempt()
3119 ops = bdev->bd_disk->fops->pr_ops; in dm_pr_preempt()
3120 if (ops && ops->pr_preempt) in dm_pr_preempt()
3121 r = ops->pr_preempt(bdev, old_key, new_key, type, abort); in dm_pr_preempt()
3123 r = -EOPNOTSUPP; in dm_pr_preempt()
3131 struct mapped_device *md = bdev->bd_disk->private_data; in dm_pr_clear()
3139 ops = bdev->bd_disk->fops->pr_ops; in dm_pr_clear()
3140 if (ops && ops->pr_clear) in dm_pr_clear()
3141 r = ops->pr_clear(bdev, key); in dm_pr_clear()
3143 r = -EOPNOTSUPP; in dm_pr_clear()
3195 MODULE_PARM_DESC(reserved_bio_based_ios, "Reserved IOs in bio-based mempools");
3204 MODULE_AUTHOR("Joe Thornber <dm-devel@redhat.com>");