diff options
author | Joseph Fernandes <josferna@redhat.com> | 2015-11-26 12:42:17 +0530 |
---|---|---|
committer | Dan Lambright <dlambrig@redhat.com> | 2015-12-06 13:00:31 -0800 |
commit | ec13d5063763cdee3fe3bb372d6c2bd01734a839 (patch) | |
tree | 830c57bdcc7ee6ba431f276b57ad080327466bb9 | |
parent | dec1430602f825a6625c473baeb22d0bbf0a059b (diff) |
tier/tier: Ignoring status of already migrated files
Ignore the status of already migrated files and in the
process don't count.
Backport http://review.gluster.org/12758
> Change-Id: Idba6402508d51a4285ac96742c6edf797ee51b6a
> BUG: 1276141
> Signed-off-by: Joseph Fernandes <josferna@redhat.com>
> Reviewed-on: http://review.gluster.org/12758
> Tested-by: Gluster Build System <jenkins@build.gluster.com>
> Reviewed-by: Dan Lambright <dlambrig@redhat.com>
> Tested-by: Dan Lambright <dlambrig@redhat.com>
Signed-off-by: Joseph Fernandes <josferna@redhat.com>
Change-Id: I44b7b965ecbc34159c2233af1a74762fd410dcaf
BUG: 1262860
Reviewed-on: http://review.gluster.org/12884
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Dan Lambright <dlambrig@redhat.com>
Tested-by: Dan Lambright <dlambrig@redhat.com>
-rw-r--r-- | xlators/cluster/dht/src/tier.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c index 0a4ccb23d2a..ce21332a89e 100644 --- a/xlators/cluster/dht/src/tier.c +++ b/xlators/cluster/dht/src/tier.c @@ -430,20 +430,24 @@ tier_migrate_using_query_file (void *_args) /* * Do not promote/demote if file already is where it * should be. It means another brick moved the file - * so is not an error. + * so is not an error. So we set per_link_status = 1 + * so that we ignore counting this. */ src_subvol = dht_subvol_get_cached (this, loc.inode); - if (src_subvol == NULL) + if (src_subvol == NULL) { + per_link_status = 1; goto abort; - + } if (query_cbk_args->is_promotion && src_subvol == conf->subvolumes[1]) { + per_link_status = 1; goto abort; } if (!query_cbk_args->is_promotion && src_subvol == conf->subvolumes[0]) { + per_link_status = 1; goto abort; } @@ -515,14 +519,16 @@ tier_migrate_using_query_file (void *_args) defrag->tier_conf.blocks_total; pthread_mutex_unlock (&dm_stat_mutex); } + total_files++; abort: GF_FREE ((char *) loc.name); loc.name = NULL; loc_wipe (&loc); loc_wipe (&p_loc); - if ((++total_files > defrag->tier_conf.max_migrate_files) || - (total_migrated_bytes > defrag->tier_conf.max_migrate_bytes)) { + if ((total_files > defrag->tier_conf.max_migrate_files) + || (total_migrated_bytes > + defrag->tier_conf.max_migrate_bytes)) { gf_msg (this->name, GF_LOG_INFO, 0, DHT_MSG_LOG_TIER_STATUS, "Reached cycle migration limit." @@ -544,6 +550,11 @@ per_file_out: pthread_mutex_unlock (&dm_stat_mutex); } else if (per_file_status == 1) {/* Ignore */ per_file_status = 0; + /* Since this attempt was ignored we + * decreement the lookup count*/ + pthread_mutex_lock (&dm_stat_mutex); + defrag->num_files_lookedup--; + pthread_mutex_unlock (&dm_stat_mutex); } total_status = total_status + per_file_status; per_link_status = 0; |