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

dm zoned: start reclaim with sequential zones

Sequential zones perform better for reclaim, so start off using
them and only use random zones as a fallback when cache zones are
present.
Signed-off-by: default avatarHannes Reinecke <hare@suse.de>
Reviewed-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent 90a9b869
......@@ -281,15 +281,16 @@ static int dmz_reclaim_rnd_data(struct dmz_reclaim *zrc, struct dm_zone *dzone)
struct dm_zone *szone = NULL;
struct dmz_metadata *zmd = zrc->metadata;
int ret;
int alloc_flags = dmz_nr_cache_zones(zmd) ?
DMZ_ALLOC_RND : DMZ_ALLOC_SEQ;
int alloc_flags = DMZ_ALLOC_SEQ;
/* Always use sequential zones to reclaim random zones */
if (dmz_is_rnd(dzone))
alloc_flags = DMZ_ALLOC_SEQ;
/* Get a free random or sequential zone */
dmz_lock_map(zmd);
again:
szone = dmz_alloc_zone(zmd, alloc_flags | DMZ_ALLOC_RECLAIM);
if (!szone && alloc_flags == DMZ_ALLOC_SEQ && dmz_nr_cache_zones(zmd)) {
alloc_flags = DMZ_ALLOC_RND;
goto again;
}
dmz_unlock_map(zmd);
if (!szone)
return -ENOSPC;
......
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