summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr.h
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2018-03-22 17:55:15 +0530
committerRavishankar N <ravishankar@redhat.com>2018-03-29 13:07:04 +0530
commitc87bd439ef12adc70dc580e75304121c3cd38e9a (patch)
tree725e6038e2c821fb1ddf9c3ce0f75ee6a399ec42 /xlators/cluster/afr/src/afr.h
parent89577d8b0ad7bd1ee2cec2f0e047591b1cd0f7b8 (diff)
afr: add new value for read-hash-mode volume option
Updates: #363 This new value (3) will try to wind read requests to the child of AFR having the least amount of pending requests in its queue. Change-Id: If6bda2aac9bf7aec3fc39622f78659313c4b6508 Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr.h')
-rw-r--r--xlators/cluster/afr/src/afr.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h
index b2f3af136bd..129670517f3 100644
--- a/xlators/cluster/afr/src/afr.h
+++ b/xlators/cluster/afr/src/afr.h
@@ -113,6 +113,7 @@ typedef struct _afr_private {
gf_boolean_t metadata_splitbrain_forced_heal; /* on/off */
int read_child; /* read-subvolume */
unsigned int hash_mode; /* for when read_child is not set */
+ gf_atomic_t *pending_reads; /*No. of pending read cbks per child.*/
int favorite_child; /* subvolume to be preferred in resolving
split-brain cases */
@@ -425,6 +426,8 @@ typedef struct _afr_local {
unsigned char *readable;
unsigned char *readable2; /*For rename transaction*/
+ int read_subvol; /* Current read subvolume */
+
afr_inode_refresh_cbk_t refreshfn;
/* @refreshinode:
@@ -974,6 +977,8 @@ afr_cleanup_fd_ctx (xlator_t *this, fd_t *fd);
__this = frame->this; \
afr_handle_inconsistent_fop (frame, &__op_ret,\
&__op_errno);\
+ if (__local && __local->is_read_txn) \
+ afr_pending_read_decrement (__this->private, __local->read_subvol); \
frame->local = NULL; \
} \
\