From: David Laight <david.laight.linux@gmail.com>
To: Gao Xiang <hsiangkao@linux.alibaba.com>
Cc: linux-erofs@lists.ozlabs.org, LKML <linux-kernel@vger.kernel.org>,
kernel test robot <lkp@intel.com>
Subject: Re: [PATCH 1/2] erofs: add __packed annotation to union(__le16..)
Date: Wed, 9 Apr 2025 19:52:22 +0100 [thread overview]
Message-ID: <20250409195222.4cadc368@pumpkin> (raw)
In-Reply-To: <20250408114448.4040220-1-hsiangkao@linux.alibaba.com>
On Tue, 8 Apr 2025 19:44:47 +0800
Gao Xiang <hsiangkao@linux.alibaba.com> wrote:
> I'm unsure why they aren't 2 bytes in size only in arm-linux-gnueabi.
IIRC one of the arm ABI aligns structures on 32 bit boundaries.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/r/202504051202.DS7QIknJ-lkp@intel.com
> Fixes: 61ba89b57905 ("erofs: add 48-bit block addressing on-disk support")
> Fixes: efb2aef569b3 ("erofs: add encoded extent on-disk definition")
> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
> ---
> fs/erofs/erofs_fs.h | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/erofs/erofs_fs.h b/fs/erofs/erofs_fs.h
> index 61a5ee11f187..94bf636776b0 100644
> --- a/fs/erofs/erofs_fs.h
> +++ b/fs/erofs/erofs_fs.h
> @@ -56,7 +56,7 @@ struct erofs_super_block {
> union {
> __le16 rootnid_2b; /* nid of root directory */
> __le16 blocks_hi; /* (48BIT on) blocks count MSB */
> - } rb;
> + } __packed rb;
> __le64 inos; /* total valid ino # (== f_files - f_favail) */
> __le64 epoch; /* base seconds used for compact inodes */
> __le32 fixed_nsec; /* fixed nanoseconds for compact inodes */
> @@ -148,7 +148,7 @@ union erofs_inode_i_nb {
> __le16 nlink; /* if EROFS_I_NLINK_1_BIT is unset */
> __le16 blocks_hi; /* total blocks count MSB */
> __le16 startblk_hi; /* starting block number MSB */
> -};
> +} __packed;
That shouldn't be necessary and will kill performance on some systems.
The 'packed' on the member should be enough to reduce the size.
I'd add a compile assert (of some form) on the size of the structure.
David
>
> /* 32-byte reduced form of an ondisk inode */
> struct erofs_inode_compact {
> @@ -369,9 +369,9 @@ struct z_erofs_map_header {
> * bit 7 : pack the whole file into packed inode
> */
> __u8 h_clusterbits;
> - };
> + } __packed;
> __le16 h_extents_hi; /* extent count MSB */
> - };
> + } __packed;
Ditto
> };
>
> enum {
next prev parent reply other threads:[~2025-04-09 18:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-08 11:44 Gao Xiang
2025-04-08 11:44 ` [PATCH 2/2] erofs: fix encoded extents handling Gao Xiang
2025-04-09 18:52 ` David Laight [this message]
2025-04-09 23:56 ` [PATCH 1/2] erofs: add __packed annotation to union(__le16..) Gao Xiang
2025-04-10 20:53 ` David Laight
2025-04-11 2:28 ` Gao Xiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250409195222.4cadc368@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=hsiangkao@linux.alibaba.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®