diff options
author | Hannes Reinecke <hare@suse.de> | 2020-05-19 11:14:22 +0300 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2020-05-21 00:09:51 +0300 |
commit | c5c7885952927384837a070793698d996cb0fbf3 (patch) | |
tree | d057a5f1d6525c8b3a13912f0b707b92f982f68b | |
parent | 90a9b8693f1b84a695864f2b416cba9bde107268 (diff) | |
download | linux-c5c7885952927384837a070793698d996cb0fbf3.tar.xz |
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: Hannes Reinecke <hare@suse.de>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
-rw-r--r-- | drivers/md/dm-zoned-reclaim.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/md/dm-zoned-reclaim.c b/drivers/md/dm-zoned-reclaim.c index bd62245d4556..d62f6890b92c 100644 --- a/drivers/md/dm-zoned-reclaim.c +++ b/drivers/md/dm-zoned-reclaim.c @@ -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; |