From c87bd439ef12adc70dc580e75304121c3cd38e9a Mon Sep 17 00:00:00 2001 From: Ravishankar N Date: Thu, 22 Mar 2018 17:55:15 +0530 Subject: 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 --- xlators/cluster/afr/src/afr.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'xlators/cluster/afr/src/afr.h') 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; \ } \ \ -- cgit