fs/bcachefs/bcachefs_format.h:254:1: warning: alignment 1 of 'struct bkey' is less than 4
kernel test robot
build bottree: https://evilpiepirate.org/git/bcachefs.git bcachefs-testing head: f83873b0f3d124973127c44a3b7c9489d1c9cd57 commit: 9a555a741e807275c320807babd3f42efb8fee90 [109/113] bcachefs: omit alignment attribute on big endian struct bkey config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20240217/[email protected]/config) compiler: m68k-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240217/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
In file included from fs/bcachefs/bcachefs.h:209,
from fs/bcachefs/backpointers.c:2:
>> fs/bcachefs/bcachefs_format.h:254:1: warning: alignment 1 of 'struct bkey' is less than 4 [-Wpacked-not-aligned]
254 | ;
| ^
fs/bcachefs/bcachefs_format.h:221:25: warning: 'version' offset 27 in 'struct bkey' isn't aligned to 4 [-Wpacked-not-aligned]
221 | struct bversion version;
| ^~~~~~~vim +254 fs/bcachefs/bcachefs_format.h
208
209 /* Type of the value */
210 __u8 type;
211
212 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
213 __u8 pad[1];
214
215 struct bversion version;
216 __u32 size; /* extent size, in sectors */
217 struct bpos p;
218 #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
219 struct bpos p;
220 __u32 size; /* extent size, in sectors */
221 struct bversion version;
222
223 __u8 pad[1];
224 #endif
225 } __packed
226 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
227 /*
228 * The big-endian version of bkey can't be compiled by rustc with the "aligned"
229 * attr since it doesn't allow types to have both "packed" and "aligned" attrs.
230 * So for Rust compatibility, don't include this. It can be included in the LE
231 * version because the "packed" attr is redundant in that case.
232 *
233 * History: (quoting Kent)
234 *
235 * Specifically, when i was designing bkey, I wanted the header to be no
236 * bigger than necessary so that bkey_packed could use the rest. That means that
237 * decently offten extent keys will fit into only 8 bytes, instead of spilling over
238 * to 16.
239 *
240 * But packed_bkey treats the part after the header - the packed section -
241 * as a single multi word, variable length integer. And bkey, the unpacked
242 * version, is just a special case version of a bkey_packed; all the packed
243 * bkey code will work on keys in any packed format, the in-memory
244 * representation of an unpacked key also is just one type of packed key...
245 *
246 * So that constrains the key part of a bkig endian bkey to start right
247 * after the header.
248 *
249 * If we ever do a bkey_v2 and need to expand the hedaer by another byte for
250 * some reason - that will clean up this wart.
251 */
252 __aligned(8)
253 #endif
> 254 ;
255
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki