diff options
Diffstat (limited to 'xlators/features/locks/src')
-rw-r--r-- | xlators/features/locks/src/clear.h | 58 | ||||
-rw-r--r-- | xlators/features/locks/src/common.h | 174 | ||||
-rw-r--r-- | xlators/features/locks/src/locks-mem-types.h | 23 | ||||
-rw-r--r-- | xlators/features/locks/src/locks.h | 297 | ||||
-rw-r--r-- | xlators/features/locks/src/pl-messages.h | 7 |
5 files changed, 282 insertions, 277 deletions
diff --git a/xlators/features/locks/src/clear.h b/xlators/features/locks/src/clear.h index 78fc5ae3398..08662746f98 100644 --- a/xlators/features/locks/src/clear.h +++ b/xlators/features/locks/src/clear.h @@ -16,56 +16,56 @@ #include "locks.h" typedef enum { - CLRLK_INODE, - CLRLK_ENTRY, - CLRLK_POSIX, - CLRLK_TYPE_MAX + CLRLK_INODE, + CLRLK_ENTRY, + CLRLK_POSIX, + CLRLK_TYPE_MAX } clrlk_type; typedef enum { - CLRLK_BLOCKED = 1, - CLRLK_GRANTED, - CLRLK_ALL, - CLRLK_KIND_MAX + CLRLK_BLOCKED = 1, + CLRLK_GRANTED, + CLRLK_ALL, + CLRLK_KIND_MAX } clrlk_kind; typedef enum { - KW_TYPE, - KW_KIND, - /*add new keywords here*/ - KW_MAX + KW_TYPE, + KW_KIND, + /*add new keywords here*/ + KW_MAX } clrlk_opts; struct _clrlk_args; typedef struct _clrlk_args clrlk_args; struct _clrlk_args { - int type; - int kind; - char *opts; + int type; + int kind; + char *opts; }; int -clrlk_get__kind (char *kind); +clrlk_get__kind(char *kind); int -clrlk_get_type (char *type); +clrlk_get_type(char *type); int -clrlk_get_lock_range (char *range_str, struct gf_flock *ulock, - gf_boolean_t *chk_range); +clrlk_get_lock_range(char *range_str, struct gf_flock *ulock, + gf_boolean_t *chk_range); int -clrlk_parse_args (const char* cmd, clrlk_args *args); +clrlk_parse_args(const char *cmd, clrlk_args *args); int -clrlk_clear_posixlk (xlator_t *this, pl_inode_t *pl_inode, clrlk_args *args, - int *blkd, int *granted, int *op_errno); +clrlk_clear_posixlk(xlator_t *this, pl_inode_t *pl_inode, clrlk_args *args, + int *blkd, int *granted, int *op_errno); int -clrlk_clear_inodelk (xlator_t *this, pl_inode_t *pl_inode, pl_dom_list_t *dom, - clrlk_args *args, int *blkd, int *granted, int *op_errno); +clrlk_clear_inodelk(xlator_t *this, pl_inode_t *pl_inode, pl_dom_list_t *dom, + clrlk_args *args, int *blkd, int *granted, int *op_errno); int -clrlk_clear_entrylk (xlator_t *this, pl_inode_t *pl_inode, pl_dom_list_t *dom, - clrlk_args *args, int *blkd, int *granted, int *op_errno); +clrlk_clear_entrylk(xlator_t *this, pl_inode_t *pl_inode, pl_dom_list_t *dom, + clrlk_args *args, int *blkd, int *granted, int *op_errno); int -clrlk_clear_lks_in_all_domains (xlator_t *this, pl_inode_t *pl_inode, - clrlk_args *args, int *blkd, int *granted, - int *op_errno); +clrlk_clear_lks_in_all_domains(xlator_t *this, pl_inode_t *pl_inode, + clrlk_args *args, int *blkd, int *granted, + int *op_errno); #endif /* __CLEAR_H__ */ diff --git a/xlators/features/locks/src/common.h b/xlators/features/locks/src/common.h index 50c156feb38..c3d0e361933 100644 --- a/xlators/features/locks/src/common.h +++ b/xlators/features/locks/src/common.h @@ -12,163 +12,173 @@ #include "lkowner.h" /*dump locks format strings */ -#define RANGE_FMT "type=%s, whence=%hd, start=%llu, len=%llu" -#define ENTRY_FMT "type=%s on basename=%s" -#define DUMP_GEN_FMT "pid = %llu, owner=%s, client=%p" -#define GRNTD_AT "granted at %s" -#define BLKD_AT "blocked at %s" -#define CONN_ID "connection-id=%s" -#define DUMP_BLKD_FMT DUMP_GEN_FMT", "CONN_ID", "BLKD_AT -#define DUMP_GRNTD_FMT DUMP_GEN_FMT", "CONN_ID", "GRNTD_AT -#define DUMP_BLKD_GRNTD_FMT DUMP_GEN_FMT", "CONN_ID", "BLKD_AT", "GRNTD_AT - -#define ENTRY_BLKD_FMT ENTRY_FMT", "DUMP_BLKD_FMT -#define ENTRY_GRNTD_FMT ENTRY_FMT", "DUMP_GRNTD_FMT -#define ENTRY_BLKD_GRNTD_FMT ENTRY_FMT", "DUMP_BLKD_GRNTD_FMT - -#define RANGE_BLKD_FMT RANGE_FMT", "DUMP_BLKD_FMT -#define RANGE_GRNTD_FMT RANGE_FMT", "DUMP_GRNTD_FMT -#define RANGE_BLKD_GRNTD_FMT RANGE_FMT", "DUMP_BLKD_GRNTD_FMT +#define RANGE_FMT "type=%s, whence=%hd, start=%llu, len=%llu" +#define ENTRY_FMT "type=%s on basename=%s" +#define DUMP_GEN_FMT "pid = %llu, owner=%s, client=%p" +#define GRNTD_AT "granted at %s" +#define BLKD_AT "blocked at %s" +#define CONN_ID "connection-id=%s" +#define DUMP_BLKD_FMT DUMP_GEN_FMT ", " CONN_ID ", " BLKD_AT +#define DUMP_GRNTD_FMT DUMP_GEN_FMT ", " CONN_ID ", " GRNTD_AT +#define DUMP_BLKD_GRNTD_FMT DUMP_GEN_FMT ", " CONN_ID ", " BLKD_AT ", " GRNTD_AT + +#define ENTRY_BLKD_FMT ENTRY_FMT ", " DUMP_BLKD_FMT +#define ENTRY_GRNTD_FMT ENTRY_FMT ", " DUMP_GRNTD_FMT +#define ENTRY_BLKD_GRNTD_FMT ENTRY_FMT ", " DUMP_BLKD_GRNTD_FMT + +#define RANGE_BLKD_FMT RANGE_FMT ", " DUMP_BLKD_FMT +#define RANGE_GRNTD_FMT RANGE_FMT ", " DUMP_GRNTD_FMT +#define RANGE_BLKD_GRNTD_FMT RANGE_FMT ", " DUMP_BLKD_GRNTD_FMT #define SET_FLOCK_PID(flock, lock) ((flock)->l_pid = lock->client_pid) - posix_lock_t * -new_posix_lock (struct gf_flock *flock, client_t *client, pid_t client_pid, - gf_lkowner_t *owner, fd_t *fd, uint32_t lk_flags, - int can_block); +new_posix_lock(struct gf_flock *flock, client_t *client, pid_t client_pid, + gf_lkowner_t *owner, fd_t *fd, uint32_t lk_flags, int can_block); pl_inode_t * -pl_inode_get (xlator_t *this, inode_t *inode); +pl_inode_get(xlator_t *this, inode_t *inode); posix_lock_t * -pl_getlk (pl_inode_t *inode, posix_lock_t *lock); +pl_getlk(pl_inode_t *inode, posix_lock_t *lock); int -pl_setlk (xlator_t *this, pl_inode_t *inode, posix_lock_t *lock, - int can_block); +pl_setlk(xlator_t *this, pl_inode_t *inode, posix_lock_t *lock, int can_block); void -grant_blocked_locks (xlator_t *this, pl_inode_t *inode); +grant_blocked_locks(xlator_t *this, pl_inode_t *inode); void -posix_lock_to_flock (posix_lock_t *lock, struct gf_flock *flock); +posix_lock_to_flock(posix_lock_t *lock, struct gf_flock *flock); int -locks_overlap (posix_lock_t *l1, posix_lock_t *l2); +locks_overlap(posix_lock_t *l1, posix_lock_t *l2); int -same_owner (posix_lock_t *l1, posix_lock_t *l2); +same_owner(posix_lock_t *l1, posix_lock_t *l2); -void __delete_lock (posix_lock_t *); +void +__delete_lock(posix_lock_t *); -void __destroy_lock (posix_lock_t *); +void +__destroy_lock(posix_lock_t *); pl_dom_list_t * -get_domain (pl_inode_t *pl_inode, const char *volume); +get_domain(pl_inode_t *pl_inode, const char *volume); void -grant_blocked_inode_locks (xlator_t *this, pl_inode_t *pl_inode, - pl_dom_list_t *dom, struct timespec *now, - struct list_head *contend); +grant_blocked_inode_locks(xlator_t *this, pl_inode_t *pl_inode, + pl_dom_list_t *dom, struct timespec *now, + struct list_head *contend); void -inodelk_contention_notify (xlator_t *this, struct list_head *contend); +inodelk_contention_notify(xlator_t *this, struct list_head *contend); void -__delete_inode_lock (pl_inode_lock_t *lock); +__delete_inode_lock(pl_inode_lock_t *lock); void -__pl_inodelk_unref (pl_inode_lock_t *lock); +__pl_inodelk_unref(pl_inode_lock_t *lock); void -grant_blocked_entry_locks (xlator_t *this, pl_inode_t *pl_inode, - pl_dom_list_t *dom, struct timespec *now, - struct list_head *contend); +grant_blocked_entry_locks(xlator_t *this, pl_inode_t *pl_inode, + pl_dom_list_t *dom, struct timespec *now, + struct list_head *contend); void -entrylk_contention_notify (xlator_t *this, struct list_head *contend); +entrylk_contention_notify(xlator_t *this, struct list_head *contend); -void pl_update_refkeeper (xlator_t *this, inode_t *inode); +void +pl_update_refkeeper(xlator_t *this, inode_t *inode); int32_t -__get_inodelk_count (xlator_t *this, pl_inode_t *pl_inode, char *domname); +__get_inodelk_count(xlator_t *this, pl_inode_t *pl_inode, char *domname); int32_t -get_inodelk_count (xlator_t *this, inode_t *inode, char *domname); +get_inodelk_count(xlator_t *this, inode_t *inode, char *domname); int32_t -__get_entrylk_count (xlator_t *this, pl_inode_t *pl_inode); +__get_entrylk_count(xlator_t *this, pl_inode_t *pl_inode); int32_t -get_entrylk_count (xlator_t *this, inode_t *inode); +get_entrylk_count(xlator_t *this, inode_t *inode); -void pl_trace_in (xlator_t *this, call_frame_t *frame, fd_t *fd, loc_t *loc, - int cmd, struct gf_flock *flock, const char *domain); +void +pl_trace_in(xlator_t *this, call_frame_t *frame, fd_t *fd, loc_t *loc, int cmd, + struct gf_flock *flock, const char *domain); -void pl_trace_out (xlator_t *this, call_frame_t *frame, fd_t *fd, loc_t *loc, - int cmd, struct gf_flock *flock, int op_ret, int op_errno, const char *domain); +void +pl_trace_out(xlator_t *this, call_frame_t *frame, fd_t *fd, loc_t *loc, int cmd, + struct gf_flock *flock, int op_ret, int op_errno, + const char *domain); -void pl_trace_block (xlator_t *this, call_frame_t *frame, fd_t *fd, loc_t *loc, - int cmd, struct gf_flock *flock, const char *domain); +void +pl_trace_block(xlator_t *this, call_frame_t *frame, fd_t *fd, loc_t *loc, + int cmd, struct gf_flock *flock, const char *domain); -void pl_trace_flush (xlator_t *this, call_frame_t *frame, fd_t *fd); +void +pl_trace_flush(xlator_t *this, call_frame_t *frame, fd_t *fd); -void entrylk_trace_in (xlator_t *this, call_frame_t *frame, const char *volume, - fd_t *fd, loc_t *loc, const char *basename, - entrylk_cmd cmd, entrylk_type type); +void +entrylk_trace_in(xlator_t *this, call_frame_t *frame, const char *volume, + fd_t *fd, loc_t *loc, const char *basename, entrylk_cmd cmd, + entrylk_type type); -void entrylk_trace_out (xlator_t *this, call_frame_t *frame, const char *volume, - fd_t *fd, loc_t *loc, const char *basename, - entrylk_cmd cmd, entrylk_type type, - int op_ret, int op_errno); +void +entrylk_trace_out(xlator_t *this, call_frame_t *frame, const char *volume, + fd_t *fd, loc_t *loc, const char *basename, entrylk_cmd cmd, + entrylk_type type, int op_ret, int op_errno); -void entrylk_trace_block (xlator_t *this, call_frame_t *frame, const char *volume, - fd_t *fd, loc_t *loc, const char *basename, - entrylk_cmd cmd, entrylk_type type); +void +entrylk_trace_block(xlator_t *this, call_frame_t *frame, const char *volume, + fd_t *fd, loc_t *loc, const char *basename, entrylk_cmd cmd, + entrylk_type type); void -pl_print_verdict (char *str, int size, int op_ret, int op_errno); +pl_print_verdict(char *str, int size, int op_ret, int op_errno); void -pl_print_lockee (char *str, int size, fd_t *fd, loc_t *loc); +pl_print_lockee(char *str, int size, fd_t *fd, loc_t *loc); void -pl_print_locker (char *str, int size, xlator_t *this, call_frame_t *frame); +pl_print_locker(char *str, int size, xlator_t *this, call_frame_t *frame); void -pl_print_inodelk (char *str, int size, int cmd, struct gf_flock *flock, const char *domain); +pl_print_inodelk(char *str, int size, int cmd, struct gf_flock *flock, + const char *domain); void -pl_trace_release (xlator_t *this, fd_t *fd); +pl_trace_release(xlator_t *this, fd_t *fd); unsigned long -fd_to_fdnum (fd_t *fd); +fd_to_fdnum(fd_t *fd); fd_t * -fd_from_fdnum (posix_lock_t *lock); +fd_from_fdnum(posix_lock_t *lock); int -pl_reserve_setlk (xlator_t *this, pl_inode_t *pl_inode, posix_lock_t *lock, - int can_block); +pl_reserve_setlk(xlator_t *this, pl_inode_t *pl_inode, posix_lock_t *lock, + int can_block); int -reservelks_equal (posix_lock_t *l1, posix_lock_t *l2); +reservelks_equal(posix_lock_t *l1, posix_lock_t *l2); int -pl_verify_reservelk (xlator_t *this, pl_inode_t *pl_inode, - posix_lock_t *lock, int can_block); +pl_verify_reservelk(xlator_t *this, pl_inode_t *pl_inode, posix_lock_t *lock, + int can_block); int -pl_reserve_unlock (xlator_t *this, pl_inode_t *pl_inode, posix_lock_t *reqlock); +pl_reserve_unlock(xlator_t *this, pl_inode_t *pl_inode, posix_lock_t *reqlock); int32_t -check_entrylk_on_basename (xlator_t *this, inode_t *parent, char *basename); +check_entrylk_on_basename(xlator_t *this, inode_t *parent, char *basename); -void __pl_inodelk_unref (pl_inode_lock_t *lock); -void __pl_entrylk_unref (pl_entry_lock_t *lock); +void +__pl_inodelk_unref(pl_inode_lock_t *lock); +void +__pl_entrylk_unref(pl_entry_lock_t *lock); int -pl_metalock_is_active (pl_inode_t *pl_inode); +pl_metalock_is_active(pl_inode_t *pl_inode); int -__pl_queue_lock (pl_inode_t *pl_inode, posix_lock_t *reqlock, int can_block); +__pl_queue_lock(pl_inode_t *pl_inode, posix_lock_t *reqlock, int can_block); gf_boolean_t pl_does_monkey_want_stuck_lock(); diff --git a/xlators/features/locks/src/locks-mem-types.h b/xlators/features/locks/src/locks-mem-types.h index a48b35c2044..240c1957a42 100644 --- a/xlators/features/locks/src/locks-mem-types.h +++ b/xlators/features/locks/src/locks-mem-types.h @@ -14,17 +14,16 @@ #include "mem-types.h" enum gf_locks_mem_types_ { - gf_locks_mt_pl_dom_list_t = gf_common_mt_end + 1, - gf_locks_mt_pl_inode_t, - gf_locks_mt_posix_lock_t, - gf_locks_mt_pl_entry_lock_t, - gf_locks_mt_pl_inode_lock_t, - gf_locks_mt_truncate_ops, - gf_locks_mt_pl_rw_req_t, - gf_locks_mt_posix_locks_private_t, - gf_locks_mt_pl_fdctx_t, - gf_locks_mt_pl_meta_lock_t, - gf_locks_mt_end + gf_locks_mt_pl_dom_list_t = gf_common_mt_end + 1, + gf_locks_mt_pl_inode_t, + gf_locks_mt_posix_lock_t, + gf_locks_mt_pl_entry_lock_t, + gf_locks_mt_pl_inode_lock_t, + gf_locks_mt_truncate_ops, + gf_locks_mt_pl_rw_req_t, + gf_locks_mt_posix_locks_private_t, + gf_locks_mt_pl_fdctx_t, + gf_locks_mt_pl_meta_lock_t, + gf_locks_mt_end }; #endif - diff --git a/xlators/features/locks/src/locks.h b/xlators/features/locks/src/locks.h index e9b75fb3f13..cf2849fc251 100644 --- a/xlators/features/locks/src/locks.h +++ b/xlators/features/locks/src/locks.h @@ -19,234 +19,233 @@ #include "lkowner.h" typedef enum { - MLK_NONE, - MLK_FILE_BASED, - MLK_FORCED, - MLK_OPTIMAL + MLK_NONE, + MLK_FILE_BASED, + MLK_FORCED, + MLK_OPTIMAL } mlk_mode_t; /* defines different mandatory locking modes*/ struct __pl_fd; struct __posix_lock { - struct list_head list; + struct list_head list; - short fl_type; - off_t fl_start; - off_t fl_end; - uint32_t lk_flags; + short fl_type; + off_t fl_start; + off_t fl_end; + uint32_t lk_flags; - short blocked; /* waiting to acquire */ - struct gf_flock user_flock; /* the flock supplied by the user */ - xlator_t *this; /* required for blocked locks */ - unsigned long fd_num; + short blocked; /* waiting to acquire */ + struct gf_flock user_flock; /* the flock supplied by the user */ + xlator_t *this; /* required for blocked locks */ + unsigned long fd_num; - fd_t *fd; - call_frame_t *frame; + fd_t *fd; + call_frame_t *frame; - struct timeval blkd_time; /*time at which lock was queued into blkd list*/ - struct timeval granted_time; /*time at which lock was queued into active list*/ + struct timeval blkd_time; /*time at which lock was queued into blkd list*/ + struct timeval + granted_time; /*time at which lock was queued into active list*/ - /* These two together serve to uniquely identify each process - across nodes */ + /* These two together serve to uniquely identify each process + across nodes */ - void *client; /* to identify client node */ + void *client; /* to identify client node */ - /* This field uniquely identifies the client the lock belongs to. As - * lock migration is handled by rebalance, the client_t object will be - * overwritten by rebalance and can't be deemed as the owner of the - * lock on destination. Hence, the below field is migrated from - * source to destination by lock_migration_info_t and updated on the - * destination. So that on client-server disconnection, server can - * cleanup the locks proper;y. */ + /* This field uniquely identifies the client the lock belongs to. As + * lock migration is handled by rebalance, the client_t object will be + * overwritten by rebalance and can't be deemed as the owner of the + * lock on destination. Hence, the below field is migrated from + * source to destination by lock_migration_info_t and updated on the + * destination. So that on client-server disconnection, server can + * cleanup the locks proper;y. */ - char *client_uid; - gf_lkowner_t owner; - pid_t client_pid; /* pid of client process */ + char *client_uid; + gf_lkowner_t owner; + pid_t client_pid; /* pid of client process */ - int blocking; + int blocking; }; typedef struct __posix_lock posix_lock_t; struct __pl_inode_lock { - struct list_head list; - struct list_head blocked_locks; /* list_head pointing to blocked_inodelks */ - struct list_head contend; /* list of contending locks */ - int ref; + struct list_head list; + struct list_head blocked_locks; /* list_head pointing to blocked_inodelks */ + struct list_head contend; /* list of contending locks */ + int ref; - short fl_type; - off_t fl_start; - off_t fl_end; + short fl_type; + off_t fl_start; + off_t fl_end; - const char *volume; + const char *volume; - struct gf_flock user_flock; /* the flock supplied by the user */ - xlator_t *this; /* required for blocked locks */ - struct __pl_inode *pl_inode; + struct gf_flock user_flock; /* the flock supplied by the user */ + xlator_t *this; /* required for blocked locks */ + struct __pl_inode *pl_inode; - call_frame_t *frame; + call_frame_t *frame; - struct timeval blkd_time; /*time at which lock was queued into blkd list*/ - struct timeval granted_time; /*time at which lock was queued into active list*/ - /*last time at which lock contention was detected and notified*/ - struct timespec contention_time; + struct timeval blkd_time; /*time at which lock was queued into blkd list*/ + struct timeval + granted_time; /*time at which lock was queued into active list*/ + /*last time at which lock contention was detected and notified*/ + struct timespec contention_time; - /* These two together serve to uniquely identify each process - across nodes */ + /* These two together serve to uniquely identify each process + across nodes */ - void *client; /* to identify client node */ - gf_lkowner_t owner; - pid_t client_pid; /* pid of client process */ + void *client; /* to identify client node */ + gf_lkowner_t owner; + pid_t client_pid; /* pid of client process */ - char *connection_id; /* stores the client connection id */ + char *connection_id; /* stores the client connection id */ - struct list_head client_list; /* list of all locks from a client */ + struct list_head client_list; /* list of all locks from a client */ }; typedef struct __pl_inode_lock pl_inode_lock_t; struct _pl_rw_req { - struct list_head list; - call_stub_t *stub; - posix_lock_t region; + struct list_head list; + call_stub_t *stub; + posix_lock_t region; }; typedef struct _pl_rw_req pl_rw_req_t; struct _pl_dom_list { - struct list_head inode_list; /* list_head back to pl_inode_t */ - const char *domain; - struct list_head entrylk_list; /* List of entry locks */ - struct list_head blocked_entrylks; /* List of all blocked entrylks */ - struct list_head inodelk_list; /* List of inode locks */ - struct list_head blocked_inodelks; /* List of all blocked inodelks */ + struct list_head inode_list; /* list_head back to pl_inode_t */ + const char *domain; + struct list_head entrylk_list; /* List of entry locks */ + struct list_head blocked_entrylks; /* List of all blocked entrylks */ + struct list_head inodelk_list; /* List of inode locks */ + struct list_head blocked_inodelks; /* List of all blocked inodelks */ }; typedef struct _pl_dom_list pl_dom_list_t; struct __entry_lock { - struct list_head domain_list; /* list_head back to pl_dom_list_t */ - struct list_head blocked_locks; /* list_head back to blocked_entrylks */ - struct list_head contend; /* list of contending locks */ - int ref; + struct list_head domain_list; /* list_head back to pl_dom_list_t */ + struct list_head blocked_locks; /* list_head back to blocked_entrylks */ + struct list_head contend; /* list of contending locks */ + int ref; - call_frame_t *frame; - xlator_t *this; - struct __pl_inode *pinode; + call_frame_t *frame; + xlator_t *this; + struct __pl_inode *pinode; - const char *volume; + const char *volume; - const char *basename; - entrylk_type type; + const char *basename; + entrylk_type type; - struct timeval blkd_time; /*time at which lock was queued into blkd list*/ - struct timeval granted_time; /*time at which lock was queued into active list*/ - /*last time at which lock contention was detected and notified*/ - struct timespec contention_time; + struct timeval blkd_time; /*time at which lock was queued into blkd list*/ + struct timeval + granted_time; /*time at which lock was queued into active list*/ + /*last time at which lock contention was detected and notified*/ + struct timespec contention_time; - void *client; - gf_lkowner_t owner; - pid_t client_pid; /* pid of client process */ + void *client; + gf_lkowner_t owner; + pid_t client_pid; /* pid of client process */ - char *connection_id; /* stores the client connection id */ + char *connection_id; /* stores the client connection id */ - struct list_head client_list; /* list of all locks from a client */ + struct list_head client_list; /* list of all locks from a client */ }; typedef struct __entry_lock pl_entry_lock_t; - /* The "simulated" inode. This contains a list of all the locks associated with this file */ struct __pl_inode { - pthread_mutex_t mutex; - - struct list_head dom_list; /* list of domains */ - struct list_head ext_list; /* list of fcntl locks */ - struct list_head rw_list; /* list of waiting r/w requests */ - struct list_head reservelk_list; /* list of reservelks */ - struct list_head blocked_reservelks; /* list of blocked reservelks */ - struct list_head blocked_calls; /* List of blocked lock calls while a reserve is held*/ - struct list_head metalk_list; /* Meta lock list */ - /* This is to store the incoming lock - requests while meta lock is enabled */ - struct list_head queued_locks; - int mandatory; /* if mandatory locking is enabled */ - - inode_t *refkeeper; /* hold refs on an inode while locks are - held to prevent pruning */ - uuid_t gfid; /* placeholder for gfid of the inode */ - inode_t *inode; /* pointer to be used for ref and unref - of inode_t as long as there are - locks on it */ - gf_boolean_t migrated; + pthread_mutex_t mutex; + + struct list_head dom_list; /* list of domains */ + struct list_head ext_list; /* list of fcntl locks */ + struct list_head rw_list; /* list of waiting r/w requests */ + struct list_head reservelk_list; /* list of reservelks */ + struct list_head blocked_reservelks; /* list of blocked reservelks */ + struct list_head + blocked_calls; /* List of blocked lock calls while a reserve is held*/ + struct list_head metalk_list; /* Meta lock list */ + /* This is to store the incoming lock + requests while meta lock is enabled */ + struct list_head queued_locks; + int mandatory; /* if mandatory locking is enabled */ + + inode_t *refkeeper; /* hold refs on an inode while locks are + held to prevent pruning */ + uuid_t gfid; /* placeholder for gfid of the inode */ + inode_t *inode; /* pointer to be used for ref and unref + of inode_t as long as there are + locks on it */ + gf_boolean_t migrated; }; typedef struct __pl_inode pl_inode_t; struct __pl_metalk { - pthread_mutex_t mutex; - /* For pl_inode meta lock list */ - struct list_head list; - /* For pl_ctx_t list */ - struct list_head client_list; - char *client_uid; - - pl_inode_t *pl_inode; - int ref; + pthread_mutex_t mutex; + /* For pl_inode meta lock list */ + struct list_head list; + /* For pl_ctx_t list */ + struct list_head client_list; + char *client_uid; + + pl_inode_t *pl_inode; + int ref; }; typedef struct __pl_metalk pl_meta_lock_t; typedef struct { - mlk_mode_t mandatory_mode; /* holds current mandatory locking mode */ - gf_boolean_t trace; /* trace lock requests in and out */ - char *brickname; - gf_boolean_t monkey_unlocking; - uint32_t revocation_secs; - gf_boolean_t revocation_clear_all; - uint32_t revocation_max_blocked; - gf_boolean_t notify_contention; - uint32_t notify_contention_delay; + mlk_mode_t mandatory_mode; /* holds current mandatory locking mode */ + gf_boolean_t trace; /* trace lock requests in and out */ + char *brickname; + gf_boolean_t monkey_unlocking; + uint32_t revocation_secs; + gf_boolean_t revocation_clear_all; + uint32_t revocation_max_blocked; + gf_boolean_t notify_contention; + uint32_t notify_contention_delay; } posix_locks_private_t; - typedef struct { - gf_boolean_t entrylk_count_req; - gf_boolean_t inodelk_count_req; - gf_boolean_t posixlk_count_req; - gf_boolean_t parent_entrylk_req; - data_t *inodelk_dom_count_req; - - dict_t *xdata; - loc_t loc[2]; - fd_t *fd; - off_t offset; - glusterfs_fop_t op; + gf_boolean_t entrylk_count_req; + gf_boolean_t inodelk_count_req; + gf_boolean_t posixlk_count_req; + gf_boolean_t parent_entrylk_req; + data_t *inodelk_dom_count_req; + + dict_t *xdata; + loc_t loc[2]; + fd_t *fd; + off_t offset; + glusterfs_fop_t op; } pl_local_t; - typedef struct { - struct list_head locks_list; + struct list_head locks_list; } pl_fdctx_t; - struct _locker { - struct list_head lockers; - char *volume; - inode_t *inode; - gf_lkowner_t owner; + struct list_head lockers; + char *volume; + inode_t *inode; + gf_lkowner_t owner; }; typedef struct _locks_ctx { - pthread_mutex_t lock; - struct list_head inodelk_lockers; - struct list_head entrylk_lockers; - struct list_head metalk_list; + pthread_mutex_t lock; + struct list_head inodelk_lockers; + struct list_head entrylk_lockers; + struct list_head metalk_list; } pl_ctx_t; - pl_ctx_t * -pl_ctx_get (client_t *client, xlator_t *xlator); +pl_ctx_get(client_t *client, xlator_t *xlator); int -pl_inodelk_client_cleanup (xlator_t *this, pl_ctx_t *ctx); +pl_inodelk_client_cleanup(xlator_t *this, pl_ctx_t *ctx); int -pl_entrylk_client_cleanup (xlator_t *this, pl_ctx_t *ctx); +pl_entrylk_client_cleanup(xlator_t *this, pl_ctx_t *ctx); #endif /* __POSIX_LOCKS_H__ */ diff --git a/xlators/features/locks/src/pl-messages.h b/xlators/features/locks/src/pl-messages.h index e5a276f35b5..a99e1bbce43 100644 --- a/xlators/features/locks/src/pl-messages.h +++ b/xlators/features/locks/src/pl-messages.h @@ -23,10 +23,7 @@ * glfs-message-id.h. */ -GLFS_MSGID(PL, - PL_MSG_LOCK_NUMBER, - PL_MSG_INODELK_CONTENTION_FAILED, - PL_MSG_ENTRYLK_CONTENTION_FAILED -); +GLFS_MSGID(PL, PL_MSG_LOCK_NUMBER, PL_MSG_INODELK_CONTENTION_FAILED, + PL_MSG_ENTRYLK_CONTENTION_FAILED); #endif /* !_PL_MESSAGES_H_ */ |