diff options
author | Hannes Reinecke <hare@suse.de> | 2020-06-02 13:09:55 +0200 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2020-06-05 20:59:54 +0200 |
commit | 2094045fe5b5dda98c4ec6cb1ac7b12ba4382856 (patch) | |
tree | 24dc7f7236bb350bd99a96431cd60e31c83a9c32 /drivers/md/dm-zoned-metadata.c | |
parent | dm zoned: select reclaim zone based on device index (diff) | |
download | linux-2094045fe5b5dda98c4ec6cb1ac7b12ba4382856.tar.xz linux-2094045fe5b5dda98c4ec6cb1ac7b12ba4382856.zip |
dm zoned: prefer full zones for reclaim
Prefer full zones when selecting the next zone for reclaim.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to '')
-rw-r--r-- | drivers/md/dm-zoned-metadata.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/md/dm-zoned-metadata.c b/drivers/md/dm-zoned-metadata.c index 0cb90799b8ce..59a34895f5a8 100644 --- a/drivers/md/dm-zoned-metadata.c +++ b/drivers/md/dm-zoned-metadata.c @@ -1941,7 +1941,7 @@ static struct dm_zone *dmz_get_rnd_zone_for_reclaim(struct dmz_metadata *zmd, unsigned int idx, bool idle) { struct dm_zone *dzone = NULL; - struct dm_zone *zone; + struct dm_zone *zone, *last = NULL; struct list_head *zone_list; /* If we have cache zones select from the cache zone list */ @@ -1958,6 +1958,13 @@ static struct dm_zone *dmz_get_rnd_zone_for_reclaim(struct dmz_metadata *zmd, dzone = zone->bzone; if (dzone->dev->dev_idx != idx) continue; + if (!last) { + last = dzone; + continue; + } + if (last->weight < dzone->weight) + continue; + dzone = last; } else dzone = zone; if (dmz_lock_zone_reclaim(dzone)) |