Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dm: use generic functions instead of disable_discard and disable_write_zeroes

A small code cleanup: use blk_queue_disable_discard and
blk_queue_disable_write_zeroes instead of disable_discard and
disable_write_zeroes.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

+4 -23
-3
drivers/md/dm-core.h
··· 163 163 #define DMF_POST_SUSPENDING 8 164 164 #define DMF_EMULATE_ZONE_APPEND 9 165 165 166 - void disable_discard(struct mapped_device *md); 167 - void disable_write_zeroes(struct mapped_device *md); 168 - 169 166 static inline sector_t dm_get_size(struct mapped_device *md) 170 167 { 171 168 return get_capacity(md->disk);
+2 -2
drivers/md/dm-rq.c
··· 217 217 if (unlikely(error == BLK_STS_TARGET)) { 218 218 if (req_op(clone) == REQ_OP_DISCARD && 219 219 !clone->q->limits.max_discard_sectors) 220 - disable_discard(tio->md); 220 + blk_queue_disable_discard(tio->md->queue); 221 221 else if (req_op(clone) == REQ_OP_WRITE_ZEROES && 222 222 !clone->q->limits.max_write_zeroes_sectors) 223 - disable_write_zeroes(tio->md); 223 + blk_queue_disable_write_zeroes(tio->md->queue); 224 224 } 225 225 226 226 switch (r) {
+2 -18
drivers/md/dm.c
··· 1082 1082 return &md->queue->limits; 1083 1083 } 1084 1084 1085 - void disable_discard(struct mapped_device *md) 1086 - { 1087 - struct queue_limits *limits = dm_get_queue_limits(md); 1088 - 1089 - /* device doesn't really support DISCARD, disable it */ 1090 - limits->max_hw_discard_sectors = 0; 1091 - } 1092 - 1093 - void disable_write_zeroes(struct mapped_device *md) 1094 - { 1095 - struct queue_limits *limits = dm_get_queue_limits(md); 1096 - 1097 - /* device doesn't really support WRITE ZEROES, disable it */ 1098 - limits->max_write_zeroes_sectors = 0; 1099 - } 1100 - 1101 1085 static bool swap_bios_limit(struct dm_target *ti, struct bio *bio) 1102 1086 { 1103 1087 return unlikely((bio->bi_opf & REQ_SWAP) != 0) && unlikely(ti->limit_swap_bios); ··· 1099 1115 if (unlikely(error == BLK_STS_TARGET)) { 1100 1116 if (bio_op(bio) == REQ_OP_DISCARD && 1101 1117 !bdev_max_discard_sectors(bio->bi_bdev)) 1102 - disable_discard(md); 1118 + blk_queue_disable_discard(md->queue); 1103 1119 else if (bio_op(bio) == REQ_OP_WRITE_ZEROES && 1104 1120 !bdev_write_zeroes_sectors(bio->bi_bdev)) 1105 - disable_write_zeroes(md); 1121 + blk_queue_disable_write_zeroes(md->queue); 1106 1122 } 1107 1123 1108 1124 if (static_branch_unlikely(&zoned_enabled) &&