diff options
Diffstat (limited to 'xlators/features/leases/src/leases.h')
| -rw-r--r-- | xlators/features/leases/src/leases.h | 65 |
1 files changed, 38 insertions, 27 deletions
diff --git a/xlators/features/leases/src/leases.h b/xlators/features/leases/src/leases.h index d5fc451289d..a6e8a6824cc 100644 --- a/xlators/features/leases/src/leases.h +++ b/xlators/features/leases/src/leases.h @@ -16,15 +16,15 @@ #include "config.h" #endif -#include "common-utils.h" -#include "glusterfs.h" -#include "xlator.h" -#include "call-stub.h" -#include "logging.h" -#include "client_t.h" -#include "lkowner.h" -#include "locking.h" -#include "upcall-utils.h" +#include <glusterfs/common-utils.h> +#include <glusterfs/glusterfs.h> +#include <glusterfs/xlator.h> +#include <glusterfs/call-stub.h> +#include <glusterfs/logging.h> +#include <glusterfs/client_t.h> +#include <glusterfs/lkowner.h> +#include <glusterfs/locking.h> +#include <glusterfs/upcall-utils.h> #include "timer-wheel.h" #include "leases-mem-types.h" #include "leases-messages.h" @@ -45,6 +45,14 @@ goto label; \ } while (0) +#define EXIT_IF_INTERNAL_FOP(frame, xdata, label) \ + do { \ + if (frame->root->pid < 0) \ + goto label; \ + if (xdata && dict_get(xdata, GLUSTERFS_INTERNAL_FOP_KEY)) \ + goto label; \ + } while (0) + #define GET_LEASE_ID(xdata, lease_id, client_uid) \ do { \ int ret_val = -1; \ @@ -144,17 +152,19 @@ } while (0) struct _leases_private { - gf_boolean_t leases_enabled; - int32_t recall_lease_timeout; struct list_head client_list; struct list_head recall_list; struct tvec_base *timer_wheel; /* timer wheel where the recall request is qued and waits for unlock/expiry */ - gf_boolean_t fini; pthread_t recall_thr; - gf_boolean_t inited_recall_thr; pthread_mutex_t mutex; pthread_cond_t cond; + int32_t recall_lease_timeout; + gf_boolean_t inited_recall_thr; + gf_boolean_t fini; + gf_boolean_t leases_enabled; + + char _pad[1]; /* manual padding */ }; typedef struct _leases_private leases_private_t; @@ -181,17 +191,20 @@ typedef struct _lease_fd_ctx lease_fd_ctx_t; struct _lease_inode_ctx { struct list_head lease_id_list; /* clients that have taken leases */ int lease_type_cnt[GF_LEASE_MAX_TYPE + 1]; - int lease_type; /* Types of leases acquired */ - uint64_t lease_cnt; /* Total number of leases on this inode */ - uint64_t openfd_cnt; /* number of fds open */ - gf_boolean_t recall_in_progress; /* if lease recall is sent on this inode */ - struct list_head blocked_list; /* List of fops blocked until the - lease recall is complete */ - inode_t *inode; /* this represents the inode on which the - lock was taken, required mainly during - disconnect cleanup */ + uint64_t lease_cnt; /* Total number of leases on this inode */ + uint64_t openfd_cnt; /* number of fds open */ + struct list_head blocked_list; /* List of fops blocked until the + lease recall is complete */ + inode_t *inode; /* this represents the inode on which the + lock was taken, required mainly during + disconnect cleanup */ struct gf_tw_timer_list *timer; pthread_mutex_t lock; + int lease_type; /* Types of leases acquired */ + gf_boolean_t recall_in_progress; /* if lease recall is sent on this inode */ + gf_boolean_t blocked_fops_resuming; /* if blocked fops are being resumed */ + + char _pad[2]; /* manual padding */ }; typedef struct _lease_inode_ctx lease_inode_ctx_t; @@ -201,11 +214,12 @@ struct _lease_id_entry { char *client_uid; /* uid of the client that has taken the lease */ int lease_type_cnt[GF_LEASE_MAX_TYPE + 1]; /* count of each lease type */ - int lease_type; /* Union of all the leases taken - under the given lease id */ uint64_t lease_cnt; /* Number of leases taken under the given lease id */ time_t recall_time; /* time @ which recall was sent */ + int lease_type; /* Union of all the leases taken + under the given lease id */ + char _pad[4]; /* manual padding */ }; typedef struct _lease_id_entry lease_id_entry_t; @@ -225,9 +239,6 @@ typedef struct __lease_timer_data lease_timer_data_t; gf_boolean_t is_leases_enabled(xlator_t *this); -int32_t -get_recall_lease_timeout(xlator_t *this); - lease_inode_ctx_t * lease_ctx_get(inode_t *inode, xlator_t *this); |
