From ec13d5063763cdee3fe3bb372d6c2bd01734a839 Mon Sep 17 00:00:00 2001 From: Joseph Fernandes Date: Thu, 26 Nov 2015 12:42:17 +0530 Subject: 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 > Reviewed-on: http://review.gluster.org/12758 > Tested-by: Gluster Build System > Reviewed-by: Dan Lambright > Tested-by: Dan Lambright Signed-off-by: Joseph Fernandes Change-Id: I44b7b965ecbc34159c2233af1a74762fd410dcaf BUG: 1262860 Reviewed-on: http://review.gluster.org/12884 Tested-by: Gluster Build System Reviewed-by: Dan Lambright Tested-by: Dan Lambright --- xlators/cluster/dht/src/tier.c | 21 ++++++++++++++++----- 1 file 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; -- cgit