summaryrefslogtreecommitdiffstats
path: root/drivers/block/null_blk_zoned.c
diff options
context:
space:
mode:
authorDamien Le Moal <damien.lemoal@wdc.com>2020-11-20 02:55:17 +0100
committerJens Axboe <axboe@kernel.dk>2020-12-08 01:36:03 +0100
commit0ec4d913ac69ec86757eec117fc2733018552aa7 (patch)
treeb30b4a1b492605daed56ecb934045cace5cd41d2 /drivers/block/null_blk_zoned.c
parentnull_blk: cleanup discard handling (diff)
downloadlinux-0ec4d913ac69ec86757eec117fc2733018552aa7.tar.xz
linux-0ec4d913ac69ec86757eec117fc2733018552aa7.zip
null_blk: discard zones on reset
When memory backing is enabled, use null_handle_discard() to free the backing memory used by a zone when the zone is being reset. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/null_blk_zoned.c')
-rw-r--r--drivers/block/null_blk_zoned.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/block/null_blk_zoned.c b/drivers/block/null_blk_zoned.c
index 4dad8748a61d..65464f7559e0 100644
--- a/drivers/block/null_blk_zoned.c
+++ b/drivers/block/null_blk_zoned.c
@@ -588,6 +588,9 @@ static blk_status_t null_reset_zone(struct nullb_device *dev,
null_unlock_zone_res(dev);
+ if (dev->memory_backed)
+ return null_handle_discard(dev, zone->start, zone->len);
+
return BLK_STS_OK;
}