Skip to content

Commit 9c37de2

Browse files
committed
dm: remove special-casing of bio-based immutable singleton target on NVMe
Since commit 5a6c35f ("block: remove direct_make_request") there is no benefit to DM special-casing NVMe. Remove all code used to establish DM_TYPE_NVME_BIO_BASED. Signed-off-by: Mike Snitzer <[email protected]>
1 parent 61931c0 commit 9c37de2

File tree

3 files changed

+7
-81
lines changed

3 files changed

+7
-81
lines changed

drivers/md/dm-table.c

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -804,8 +804,7 @@ EXPORT_SYMBOL(dm_consume_args);
804804
static bool __table_type_bio_based(enum dm_queue_mode table_type)
805805
{
806806
return (table_type == DM_TYPE_BIO_BASED ||
807-
table_type == DM_TYPE_DAX_BIO_BASED ||
808-
table_type == DM_TYPE_NVME_BIO_BASED);
807+
table_type == DM_TYPE_DAX_BIO_BASED);
809808
}
810809

811810
static bool __table_type_request_based(enum dm_queue_mode table_type)
@@ -861,8 +860,6 @@ bool dm_table_supports_dax(struct dm_table *t,
861860
return true;
862861
}
863862

864-
static bool dm_table_does_not_support_partial_completion(struct dm_table *t);
865-
866863
static int device_is_rq_stackable(struct dm_target *ti, struct dm_dev *dev,
867864
sector_t start, sector_t len, void *data)
868865
{
@@ -892,7 +889,6 @@ static int dm_table_determine_type(struct dm_table *t)
892889
goto verify_bio_based;
893890
}
894891
BUG_ON(t->type == DM_TYPE_DAX_BIO_BASED);
895-
BUG_ON(t->type == DM_TYPE_NVME_BIO_BASED);
896892
goto verify_rq_based;
897893
}
898894

@@ -931,15 +927,6 @@ static int dm_table_determine_type(struct dm_table *t)
931927
if (dm_table_supports_dax(t, device_supports_dax, &page_size) ||
932928
(list_empty(devices) && live_md_type == DM_TYPE_DAX_BIO_BASED)) {
933929
t->type = DM_TYPE_DAX_BIO_BASED;
934-
} else {
935-
/* Check if upgrading to NVMe bio-based is valid or required */
936-
tgt = dm_table_get_immutable_target(t);
937-
if (tgt && !tgt->max_io_len && dm_table_does_not_support_partial_completion(t)) {
938-
t->type = DM_TYPE_NVME_BIO_BASED;
939-
goto verify_rq_based; /* must be stacked directly on NVMe (blk-mq) */
940-
} else if (list_empty(devices) && live_md_type == DM_TYPE_NVME_BIO_BASED) {
941-
t->type = DM_TYPE_NVME_BIO_BASED;
942-
}
943930
}
944931
return 0;
945932
}
@@ -956,8 +943,7 @@ static int dm_table_determine_type(struct dm_table *t)
956943
* (e.g. request completion process for partial completion.)
957944
*/
958945
if (t->num_targets > 1) {
959-
DMERR("%s DM doesn't support multiple targets",
960-
t->type == DM_TYPE_NVME_BIO_BASED ? "nvme bio-based" : "request-based");
946+
DMERR("request-based DM doesn't support multiple targets");
961947
return -EINVAL;
962948
}
963949

@@ -1651,20 +1637,6 @@ static bool dm_table_all_devices_attribute(struct dm_table *t,
16511637
return true;
16521638
}
16531639

