]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
fs/netfs: reorder struct fields to eliminate holes
authorMax Kellermann <max.kellermann@ionos.com>
Mon, 19 May 2025 13:48:02 +0000 (14:48 +0100)
committerChristian Brauner <brauner@kernel.org>
Wed, 21 May 2025 12:34:37 +0000 (14:34 +0200)
This shrinks `struct netfs_io_stream` from 104 to 96 bytes and `struct
netfs_io_request` from 600 to 576 bytes.

[DH: Modified as the patch to turn netfs_io_request::error into a short
was removed from the set]

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/20250519134813.2975312-7-dhowells@redhat.com
cc: Paulo Alcantara <pc@manguebit.com>
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
include/linux/netfs.h

index 73537dafa2246117365bc56ce991400288a5decb..33f145f7f2c2ca7ff368ab935c3675b63b7735d6 100644 (file)
@@ -144,8 +144,8 @@ struct netfs_io_stream {
        struct netfs_io_subrequest *front;      /* Op being collected */
        unsigned long long      collected_to;   /* Position we've collected results to */
        size_t                  transferred;    /* The amount transferred from this stream */
-       enum netfs_io_source    source;         /* Where to read from/write to */
        unsigned short          error;          /* Aggregate error for the stream */
+       enum netfs_io_source    source;         /* Where to read from/write to */
        unsigned char           stream_nr;      /* Index of stream in parent table */
        bool                    avail;          /* T if stream is available */
        bool                    active;         /* T if stream is active */
@@ -240,19 +240,10 @@ struct netfs_io_request {
        void                    *netfs_priv;    /* Private data for the netfs */
        void                    *netfs_priv2;   /* Private data for the netfs */
        struct bio_vec          *direct_bv;     /* DIO buffer list (when handling iovec-iter) */
-       unsigned int            direct_bv_count; /* Number of elements in direct_bv[] */
-       unsigned int            debug_id;
-       unsigned int            rsize;          /* Maximum read size (0 for none) */
-       unsigned int            wsize;          /* Maximum write size (0 for none) */
-       atomic_t                subreq_counter; /* Next subreq->debug_index */
-       unsigned int            nr_group_rel;   /* Number of refs to release on ->group */
-       spinlock_t              lock;           /* Lock for queuing subreqs */
        unsigned long long      submitted;      /* Amount submitted for I/O so far */
        unsigned long long      len;            /* Length of the request */
        size_t                  transferred;    /* Amount to be indicated as transferred */
        long                    error;          /* 0 or error that occurred */
-       enum netfs_io_origin    origin;         /* Origin of the request */
-       bool                    direct_bv_unpin; /* T if direct_bv[] must be unpinned */
        unsigned long long      i_size;         /* Size of the file */
        unsigned long long      start;          /* Start position */
        atomic64_t              issued_to;      /* Write issuer folio cursor */
@@ -260,7 +251,16 @@ struct netfs_io_request {
        unsigned long long      cleaned_to;     /* Position we've cleaned folios to */
        unsigned long long      abandon_to;     /* Position to abandon folios to */
        pgoff_t                 no_unlock_folio; /* Don't unlock this folio after read */
+       unsigned int            direct_bv_count; /* Number of elements in direct_bv[] */
+       unsigned int            debug_id;
+       unsigned int            rsize;          /* Maximum read size (0 for none) */
+       unsigned int            wsize;          /* Maximum write size (0 for none) */
+       atomic_t                subreq_counter; /* Next subreq->debug_index */
+       unsigned int            nr_group_rel;   /* Number of refs to release on ->group */
+       spinlock_t              lock;           /* Lock for queuing subreqs */
        unsigned char           front_folio_order; /* Order (size) of front folio */
+       enum netfs_io_origin    origin;         /* Origin of the request */
+       bool                    direct_bv_unpin; /* T if direct_bv[] must be unpinned */
        refcount_t              ref;
        unsigned long           flags;
 #define NETFS_RREQ_OFFLOAD_COLLECTION  0       /* Offload collection to workqueue */