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

dm: remove dm_check_zoned

Fold it into the only caller in preparation to changes in the
queue limits setup.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mike Snitzer <snitzer@kernel.org>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/20240527123634.1116952-3-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Christoph Hellwig and committed by
Jens Axboe
5e7a4bbc d9780064

+23 -36
+23 -36
drivers/md/dm-zone.c
··· 160 160 return 0; 161 161 } 162 162 163 - static int dm_check_zoned(struct mapped_device *md, struct dm_table *t) 164 - { 165 - struct gendisk *disk = md->disk; 166 - unsigned int nr_conv_zones = 0; 167 - int ret; 168 - 169 - /* Count conventional zones */ 170 - md->zone_revalidate_map = t; 171 - ret = dm_blk_report_zones(disk, 0, UINT_MAX, 172 - dm_check_zoned_cb, &nr_conv_zones); 173 - md->zone_revalidate_map = NULL; 174 - if (ret < 0) { 175 - DMERR("Check zoned failed %d", ret); 176 - return ret; 177 - } 178 - 179 - /* 180 - * If we only have conventional zones, expose the mapped device as 181 - * a regular device. 182 - */ 183 - if (nr_conv_zones >= ret) { 184 - disk->queue->limits.max_open_zones = 0; 185 - disk->queue->limits.max_active_zones = 0; 186 - disk->queue->limits.zoned = false; 187 - clear_bit(DMF_EMULATE_ZONE_APPEND, &md->flags); 188 - disk->nr_zones = 0; 189 - } 190 - 191 - return 0; 192 - } 193 - 194 163 /* 195 164 * Revalidate the zones of a mapped device to initialize resource necessary 196 165 * for zone append emulation. Note that we cannot simply use the block layer ··· 223 254 int dm_set_zones_restrictions(struct dm_table *t, struct request_queue *q) 224 255 { 225 256 struct mapped_device *md = t->md; 257 + struct gendisk *disk = md->disk; 258 + unsigned int nr_conv_zones = 0; 226 259 int ret; 227 260 228 261 /* ··· 243 272 return 0; 244 273 245 274 /* 246 - * Check that the mapped device will indeed be zoned, that is, that it 247 - * has sequential write required zones. 275 + * Count conventional zones to check that the mapped device will indeed 276 + * have sequential write required zones. 248 277 */ 249 - ret = dm_check_zoned(md, t); 250 - if (ret) 278 + md->zone_revalidate_map = t; 279 + ret = dm_blk_report_zones(disk, 0, UINT_MAX, 280 + dm_check_zoned_cb, &nr_conv_zones); 281 + md->zone_revalidate_map = NULL; 282 + if (ret < 0) { 283 + DMERR("Check zoned failed %d", ret); 251 284 return ret; 252 - if (!blk_queue_is_zoned(q)) 285 + } 286 + 287 + /* 288 + * If we only have conventional zones, expose the mapped device as 289 + * a regular device. 290 + */ 291 + if (nr_conv_zones >= ret) { 292 + disk->queue->limits.max_open_zones = 0; 293 + disk->queue->limits.max_active_zones = 0; 294 + disk->queue->limits.zoned = false; 295 + clear_bit(DMF_EMULATE_ZONE_APPEND, &md->flags); 296 + disk->nr_zones = 0; 253 297 return 0; 298 + } 254 299 255 300 if (!md->disk->nr_zones) { 256 301 DMINFO("%s using %s zone append",