summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorHarshavardhana <harsha@harshavardhana.net>2013-09-16 22:36:10 -0700
committerAnand Avati <avati@redhat.com>2013-09-17 16:37:24 -0700
commit215fea41a96479312a5ab8783c13b30ab9fe00fa (patch)
tree31306e0b54815964ea194a05e27609744d211edb /xlators
parent0402c691a9d245e00bd2e4bd100a6d5e591d3433 (diff)
cluster/distribute: Rebalance should also verify free inodes
Currently during `MIGRATE_DATA` we never verified about the total inode usage among new and old bricks. Such checks are available for disk space usage but it is also needed for inodes during data migration. Such a check leads to uniform outcome of file distribution upon rebalance. Patch provides: - Check dst_inodes < src_inodes, a friendly `warning` message to indicate we have to ignore such an attempt - Rename __dht_check_free_space() --> __dht_check_free_space_and_inodes() Change-Id: I7bc4dd8b507883f0fb836300e99f0bb083493f5f BUG: 982919 Signed-off-by: Harshavardhana <harsha@harshavardhana.net> Reviewed-on: http://review.gluster.org/5948 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/dht/src/dht-rebalance.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
index 5300ff2fe7a..c6a8e417721 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -332,8 +332,8 @@ out:
}
static inline int
-__dht_check_free_space (xlator_t *to, xlator_t *from, loc_t *loc,
- struct iatt *stbuf, int flag)
+__dht_check_free_space_and_inodes (xlator_t *to, xlator_t *from, loc_t *loc,
+ struct iatt *stbuf, int flag)
{
struct statvfs src_statfs = {0,};
struct statvfs dst_statfs = {0,};
@@ -379,9 +379,27 @@ __dht_check_free_space (xlator_t *to, xlator_t *from, loc_t *loc,
goto out;
}
+ /* NOTE:
+ For dynamically allocated inode filesystems since we have no
+ awareness on inodes, this logic fits well so that distribute
+ rebalance has nothing to worry about total inodes rather let the
+ files be `rebalanced` on the basis of hashing.
+ */
+ if (dst_statfs.f_files && src_statfs.f_files) {
+ if (dst_statfs.f_ffree < src_statfs.f_ffree) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "data movement attempted from node (%s) with"
+ " plenty free inodes to a node (%s) with "
+ "scanty free inodes (%s)",
+ from->name, to->name, loc->path);
+ ret = 1;
+ goto out;
+ }
+ }
+
check_avail_space:
if (((dst_statfs.f_bavail * dst_statfs.f_bsize) /
- GF_DISK_SECTOR_SIZE) < stbuf->ia_blocks) {
+ GF_DISK_SECTOR_SIZE) < stbuf->ia_blocks) {
gf_log (this->name, GF_LOG_ERROR,
"data movement attempted from node (%s) with "
"to node (%s) which does not have required free space"
@@ -389,7 +407,6 @@ check_avail_space:
ret = 1;
goto out;
}
-
ret = 0;
out:
return ret;
@@ -714,7 +731,7 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
if (ret)
goto out;
- ret = __dht_check_free_space (to, from, loc, &stbuf, flag);
+ ret = __dht_check_free_space_and_inodes (to, from, loc, &stbuf, flag);
if (ret) {
goto out;
}