diff options
author | Krishnan Parthasarathi <kp@gluster.com> | 2012-02-21 16:28:13 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-01-23 09:17:00 -0800 |
commit | 1ab086d8630687985fb412f4093a53d3e3e9aca1 (patch) | |
tree | b69575ac19b190081cfaa92270fcb53ffab5a3c7 /xlators/cluster/afr/src/afr.h | |
parent | 91ac9f97417790f439702c0297bca953ece597c8 (diff) |
afr: Modified book-keeping structures for entrylks
* There are upto 3 entry lockees that may be needed to perform
entrylk'ing in posix dir-write operations.
* For eg, rmdir ("/a/b") needs to acquire locks on two entities,
- entrylk ("/a", "b")
- entrylk ("/a/b", null)
* Changed existing entrylk/rename/selfheal (entrylk) transactions
to use the new book-keeping structures
* Fixed few issues in afr_trace_entry_lk{in,out} functions. Tracing is now
aware of the new entry lockee structure.
Implementation notes:
* Changed 'cookie' sent in stack_wind to encode lockee_entity_no
and subvol_no.
cookie is a non-negative integer such that 0 <= cookie < replica_count,
When more than one lock is being acquired across the subvolumes,
cookie % replica_count gives the subvol_no
cookie / replica_count gives the lockee_entity_no.
Change-Id: Idbf41803387a7d59a0f7fcb1453d91cea74da153
BUG: 765564
Signed-off-by: Krishnan Parthasarathi <kp@gluster.com>
Reviewed-on: http://review.gluster.org/2828
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr.h')
-rw-r--r-- | xlators/cluster/afr/src/afr.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index a9c06370445..d31290fbf40 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -29,6 +29,8 @@ #define AFR_PATHINFO_HEADER "REPLICATE:" #define AFR_SH_READDIR_SIZE_KEY "self-heal-readdir-size" +#define AFR_LOCKEE_COUNT_MAX 3 + struct _pump_private; typedef int (*afr_expunge_done_cbk_t) (call_frame_t *frame, xlator_t *this, @@ -342,11 +344,24 @@ afr_index_for_transaction_type (afr_transaction_type type) return -1; /* make gcc happy */ } +typedef struct { + loc_t loc; + char *basename; + unsigned char *locked_nodes; + int locked_count; + +} afr_entry_lockee_t; + +int +afr_entry_lockee_cmp (const void *l1, const void *l2); typedef struct { loc_t *lk_loc; struct gf_flock lk_flock; + int lockee_count; + afr_entry_lockee_t lockee[AFR_LOCKEE_COUNT_MAX]; + const char *lk_basename; const char *lower_basename; const char *higher_basename; @@ -356,7 +371,6 @@ typedef struct { unsigned char *locked_nodes; unsigned char *lower_locked_nodes; unsigned char *inode_locked_nodes; - unsigned char *entry_locked_nodes; selfheal_lk_type_t selfheal_lk_type; transaction_lk_type_t transaction_lk_type; @@ -752,6 +766,13 @@ int32_t afr_notify (xlator_t *this, int32_t event, void *data, void *data2); int +afr_init_entry_lockee (afr_entry_lockee_t *lockee, afr_local_t *local, + loc_t *loc, char *basename, int child_count); + +void +afr_entry_lockee_cleanup (afr_internal_lock_t *int_lock); + +int afr_attempt_lock_recovery (xlator_t *this, int32_t child_index); int |