diff options
author | Anand V. Avati <avati@gluster.com> | 2009-03-09 16:16:02 +0530 |
---|---|---|
committer | Anand V. Avati <avati@amp.gluster.com> | 2009-03-09 17:40:35 +0530 |
commit | fdfdd7cf05b7378c879917acb9129d69a407aee9 (patch) | |
tree | 059910ef4d232cf66251dac977415bc79d899332 | |
parent | 5e4e99f4c1aa09b9e323c6fd23fcc3517447a6d7 (diff) |
dht_readdir_cbk - retry on same subvol if no entries match the hash
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
-rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index cd29786e7..6d97f8f7a 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -2041,7 +2041,8 @@ dht_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_dirent_t *entry = NULL; call_frame_t *prev = NULL; xlator_t *subvol = NULL; - xlator_t *next = NULL; + xlator_t *next_subvol = NULL; + off_t next_offset = 0; dht_layout_t *layout = NULL; int count = 0; @@ -2077,19 +2078,28 @@ dht_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, list_add_tail (&entry->list, &entries.list); count++; } + next_offset = orig_entry->d_off; } op_ret = count; done: if (count == 0) { - next = dht_subvol_next (this, prev->this); - if (!next) { + /* non-zero next_offset means that + EOF is not yet hit on the current subvol + */ + if (next_offset == 0) { + next_subvol = dht_subvol_next (this, prev->this); + } else { + next_subvol = prev->this; + } + + if (!next_subvol) { goto unwind; } STACK_WIND (frame, dht_readdir_cbk, - next, next->fops->readdir, - local->fd, local->size, 0); + next_subvol, next_subvol->fops->readdir, + local->fd, local->size, next_offset); return 0; } |