mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-29 22:14:41 +08:00
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>
This commit is contained in:
parent
49c7089f3d
commit
0ec4d913ac
@ -116,6 +116,8 @@ struct nullb {
|
||||
char disk_name[DISK_NAME_LEN];
|
||||
};
|
||||
|
||||
blk_status_t null_handle_discard(struct nullb_device *dev, sector_t sector,
|
||||
sector_t nr_sectors);
|
||||
blk_status_t null_process_cmd(struct nullb_cmd *cmd,
|
||||
enum req_opf op, sector_t sector,
|
||||
unsigned int nr_sectors);
|
||||
|
@ -1076,8 +1076,8 @@ static void nullb_fill_pattern(struct nullb *nullb, struct page *page,
|
||||
kunmap_atomic(dst);
|
||||
}
|
||||
|
||||
static blk_status_t null_handle_discard(struct nullb_device *dev,
|
||||
sector_t sector, sector_t nr_sectors)
|
||||
blk_status_t null_handle_discard(struct nullb_device *dev,
|
||||
sector_t sector, sector_t nr_sectors)
|
||||
{
|
||||
struct nullb *nullb = dev->nullb;
|
||||
size_t n = nr_sectors << SECTOR_SHIFT;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user