ceph: reorder fields in 'struct ceph_snapid_map'
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Thu, 27 Apr 2023 18:05:42 +0000 (20:05 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Sun, 30 Apr 2023 10:37:28 +0000 (12:37 +0200)
Group some variables based on their sizes to reduce holes.
On x86_64, this shrinks the size of 'struct ceph_snapid_map' from 72 to 64
bytes.

When such a structure is allocated, because of the way memory allocation
works, when 72 bytes were requested, 96 bytes were allocated.

So, on x86_64, this change saves 32 bytes per allocation and has the
structure fit in a single cacheline.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/mds_client.h

index 18b026b1ac63feb68fefc2519877e1b702f881de..724307ff89cd96e9e8f1e2ff0a61f714c315c357 100644 (file)
@@ -355,8 +355,8 @@ struct ceph_snapid_map {
        struct rb_node node;
        struct list_head lru;
        atomic_t ref;
-       u64 snap;
        dev_t dev;
+       u64 snap;
        unsigned long last_used;
 };