summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix
diff options
context:
space:
mode:
authorPurna Pavan Chandra Aekkaladevi <paekkala@redhat.com>2019-10-30 12:42:16 +0530
committerSunny Kumar <sunkumar@redhat.com>2020-03-09 14:31:38 +0000
commitc12a7d9bdc3887c4ed43f76a3c7886727a62d0bc (patch)
tree23c9ad286feae9cdc9bda0b8973f7a0d13d31477 /xlators/storage/posix
parent547fa5bbe5b3438d981de50ac5b2497683a4d9e2 (diff)
Posix: structs re-aligned and manual padding added
All the structs present inside xlators/storage/posix have been re-aligned into memory efficient way. Manual padding has been added to remove compile time padding. 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: Ie72c02810803eae29fca435c71aa131a1315b8a8 Updates: bz#1754448 Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkala@redhat.com>
Diffstat (limited to 'xlators/storage/posix')
-rw-r--r--xlators/storage/posix/src/posix-metadata.h6
-rw-r--r--xlators/storage/posix/src/posix.h90
2 files changed, 52 insertions, 44 deletions
diff --git a/xlators/storage/posix/src/posix-metadata.h b/xlators/storage/posix/src/posix-metadata.h
index 63e8771..d37014a 100644
--- a/xlators/storage/posix/src/posix-metadata.h
+++ b/xlators/storage/posix/src/posix-metadata.h
@@ -15,13 +15,15 @@
/* In memory representation posix metadata xattr */
typedef struct {
- /* version of structure, bumped up if any new member is added */
- uint8_t version;
/* flags indicates valid fields in the structure */
uint64_t flags;
struct timespec ctime;
struct timespec mtime;
struct timespec atime;
+ /* version of structure, bumped up if any new member is added */
+ uint8_t version;
+
+ char _pad[7]; /* manual padding */
} posix_mdata_t;
typedef struct {
diff --git a/xlators/storage/posix/src/posix.h b/xlators/storage/posix/src/posix.h
index 7893a9b..359b838 100644
--- a/xlators/storage/posix/src/posix.h
+++ b/xlators/storage/posix/src/posix.h
@@ -119,12 +119,14 @@
*/
struct posix_fd {
- int fd; /* fd returned by the kernel */
- int32_t flags; /* flags for open/creat */
- DIR *dir; /* handle returned by the kernel */
- off_t dir_eof; /* offset at dir EOF */
- int odirect;
+ int fd; /* fd returned by the kernel */
+ int32_t flags; /* flags for open/creat */
+ DIR *dir; /* handle returned by the kernel */
+ off_t dir_eof; /* offset at dir EOF */
struct list_head list; /* to add to the janitor list */
+ int odirect;
+
+ char _pad[4]; /* manual padding */
};
struct posix_private {
@@ -141,30 +143,9 @@ struct posix_private {
struct timeval init_time;
time_t last_landfill_check;
- int32_t janitor_sleep_duration;
gf_atomic_t read_value; /* Total read, from init */
gf_atomic_t write_value; /* Total write, from init */
- /*
- In some cases, two exported volumes may reside on the same
- partition on the server. Sending statvfs info for both
- the volumes will lead to erroneous df output at the client,
- since free space on the partition will be counted twice.
-
- In such cases, user can disable exporting statvfs info
- on one of the volumes by setting this option.
- */
- gf_boolean_t export_statfs;
-
- gf_boolean_t o_direct; /* always open files in O_DIRECT mode */
-
- /*
- decide whether posix_unlink does open (file), unlink (file), close (fd)
- instead of just unlink (file). with the former approach there is no
- lockout of access to parent directory during removal of very large files
- for the entire duration of freeing of data blocks.
- */
- gf_boolean_t background_unlink;
/* janitor task which cleans up /.trash (created by replicate) */
struct gf_tw_timer_list *janitor;
@@ -178,17 +159,11 @@ struct posix_private {
/* uuid of glusterd that swapned the brick process */
uuid_t glusterd_uuid;
- gf_boolean_t aio_configured;
- gf_boolean_t aio_init_done;
- gf_boolean_t aio_capable;
#ifdef HAVE_LIBAIO
io_context_t ctxp;
pthread_t aiothread;
#endif
- /* node-uuid in pathinfo xattr */
- gf_boolean_t node_uuid_pathinfo;
-
pthread_t fsyncer;
struct list_head fsyncs;
pthread_mutex_t fsync_mutex;
@@ -196,6 +171,7 @@ struct posix_private {
pthread_mutex_t janitor_mutex;
pthread_cond_t janitor_cond;
int fsync_queue_count;
+ int32_t janitor_sleep_duration;
enum {
BATCH_NONE = 0,
@@ -206,8 +182,6 @@ struct posix_private {
} batch_fsync_mode;
uint32_t batch_fsync_delay_usec;
- gf_boolean_t update_pgfid_nlinks;
- gf_boolean_t gfid2path;
char gfid2path_sep[8];
/* seconds to sleep between health checks */
@@ -215,13 +189,10 @@ struct posix_private {
/* seconds to sleep to wait for aio write finish for health checks */
uint32_t health_check_timeout;
pthread_t health_check;
- gf_boolean_t health_check_active;
double disk_reserve;
- char disk_unit;
- uint32_t disk_space_full;
pthread_t disk_space_check;
- gf_boolean_t disk_space_check_active;
+ uint32_t disk_space_full;
#ifdef GF_DARWIN_HOST_OS
enum {
@@ -236,9 +207,6 @@ struct posix_private {
same backend. Very much usable in brick-splitting feature. */
int32_t shared_brick_count;
- /* This option is used for either to call a landfill_purge or not */
- gf_boolean_t disable_landfill_purge;
-
/*Option to set mode bit permission that will always be set on
file/directory. */
mode_t force_create_mode;
@@ -247,9 +215,45 @@ struct posix_private {
mode_t create_directory_mask;
uint32_t max_hardlinks;
+ /* This option is used for either to call a landfill_purge or not */
+ gf_boolean_t disable_landfill_purge;
+
gf_boolean_t fips_mode_rchecksum;
gf_boolean_t ctime;
gf_boolean_t janitor_task_stop;
+
+ gf_boolean_t disk_space_check_active;
+ char disk_unit;
+ gf_boolean_t health_check_active;
+ gf_boolean_t update_pgfid_nlinks;
+ gf_boolean_t gfid2path;
+ /* node-uuid in pathinfo xattr */
+ gf_boolean_t node_uuid_pathinfo;
+ /*
+ In some cases, two exported volumes may reside on the same
+ partition on the server. Sending statvfs info for both
+ the volumes will lead to erroneous df output at the client,
+ since free space on the partition will be counted twice.
+
+ In such cases, user can disable exporting statvfs info
+ on one of the volumes by setting this option.
+ */
+ gf_boolean_t export_statfs;
+
+ gf_boolean_t o_direct; /* always open files in O_DIRECT mode */
+
+ /*
+ decide whether posix_unlink does open (file), unlink (file), close (fd)
+ instead of just unlink (file). with the former approach there is no
+ lockout of access to parent directory during removal of very large files
+ for the entire duration of freeing of data blocks.
+ */
+ gf_boolean_t background_unlink;
+ gf_boolean_t aio_configured;
+ gf_boolean_t aio_init_done;
+ gf_boolean_t aio_capable;
+
+ char _pad[4]; /* manual padding */
};
typedef struct {
@@ -263,9 +267,11 @@ typedef struct {
fd_t *fd;
int fdnum;
int flags;
- int32_t op_errno;
char *list;
size_t list_size;
+ int32_t op_errno;
+
+ char _pad[4]; /* manual padding */
} posix_xattr_filler_t;
typedef struct {