aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-zoned-metadata.c
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2020-06-02 13:09:53 +0200
committerMike Snitzer <snitzer@redhat.com>2020-06-05 14:59:52 -0400
commit22c1ef66c4cbb82baf81a28abedfe8ad20ad9126 (patch)
treef27512085be637385073999cb414b2dea9d5459e /drivers/md/dm-zoned-metadata.c
parentdm zoned: support arbitrary number of devices (diff)
downloadlinux-dev-22c1ef66c4cbb82baf81a28abedfe8ad20ad9126.tar.xz
linux-dev-22c1ef66c4cbb82baf81a28abedfe8ad20ad9126.zip
dm zoned: allocate zone by device index
When allocating a zone, pass in an indicator on which device the zone should be allocated; this increases performance for a multi-device setup because reclaim will now allocate zones on the device for which reclaim is running. 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 'drivers/md/dm-zoned-metadata.c')
-rw-r--r--drivers/md/dm-zoned-metadata.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/md/dm-zoned-metadata.c b/drivers/md/dm-zoned-metadata.c
index 49bafc86aa9a..1a6cdab3e4ef 100644
--- a/drivers/md/dm-zoned-metadata.c
+++ b/drivers/md/dm-zoned-metadata.c
@@ -2050,7 +2050,7 @@ again:
goto out;
/* Allocate a random zone */
- dzone = dmz_alloc_zone(zmd, alloc_flags);
+ dzone = dmz_alloc_zone(zmd, 0, alloc_flags);
if (!dzone) {
if (dmz_dev_is_dying(zmd)) {
dzone = ERR_PTR(-EIO);
@@ -2156,7 +2156,7 @@ again:
goto out;
/* Allocate a random zone */
- bzone = dmz_alloc_zone(zmd, alloc_flags);
+ bzone = dmz_alloc_zone(zmd, 0, alloc_flags);
if (!bzone) {
if (dmz_dev_is_dying(zmd)) {
bzone = ERR_PTR(-EIO);
@@ -2187,11 +2187,12 @@ out:
* Get an unmapped (free) zone.
* This must be called with the mapping lock held.
*/
-struct dm_zone *dmz_alloc_zone(struct dmz_metadata *zmd, unsigned long flags)
+struct dm_zone *dmz_alloc_zone(struct dmz_metadata *zmd, unsigned int dev_idx,
+ unsigned long flags)
{
struct list_head *list;
struct dm_zone *zone;
- unsigned int dev_idx = 0;
+ int i = 0;
again:
if (flags & DMZ_ALLOC_CACHE)
@@ -2207,8 +2208,12 @@ again:
*/
if (!(flags & DMZ_ALLOC_RECLAIM))
return NULL;
- if (dev_idx < zmd->nr_devs) {
- dev_idx++;
+ /*
+ * Try to allocate from other devices
+ */
+ if (i < zmd->nr_devs) {
+ dev_idx = (dev_idx + 1) % zmd->nr_devs;
+ i++;
goto again;
}