From 997acb1d1757c81c31d13b78ce7ff8c7e4665062 Mon Sep 17 00:00:00 2001 From: Christophe Jaillet Date: Sun, 19 Feb 2023 09:15:23 +0000 Subject: Re-order the fields of 'struct apr_finfo_t' to avoid a hole and some padding. On x86_64, this shrinks the size of the struct from 120 to 112 bytes. Before the patch, pahole states that: struct apr_finfo_t { apr_pool_t * pool; /* 0 8 */ apr_int32_t valid; /* 8 4 */ apr_fileperms_t protection; /* 12 4 */ apr_filetype_e filetype; /* 16 4 */ apr_uid_t user; /* 20 4 */ apr_gid_t group; /* 24 4 */ /* XXX 4 bytes hole, try to pack */ apr_ino_t inode; /* 32 8 */ apr_dev_t device; /* 40 8 */ apr_int32_t nlink; /* 48 4 */ /* XXX 4 bytes hole, try to pack */ apr_off_t size; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ apr_off_t csize; /* 64 8 */ apr_time_t atime; /* 72 8 */ apr_time_t mtime; /* 80 8 */ apr_time_t ctime; /* 88 8 */ const char * fname; /* 96 8 */ const char * name; /* 104 8 */ struct apr_file_t * filehand; /* 112 8 */ /* size: 120, cachelines: 2, members: 17 */ /* sum members: 112, holes: 2, sum holes: 8 */ /* last cacheline: 56 bytes */ }; git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1907750 13f79535-47bb-0310-9956-ffa450edef68 --- include/apr_file_info.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/apr_file_info.h b/include/apr_file_info.h index a50ccb367..bff813fa3 100644 --- a/include/apr_file_info.h +++ b/include/apr_file_info.h @@ -188,12 +188,12 @@ struct apr_finfo_t { apr_uid_t user; /** The group id that owns the file */ apr_gid_t group; + /** The number of hard links to the file. */ + apr_int32_t nlink; /** The inode of the file. */ apr_ino_t inode; /** The id of the device the file is on. */ apr_dev_t device; - /** The number of hard links to the file. */ - apr_int32_t nlink; /** The size of the file */ apr_off_t size; /** The storage size consumed by the file */ -- cgit v1.2.1