diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2016-03-17 09:32:17 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2016-04-17 07:11:23 -0700 |
commit | 80fd2a0d8b3da20755a38195f62fc4d7fc5f7b52 (patch) | |
tree | a381f7b6e7459f4f5389d5bd984f51fec65f4065 /xlators/cluster/afr/src/afr-self-heald.c | |
parent | 20300fa96802ec6a0cd17edba38baf9639561d55 (diff) |
cluster/afr: Use parallel dir scan functionality
>BUG: 1221737
>Change-Id: I0ed71a72f0e33bd733723e00a01cf28378c5534e
>Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
>Reviewed-on: http://review.gluster.org/13755
>Reviewed-on: http://review.gluster.org/13992
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
>CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
>Smoke: Gluster Build System <jenkins@build.gluster.com>
>Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
BUG: 1325857
Change-Id: I7c6b2ea065edd7f5dafffeb42fd6c601b4ab8d14
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/14010
Smoke: Gluster Build System <jenkins@build.gluster.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heald.c')
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heald.c | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c index 21b13b7e6fc..d89692d3c61 100644 --- a/xlators/cluster/afr/src/afr-self-heald.c +++ b/xlators/cluster/afr/src/afr-self-heald.c @@ -320,14 +320,18 @@ afr_shd_selfheal (struct subvol_healer *healer, int child, uuid_t gfid) ret = afr_selfheal (this, gfid); - if (ret == -EIO) { - eh = shd->split_brain; - crawl_event->split_brain_count++; - } else if (ret < 0) { - crawl_event->heal_failed_count++; - } else if (ret == 0) { - crawl_event->healed_count++; - } + LOCK (&priv->lock); + { + if (ret == -EIO) { + eh = shd->split_brain; + crawl_event->split_brain_count++; + } else if (ret < 0) { + crawl_event->heal_failed_count++; + } else if (ret == 0) { + crawl_event->healed_count++; + } + } + UNLOCK (&priv->lock); if (eh) { shd_event = GF_CALLOC (1, sizeof(*shd_event), @@ -430,6 +434,7 @@ afr_shd_index_sweep (struct subvol_healer *healer, char *vgfid) afr_private_t *priv = NULL; int ret = 0; xlator_t *subvol = NULL; + dict_t *xdata = NULL; priv = healer->this->private; subvol = priv->children[healer->subvol]; @@ -439,17 +444,28 @@ afr_shd_index_sweep (struct subvol_healer *healer, char *vgfid) gf_msg (healer->this->name, GF_LOG_WARNING, 0, AFR_MSG_INDEX_DIR_GET_FAILED, "unable to get index-dir on %s", subvol->name); - return -errno; + ret = -errno; + goto out; } - ret = syncop_dir_scan (subvol, &loc, GF_CLIENT_PID_SELF_HEALD, - healer, afr_shd_index_heal); + xdata = dict_new (); + if (!xdata || dict_set_int32 (xdata, "get-gfid-type", 1)) { + ret = -ENOMEM; + goto out; + } - loc_wipe (&loc); + ret = syncop_mt_dir_scan (subvol, &loc, GF_CLIENT_PID_SELF_HEALD, + healer, afr_shd_index_heal, xdata, + priv->shd.max_threads, priv->shd.wait_qlength); if (ret == 0) ret = healer->crawl_event.healed_count; +out: + loc_wipe (&loc); + + if (xdata) + dict_unref (xdata); return ret; } |