diff options
author | Krishna Srinivas <krishna@zresearch.com> | 2009-02-19 12:39:04 -0800 |
---|---|---|
committer | Anand V. Avati <avati@amp.gluster.com> | 2009-02-25 17:47:12 +0530 |
commit | 417dfa48df166bfcd3f8a6da56c189de6e7a6aff (patch) | |
tree | 08a6b93b3b6d77cc5fbc519c0f39419416aab884 /xlators | |
parent | 029913bbd62ed7e3c3f436afe92ad6bca9dc642c (diff) |
DHT clean up. Lot of selfheal code is not applicable to newly created directory. Newly created directory will use only relavant part of DHT selfheal code - only for xattr application.
DHT clean up. Lot of selfheal code is not applicable to newly created directory. Newly created directory will use only relavant part of DHT selfheal
code - only for xattr application.
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 9 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-common.h | 3 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-layout.c | 1 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-selfheal.c | 32 |
4 files changed, 33 insertions, 12 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 5e4979e31b0..f121f9f4716 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -573,8 +573,8 @@ dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } inode_ctx_put (inode, this, (uint64_t)(long)layout); - goto out; - } + goto out; + } if (is_linkfile) { subvol = dht_linkfile_subvol (this, inode, stbuf, xattr); @@ -2640,7 +2640,6 @@ dht_mkdir_selfheal_cbk (call_frame_t *frame, void *cookie, return 0; } - int dht_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, inode_t *inode, struct stat *stbuf) @@ -2672,8 +2671,8 @@ unlock: this_call_cnt = dht_frame_return (frame); if (is_last_call (this_call_cnt)) { local->layout = NULL; - dht_selfheal_directory (frame, dht_mkdir_selfheal_cbk, - &local->loc, layout); + dht_selfheal_new_directory (frame, dht_mkdir_selfheal_cbk, + layout); } return 0; diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h index 17017381b08..3b05540e290 100644 --- a/xlators/cluster/dht/src/dht-common.h +++ b/xlators/cluster/dht/src/dht-common.h @@ -204,6 +204,9 @@ int dht_selfheal_directory (call_frame_t *frame, dht_selfheal_dir_cbk_t cbk, loc_t *loc, dht_layout_t *layout); int +dht_selfheal_new_directory (call_frame_t *frame, dht_selfheal_dir_cbk_t cbk, + dht_layout_t *layout); +int dht_selfheal_restore (call_frame_t *frame, dht_selfheal_dir_cbk_t cbk, loc_t *loc, dht_layout_t *layout); diff --git a/xlators/cluster/dht/src/dht-layout.c b/xlators/cluster/dht/src/dht-layout.c index 1ec2e6c2edc..8698df4dc7a 100644 --- a/xlators/cluster/dht/src/dht-layout.c +++ b/xlators/cluster/dht/src/dht-layout.c @@ -196,7 +196,6 @@ dht_disk_layout_merge (xlator_t *this, dht_layout_t *layout, int start_off = 0; int stop_off = 0; - /* TODO: assert disk_layout_ptr is of required length */ cnt = ntoh32 (disk_layout[0]); diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c index ee32b2253ed..7bb22b1a758 100644 --- a/xlators/cluster/dht/src/dht-selfheal.c +++ b/xlators/cluster/dht/src/dht-selfheal.c @@ -159,9 +159,13 @@ dht_selfheal_dir_xattr (call_frame_t *frame, loc_t *loc, dht_layout_t *layout) this = frame->this; for (i = 0; i < layout->cnt; i++) { - if (layout->list[i].err != -1 || !layout->list[i].stop) + if (layout->list[i].err != -1 || !layout->list[i].stop) { + /* err != -1 would mean xattr present on the directory + * or the directory is itself non existant. + * !layout->list[i].stop would mean layout absent + */ continue; - /* attr missing and layout present */ + } missing_xattr++; } @@ -267,8 +271,8 @@ dht_selfheal_dir_mkdir (call_frame_t *frame, loc_t *loc, } void -dht_selfheal_fix_this_virgin (call_frame_t *frame, loc_t *loc, - dht_layout_t *layout) +dht_selfheal_layout_new_directory (call_frame_t *frame, loc_t *loc, + dht_layout_t *layout) { dht_conf_t *conf = NULL; xlator_t *this = NULL; @@ -334,7 +338,7 @@ dht_selfheal_dir_getafix (call_frame_t *frame, loc_t *loc, holes = local->selfheal.hole_cnt; if ((missing + down) == conf->subvolume_cnt) { - dht_selfheal_fix_this_virgin (frame, loc, layout); + dht_selfheal_layout_new_directory (frame, loc, layout); ret = 0; } @@ -356,6 +360,22 @@ dht_selfheal_dir_getafix (call_frame_t *frame, loc_t *loc, return ret; } +int +dht_selfheal_new_directory (call_frame_t *frame, dht_selfheal_dir_cbk_t dir_cbk, + dht_layout_t *layout) +{ + dht_local_t *local = NULL; + + local = frame->local; + + local->selfheal.dir_cbk = dir_cbk; + local->selfheal.layout = layout; + + dht_selfheal_layout_new_directory (frame, &local->loc, layout); + dht_selfheal_dir_xattr (frame, &local->loc, layout); + return 0; +} + int dht_selfheal_directory (call_frame_t *frame, dht_selfheal_dir_cbk_t dir_cbk, @@ -425,7 +445,7 @@ dht_selfheal_directory (call_frame_t *frame, dht_selfheal_dir_cbk_t dir_cbk, if (ret == -1) { gf_log (this->name, GF_LOG_ERROR, - "the directory is not a virgin"); + "not able to form layout for the directory"); goto sorry_no_fix; } |