diff options
author | Joseph Fernandes <josferna@redhat.com> | 2015-11-26 12:42:17 +0530 |
---|---|---|
committer | Dan Lambright <dlambrig@redhat.com> | 2015-12-03 20:52:43 -0800 |
commit | be377d4bed954fc8cdbc515329882c1fd0f7ab37 (patch) | |
tree | 9dc12943804019d16d63da280108a29decc0b2e1 | |
parent | 976d2902cb191a738853279c8b81ee3721f515b6 (diff) |
tier/tier: Ignoring status of already migrated files
Ignore the status of already migrated files and in the
process don't count.
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>
-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 8d134f2a770..3943e6fd33d 100644 --- a/xlators/cluster/dht/src/tier.c +++ b/xlators/cluster/dht/src/tier.c @@ -426,20 +426,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; } @@ -511,14 +515,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." @@ -540,6 +546,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; |