summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/dht-selfheal.c
diff options
context:
space:
mode:
authorkrishna <krishna@guest-laptop>2009-02-26 06:11:48 -0800
committerAnand V. Avati <avati@amp.gluster.com>2009-02-26 19:46:23 +0530
commit431617ef19244272797106f2356ef31591e9c7b9 (patch)
treeb24cea1d5709514a79b91340fb2902a388e00ace /xlators/cluster/dht/src/dht-selfheal.c
parentc445012fa990be5dbc0ccbace04187484ccd92f3 (diff)
Layout is sorted on volume names before forming the layout ranges. But when anomalies are to be detected layout is sorted based on "start" of the range (done in the selfheal during lookup).
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'xlators/cluster/dht/src/dht-selfheal.c')
-rw-r--r--xlators/cluster/dht/src/dht-selfheal.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c
index 7bb22b1a7..45c9586cf 100644
--- a/xlators/cluster/dht/src/dht-selfheal.c
+++ b/xlators/cluster/dht/src/dht-selfheal.c
@@ -287,7 +287,8 @@ dht_selfheal_layout_new_directory (call_frame_t *frame, loc_t *loc,
for (i = 0; i < layout->cnt; i++) {
err = layout->list[i].err;
- if (err == -1) {
+ if (err == -1 || err == 0) {
+ layout->list[i].err = -1;
cnt++;
}
}
@@ -328,6 +329,7 @@ dht_selfheal_dir_getafix (call_frame_t *frame, loc_t *loc,
int holes = -1;
int ret = -1;
int i = -1;
+ int overlaps = -1;
this = frame->this;
conf = this->private;
@@ -336,6 +338,7 @@ dht_selfheal_dir_getafix (call_frame_t *frame, loc_t *loc,
missing = local->selfheal.missing;
down = local->selfheal.down;
holes = local->selfheal.hole_cnt;
+ overlaps = local->selfheal.overlaps_cnt;
if ((missing + down) == conf->subvolume_cnt) {
dht_selfheal_layout_new_directory (frame, loc, layout);
@@ -347,6 +350,11 @@ dht_selfheal_dir_getafix (call_frame_t *frame, loc_t *loc,
ret = 0;
}
+ if (holes || missing || overlaps) {
+ dht_selfheal_layout_new_directory (frame, loc, layout);
+ ret = 0;
+ }
+
for (i = 0; i < layout->cnt; i++) {
/* directory not present */
if (layout->list[i].err == ENOENT) {
@@ -361,7 +369,8 @@ dht_selfheal_dir_getafix (call_frame_t *frame, loc_t *loc,
}
int
-dht_selfheal_new_directory (call_frame_t *frame, dht_selfheal_dir_cbk_t dir_cbk,
+dht_selfheal_new_directory (call_frame_t *frame,
+ dht_selfheal_dir_cbk_t dir_cbk,
dht_layout_t *layout)
{
dht_local_t *local = NULL;
@@ -371,6 +380,7 @@ dht_selfheal_new_directory (call_frame_t *frame, dht_selfheal_dir_cbk_t dir_cbk,
local->selfheal.dir_cbk = dir_cbk;
local->selfheal.layout = layout;
+ dht_layout_sort_volname (layout);
dht_selfheal_layout_new_directory (frame, &local->loc, layout);
dht_selfheal_dir_xattr (frame, &local->loc, layout);
return 0;
@@ -390,7 +400,6 @@ dht_selfheal_directory (call_frame_t *frame, dht_selfheal_dir_cbk_t dir_cbk,
int ret = 0;
xlator_t *this = NULL;
-
local = frame->local;
this = frame->this;
@@ -441,6 +450,7 @@ dht_selfheal_directory (call_frame_t *frame, dht_selfheal_dir_cbk_t dir_cbk,
goto sorry_no_fix;
}
*/
+ dht_layout_sort_volname (layout);
ret = dht_selfheal_dir_getafix (frame, loc, layout);
if (ret == -1) {