summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorPurna Pavan Chandra Aekkaladevi <paekkala@redhat.com>2019-10-25 11:28:00 +0530
committersoumya k <skoduri@redhat.com>2020-01-09 06:36:37 +0000
commit8d55951efe744f6da36f5b61c5be5a8bd77dc426 (patch)
tree5963860f92ba7c131b648102c676b3626bbb5f21 /xlators
parentb49f5e217fe958517464a84d0cc4b766d99fc42b (diff)
leases: re-alignment of structures
All the structs present inside xlators/features/leases have been re-aligned into memory efficient way. Changes are made in such a way that every members are 8 byte aligned and no padding is left out in the 8 byte line. Manual padding has been added to remove compile time padding (which happens at the end of the struct). This manual padding is for development and debugging benefits. It lets to use -Wpadded option and raise warnings from the remaining structs where compile time padding happens. Change-Id: I083d2de80e24f363c97adadcba64825e213050fc Updates: bz#1754448 Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkala@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/features/leases/src/leases.h35
1 files changed, 20 insertions, 15 deletions
diff --git a/xlators/features/leases/src/leases.h b/xlators/features/leases/src/leases.h
index 57368fac1d9..a6e8a6824cc 100644
--- a/xlators/features/leases/src/leases.h
+++ b/xlators/features/leases/src/leases.h
@@ -152,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;
@@ -189,18 +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];
+ 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 */
- 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 */
gf_boolean_t blocked_fops_resuming; /* if blocked fops are being resumed */
- 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;
+
+ char _pad[2]; /* manual padding */
};
typedef struct _lease_inode_ctx lease_inode_ctx_t;
@@ -210,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;