Thread (24 messages) 24 messages, 10 authors, 2023-10-01

Re: [PATCH 87/87] fs: move i_blocks up a few places in struct inode

From: Amir Goldstein <amir73il@gmail.com>
Date: 2023-09-28 11:35:35
Also in: autofs, bpf, ceph-devel, gfs2, linux-btrfs, linux-cifs, linux-efi, linux-ext4, linux-f2fs-devel, linux-fsdevel, linux-hardening, linux-mm, linux-nfs, linux-rdma, linux-s390, linux-security-module, linux-serial, linux-um, linux-unionfs, linux-usb, linux-xfs, linuxppc-dev, lkml, netdev, ntfs3, ocfs2-devel, platform-driver-x86, selinux, v9fs

On Thu, Sep 28, 2023 at 2:06 PM Jeff Layton [off-list ref] wrote:
The recent change to use discrete integers instead of struct timespec64
in struct inode shaved 8 bytes off of it, but it also moves the i_lock
into the previous cacheline, away from the fields that it protects.

Move i_blocks up above the i_lock, which moves the new 4 byte hole to
just after the timestamps, without changing the size of the structure.
Instead of creating an implicit hole, can you please move i_generation
to fill the 4 bytes hole.

It makes sense in the same cache line with i_ino and I could
use the vacant 4 bytes hole above i_fsnotify_mask to expand the
mask to 64bit (the 32bit event mask space is running out).

Thanks,
Amir.
quoted hunk ↗ jump to hunk
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 include/linux/fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index de902ff2938b..3e0fe0f52e7c 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -677,11 +677,11 @@ struct inode {
        u32                     i_atime_nsec;
        u32                     i_mtime_nsec;
        u32                     i_ctime_nsec;
+       blkcnt_t                i_blocks;
        spinlock_t              i_lock; /* i_blocks, i_bytes, maybe i_size */
        unsigned short          i_bytes;
        u8                      i_blkbits;
        u8                      i_write_hint;
-       blkcnt_t                i_blocks;

 #ifdef __NEED_I_SIZE_ORDERED
        seqcount_t              i_size_seqcount;
--
2.41.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help