block: rework zone reporting
Avoid the need to allocate a potentially large array of struct blk_zone in the block layer by switching the ->report_zones method interface to a callback model. Now the caller simply supplies a callback that is executed on each reported zone, and private data for it. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:

committed by
Jens Axboe

parent
23a50861ad
commit
d41003513e
@@ -136,21 +136,15 @@ static int linear_prepare_ioctl(struct dm_target *ti, struct block_device **bdev
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BLK_DEV_ZONED
|
||||
static int linear_report_zones(struct dm_target *ti, sector_t sector,
|
||||
struct blk_zone *zones, unsigned int *nr_zones)
|
||||
static int linear_report_zones(struct dm_target *ti,
|
||||
struct dm_report_zones_args *args, unsigned int nr_zones)
|
||||
{
|
||||
struct linear_c *lc = (struct linear_c *) ti->private;
|
||||
int ret;
|
||||
struct linear_c *lc = ti->private;
|
||||
sector_t sector = linear_map_sector(ti, args->next_sector);
|
||||
|
||||
/* Do report and remap it */
|
||||
ret = blkdev_report_zones(lc->dev->bdev, linear_map_sector(ti, sector),
|
||||
zones, nr_zones);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
if (*nr_zones)
|
||||
dm_remap_zone_report(ti, lc->start, zones, nr_zones);
|
||||
return 0;
|
||||
args->start = lc->start;
|
||||
return blkdev_report_zones(lc->dev->bdev, sector, nr_zones,
|
||||
dm_report_zones_cb, args);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user