1654-
static int device_no_partial_completion(struct dm_target *ti, struct dm_dev *dev,
1655-
sector_t start, sector_t len, void *data)
1656-
{
1657-
char b[BDEVNAME_SIZE];
1658-
1659-
/* For now, NVMe devices are the only devices of this class */
1660-
return (strncmp(bdevname(dev->bdev, b), "nvme", 4) == 0);
1661-
}
1662-
1663-
static bool dm_table_does_not_support_partial_completion(struct dm_table *t)
1664-
{
1665-
return dm_table_all_devices_attribute(t, device_no_partial_completion);
1666-
}
1667-
16681640
static int device_not_write_same_capable(struct dm_target *ti, struct dm_dev *dev,
16691641
sector_t start, sector_t len, void *data)
16701642
{

drivers/md/dm.c

Lines changed: 5 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ static void clone_endio(struct bio *bio)
975975
dm_endio_fn endio = tio->ti->type->end_io;
976976
struct bio *orig_bio = io->orig_bio;
977977

978-
if (unlikely(error == BLK_STS_TARGET) && md->type != DM_TYPE_NVME_BIO_BASED) {
978+
if (unlikely(error == BLK_STS_TARGET)) {
979979
if (bio_op(bio) == REQ_OP_DISCARD &&
980980
!bio->bi_disk->queue->limits.max_discard_sectors)
981981
disable_discard(md);
@@ -1626,45 +1626,6 @@ static blk_qc_t __split_and_process_bio(struct mapped_device *md,
16261626
return ret;
16271627
}
16281628

1629-
/*
1630-
* Optimized variant of __split_and_process_bio that leverages the
1631-
* fact that targets that use it do _not_ have a need to split bios.
1632-
*/
1633-
static blk_qc_t __process_bio(struct mapped_device *md, struct dm_table *map,
1634-
struct bio *bio)
1635-
{
1636-
struct clone_info ci;
1637-
blk_qc_t ret = BLK_QC_T_NONE;
1638-
int error = 0;
1639-
1640-
init_clone_info(&ci, md, map, bio);
1641-
1642-
if (bio->bi_opf & REQ_PREFLUSH) {
1643-
error = __send_empty_flush(&ci);
1644-
/* dec_pending submits any data associated with flush */
1645-
} else {
1646-
struct dm_target_io *tio;
1647-
struct dm_target *ti = md->immutable_target;
1648-
1649-
if (WARN_ON_ONCE(!ti)) {
1650-
error = -EIO;
1651-
goto out;
1652-
}
1653-
1654-
ci.bio = bio;
1655-
ci.sector_count = bio_sectors(bio);
1656-
if (__process_abnormal_io(&ci, ti, &error))
1657-
goto out;
1658-
1659-
tio = alloc_tio(&ci, ti, 0, GFP_NOIO);
1660-
ret = __clone_and_map_simple_bio(&ci, tio, NULL);
1661-
}
1662-
out:
1663-
/* drop the extra reference count */
1664-
dec_pending(ci.io, errno_to_blk_status(error));
1665-
return ret;
1666-
}
1667-
16681629
static blk_qc_t dm_submit_bio(struct bio *bio)
16691630
{
16701631
struct mapped_device *md = bio->bi_disk->private_data;
@@ -1710,10 +1671,7 @@ static blk_qc_t dm_submit_bio(struct bio *bio)
17101671
if (is_abnormal_io(bio))
17111672
blk_queue_split(&bio);
17121673

1713-
if (dm_get_md_type(md) == DM_TYPE_NVME_BIO_BASED)
1714-
ret = __process_bio(md, map, bio);
1715-
else
1716-
ret = __split_and_process_bio(md, map, bio);
1674+
ret = __split_and_process_bio(md, map, bio);
17171675
out:
17181676
dm_put_live_table(md, srcu_idx);
17191677
return ret;
@@ -2038,11 +1996,10 @@ static struct dm_table *__bind(struct mapped_device *md, struct dm_table *t,
20381996
if (request_based)
20391997
dm_stop_queue(q);
20401998

2041-
if (request_based || md->type == DM_TYPE_NVME_BIO_BASED) {
1999+
if (request_based) {
20422000
/*
2043-
* Leverage the fact that request-based DM targets and
2044-
* NVMe bio based targets are immutable singletons
2045-
* - used to optimize both __process_bio and dm_mq_queue_rq
2001+
* Leverage the fact that request-based DM targets are
2002+
* immutable singletons - used to optimize dm_mq_queue_rq.
20462003
*/
20472004
md->immutable_target = dm_table_get_immutable_target(t);
20482005
}
@@ -2164,7 +2121,6 @@ int dm_setup_md_queue(struct mapped_device *md, struct dm_table *t)
21642121
break;
21652122
case DM_TYPE_BIO_BASED:
21662123
case DM_TYPE_DAX_BIO_BASED:
2167-
case DM_TYPE_NVME_BIO_BASED:
21682124
break;
21692125
case DM_TYPE_NONE:
21702126
WARN_ON_ONCE(true);
@@ -2922,7 +2878,6 @@ struct dm_md_mempools *dm_alloc_md_mempools(struct mapped_device *md, enum dm_qu
29222878
switch (type) {
29232879
case DM_TYPE_BIO_BASED:
29242880
case DM_TYPE_DAX_BIO_BASED:
2925-
case DM_TYPE_NVME_BIO_BASED:
29262881
pool_size = max(dm_get_reserved_bio_based_ios(), min_pool_size);
29272882
front_pad = roundup(per_io_data_size, __alignof__(struct dm_target_io)) + offsetof(struct dm_target_io, clone);
29282883
io_front_pad = roundup(front_pad, __alignof__(struct dm_io)) + offsetof(struct dm_io, tio);

include/linux/device-mapper.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ enum dm_queue_mode {
2929
DM_TYPE_BIO_BASED = 1,
3030
DM_TYPE_REQUEST_BASED = 2,
3131
DM_TYPE_DAX_BIO_BASED = 3,
32-
DM_TYPE_NVME_BIO_BASED = 4,
3332
};
3433

3534
typedef enum { STATUSTYPE_INFO, STATUSTYPE_TABLE } status_type_t;

0 commit comments

Comments
 (0)