Commit aa821c8d authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Mike Snitzer

dm zoned: use dmz_zone_to_dev() when handling metadata I/O

Use accessors to retrieve the device pointer in preparation
for adding an additional block device.
Signed-off-by: default avatarHannes Reinecke <hare@suse.de>
Reviewed-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: default avatarBob Liu <bob.liu@oracle.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent 52d67758
......@@ -1310,6 +1310,7 @@ static int dmz_update_zone_cb(struct blk_zone *blkz, unsigned int idx,
*/
static int dmz_update_zone(struct dmz_metadata *zmd, struct dm_zone *zone)
{
struct dmz_dev *dev = dmz_zone_to_dev(zmd, zone);
unsigned int noio_flag;
int ret;
......@@ -1320,16 +1321,16 @@ static int dmz_update_zone(struct dmz_metadata *zmd, struct dm_zone *zone)
* GFP_NOIO was specified.
*/
noio_flag = memalloc_noio_save();
ret = blkdev_report_zones(zmd->dev->bdev, dmz_start_sect(zmd, zone), 1,
ret = blkdev_report_zones(dev->bdev, dmz_start_sect(zmd, zone), 1,
dmz_update_zone_cb, zone);
memalloc_noio_restore(noio_flag);
if (ret == 0)
ret = -EIO;
if (ret < 0) {
dmz_dev_err(zmd->dev, "Get zone %u report failed",
dmz_dev_err(dev, "Get zone %u report failed",
zone->id);
dmz_check_bdev(zmd->dev);
dmz_check_bdev(dev);
return ret;
}
......@@ -1343,6 +1344,7 @@ static int dmz_update_zone(struct dmz_metadata *zmd, struct dm_zone *zone)
static int dmz_handle_seq_write_err(struct dmz_metadata *zmd,
struct dm_zone *zone)
{
struct dmz_dev *dev = dmz_zone_to_dev(zmd, zone);
unsigned int wp = 0;
int ret;
......@@ -1351,7 +1353,7 @@ static int dmz_handle_seq_write_err(struct dmz_metadata *zmd,
if (ret)
return ret;
dmz_dev_warn(zmd->dev, "Processing zone %u write error (zone wp %u/%u)",
dmz_dev_warn(dev, "Processing zone %u write error (zone wp %u/%u)",
zone->id, zone->wp_block, wp);
if (zone->wp_block < wp) {
......@@ -1384,7 +1386,7 @@ static int dmz_reset_zone(struct dmz_metadata *zmd, struct dm_zone *zone)
return 0;
if (!dmz_is_empty(zone) || dmz_seq_write_err(zone)) {
struct dmz_dev *dev = zmd->dev;
struct dmz_dev *dev = dmz_zone_to_dev(zmd, zone);
ret = blkdev_zone_mgmt(dev->bdev, REQ_OP_ZONE_RESET,
dmz_start_sect(zmd, zone),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment