* [PATCH] fix dir2 shortform structures on ARM old ABI
@ 2008-03-15 3:24 Eric Sandeen
2008-03-15 4:17 ` Josef 'Jeff' Sipek
` (3 more replies)
0 siblings, 4 replies; 47+ messages in thread
From: Eric Sandeen @ 2008-03-15 3:24 UTC (permalink / raw)
To: xfs-oss; +Cc: patches
This should fix the longstanding issues with xfs and old ABI
arm boxes, which lead to various asserts and xfs shutdowns,
and for which an (incorrect) patch has been floating around
for years. (Said patch made ARM internally consistent, but
altered the normal xfs on-disk format such that it looked
corrupted on other architectures):
http://lists.arm.linux.org.uk/lurker/message/20040311.002034.5ecf21a2.html
Old ABI ARM has interesting packing & padding; for example
on ARM old abi:
struct xfs_dir2_sf_entry {
__uint8_t namelen; /* 0 1 */
/* XXX 3 bytes hole, try to pack */
xfs_dir2_sf_off_t offset; /* 4 4 */
__uint8_t name[1]; /* 8 1 */
/* XXX 3 bytes hole, try to pack */
xfs_dir2_inou_t inumber; /* 12 8 */
/* size: 20, cachelines: 1 */
/* sum members: 14, holes: 2, sum holes: 6 */
/* last cacheline: 20 bytes */
};
but on x86:
struct xfs_dir2_sf_entry {
__uint8_t namelen; /* 0 1 */
xfs_dir2_sf_off_t offset; /* 1 2 */
__uint8_t name[1]; /* 3 1 */
xfs_dir2_inou_t inumber; /* 4 8 */
/* size: 12, cachelines: 1 */
/* last cacheline: 12 bytes */
};
... this sort of discrepancy leads to problems.
I've verified this patch by comparing the on-disk structure
layouts using pahole from the dwarves package, as well as
running through a bit of xfsqa under qemu-arm, modified so
that the check/repair phase after each test actually executes
check/repair from the x86 host, on the filesystem populated
by the arm emulator. Thus far it all looks good.
There are 2 other structures with extra padding at the end,
but they don't seem to cause trouble. I suppose they could
be packed as well: xfs_dir2_data_unused_t and xfs_dir2_sf_t.
Note that userspace needs a similar treatment, and any
filesystems which were running with the previous rogue
"fix" will now see corruption (either in the kernel, or
during xfs_repair) with this fix properly in place; it
may be worth teaching xfs_repair to identify and fix that
specific issue.
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---
Index: linux-2.6.24/fs/xfs/linux-2.6/xfs_linux.h
===================================================================
--- linux-2.6.24.orig/fs/xfs/linux-2.6/xfs_linux.h
+++ linux-2.6.24/fs/xfs/linux-2.6/xfs_linux.h
@@ -300,4 +300,11 @@ static inline __uint64_t howmany_64(__ui
return x;
}
+/* ARM old ABI has some weird alignment/padding */
+#if defined(__arm__) && !defined(__ARM_EABI__)
+#define __arch_pack __attribute__((packed))
+#else
+#define __arch_pack
+#endif
+
#endif /* __XFS_LINUX__ */
Index: linux-2.6.24/fs/xfs/xfs_dir2_sf.h
===================================================================
--- linux-2.6.24.orig/fs/xfs/xfs_dir2_sf.h
+++ linux-2.6.24/fs/xfs/xfs_dir2_sf.h
@@ -62,7 +62,7 @@ typedef union {
* Normalized offset (in a data block) of the entry, really xfs_dir2_data_off_t.
* Only need 16 bits, this is the byte offset into the single block form.
*/
-typedef struct { __uint8_t i[2]; } xfs_dir2_sf_off_t;
+typedef struct { __uint8_t i[2]; } __arch_pack xfs_dir2_sf_off_t;
/*
* The parent directory has a dedicated field, and the self-pointer must
@@ -76,14 +76,14 @@ typedef struct xfs_dir2_sf_hdr {
__uint8_t count; /* count of entries */
__uint8_t i8count; /* count of 8-byte inode #s */
xfs_dir2_inou_t parent; /* parent dir inode number */
-} xfs_dir2_sf_hdr_t;
+} __arch_pack xfs_dir2_sf_hdr_t;
typedef struct xfs_dir2_sf_entry {
__uint8_t namelen; /* actual name length */
xfs_dir2_sf_off_t offset; /* saved offset */
__uint8_t name[1]; /* name, variable size */
xfs_dir2_inou_t inumber; /* inode number, var. offset */
-} xfs_dir2_sf_entry_t;
+} __arch_pack xfs_dir2_sf_entry_t;
typedef struct xfs_dir2_sf {
xfs_dir2_sf_hdr_t hdr; /* shortform header */
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-03-15 3:24 Eric Sandeen
@ 2008-03-15 4:17 ` Josef 'Jeff' Sipek
2008-03-15 4:23 ` Eric Sandeen
2008-03-20 3:02 ` Eric Sandeen
` (2 subsequent siblings)
3 siblings, 1 reply; 47+ messages in thread
From: Josef 'Jeff' Sipek @ 2008-03-15 4:17 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs-oss, patches
On Fri, Mar 14, 2008 at 10:24:49PM -0500, Eric Sandeen wrote:
> This should fix the longstanding issues with xfs and old ABI
> arm boxes, which lead to various asserts and xfs shutdowns,
> and for which an (incorrect) patch has been floating around
> for years. (Said patch made ARM internally consistent, but
> altered the normal xfs on-disk format such that it looked
> corrupted on other architectures):
> http://lists.arm.linux.org.uk/lurker/message/20040311.002034.5ecf21a2.html
...
> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
>
> ---
>
> Index: linux-2.6.24/fs/xfs/linux-2.6/xfs_linux.h
> ===================================================================
> --- linux-2.6.24.orig/fs/xfs/linux-2.6/xfs_linux.h
> +++ linux-2.6.24/fs/xfs/linux-2.6/xfs_linux.h
> @@ -300,4 +300,11 @@ static inline __uint64_t howmany_64(__ui
> return x;
> }
>
> +/* ARM old ABI has some weird alignment/padding */
> +#if defined(__arm__) && !defined(__ARM_EABI__)
> +#define __arch_pack __attribute__((packed))
> +#else
> +#define __arch_pack
> +#endif
Shouldn't this be unconditional? Just because it ends up being ok on x86
doesn't mean that it won't break some time later on...(do we want another
bad_features2 incident?)
> +
> #endif /* __XFS_LINUX__ */
> Index: linux-2.6.24/fs/xfs/xfs_dir2_sf.h
> ===================================================================
> --- linux-2.6.24.orig/fs/xfs/xfs_dir2_sf.h
> +++ linux-2.6.24/fs/xfs/xfs_dir2_sf.h
> @@ -62,7 +62,7 @@ typedef union {
> * Normalized offset (in a data block) of the entry, really xfs_dir2_data_off_t.
> * Only need 16 bits, this is the byte offset into the single block form.
> */
> -typedef struct { __uint8_t i[2]; } xfs_dir2_sf_off_t;
> +typedef struct { __uint8_t i[2]; } __arch_pack xfs_dir2_sf_off_t;
>
> /*
> * The parent directory has a dedicated field, and the self-pointer must
> @@ -76,14 +76,14 @@ typedef struct xfs_dir2_sf_hdr {
> __uint8_t count; /* count of entries */
> __uint8_t i8count; /* count of 8-byte inode #s */
> xfs_dir2_inou_t parent; /* parent dir inode number */
> -} xfs_dir2_sf_hdr_t;
> +} __arch_pack xfs_dir2_sf_hdr_t;
>
> typedef struct xfs_dir2_sf_entry {
> __uint8_t namelen; /* actual name length */
> xfs_dir2_sf_off_t offset; /* saved offset */
> __uint8_t name[1]; /* name, variable size */
> xfs_dir2_inou_t inumber; /* inode number, var. offset */
> -} xfs_dir2_sf_entry_t;
> +} __arch_pack xfs_dir2_sf_entry_t;
>
> typedef struct xfs_dir2_sf {
> xfs_dir2_sf_hdr_t hdr; /* shortform header */
A very simple patch! I like it (minus the condition vs. unconditional
packing - see above).
Josef 'Jeff' Sipek.
--
Penguin : Linux version 2.6.23.1 on an i386 machine (6135.23 BogoMips).
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-03-15 4:17 ` Josef 'Jeff' Sipek
@ 2008-03-15 4:23 ` Eric Sandeen
2008-03-15 4:27 ` Josef 'Jeff' Sipek
[not found] ` <20080315043622.GA11547@puku.stupidest.org>
0 siblings, 2 replies; 47+ messages in thread
From: Eric Sandeen @ 2008-03-15 4:23 UTC (permalink / raw)
To: Josef 'Jeff' Sipek; +Cc: xfs-oss
Josef 'Jeff' Sipek wrote:
> On Fri, Mar 14, 2008 at 10:24:49PM -0500, Eric Sandeen wrote:
>> This should fix the longstanding issues with xfs and old ABI
>> arm boxes, which lead to various asserts and xfs shutdowns,
>> and for which an (incorrect) patch has been floating around
>> for years. (Said patch made ARM internally consistent, but
>> altered the normal xfs on-disk format such that it looked
>> corrupted on other architectures):
>> http://lists.arm.linux.org.uk/lurker/message/20040311.002034.5ecf21a2.html
> ...
>> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
>>
>> ---
>>
>> Index: linux-2.6.24/fs/xfs/linux-2.6/xfs_linux.h
>> ===================================================================
>> --- linux-2.6.24.orig/fs/xfs/linux-2.6/xfs_linux.h
>> +++ linux-2.6.24/fs/xfs/linux-2.6/xfs_linux.h
>> @@ -300,4 +300,11 @@ static inline __uint64_t howmany_64(__ui
>> return x;
>> }
>>
>> +/* ARM old ABI has some weird alignment/padding */
>> +#if defined(__arm__) && !defined(__ARM_EABI__)
>> +#define __arch_pack __attribute__((packed))
>> +#else
>> +#define __arch_pack
>> +#endif
>
> Shouldn't this be unconditional? Just because it ends up being ok on x86
> doesn't mean that it won't break some time later on...(do we want another
> bad_features2 incident?)
I think that packing structures when they don't need to be can actually
be harmful, efficiency-wise. I read a nice explanation of this....
which I can't find now.
-Eric
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-03-15 4:23 ` Eric Sandeen
@ 2008-03-15 4:27 ` Josef 'Jeff' Sipek
2008-03-15 4:33 ` Eric Sandeen
[not found] ` <20080315043622.GA11547@puku.stupidest.org>
1 sibling, 1 reply; 47+ messages in thread
From: Josef 'Jeff' Sipek @ 2008-03-15 4:27 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs-oss
On Fri, Mar 14, 2008 at 11:23:43PM -0500, Eric Sandeen wrote:
> Josef 'Jeff' Sipek wrote:
> > On Fri, Mar 14, 2008 at 10:24:49PM -0500, Eric Sandeen wrote:
> >> This should fix the longstanding issues with xfs and old ABI
> >> arm boxes, which lead to various asserts and xfs shutdowns,
> >> and for which an (incorrect) patch has been floating around
> >> for years. (Said patch made ARM internally consistent, but
> >> altered the normal xfs on-disk format such that it looked
> >> corrupted on other architectures):
> >> http://lists.arm.linux.org.uk/lurker/message/20040311.002034.5ecf21a2.html
> > ...
> >> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
> >>
> >> ---
> >>
> >> Index: linux-2.6.24/fs/xfs/linux-2.6/xfs_linux.h
> >> ===================================================================
> >> --- linux-2.6.24.orig/fs/xfs/linux-2.6/xfs_linux.h
> >> +++ linux-2.6.24/fs/xfs/linux-2.6/xfs_linux.h
> >> @@ -300,4 +300,11 @@ static inline __uint64_t howmany_64(__ui
> >> return x;
> >> }
> >>
> >> +/* ARM old ABI has some weird alignment/padding */
> >> +#if defined(__arm__) && !defined(__ARM_EABI__)
> >> +#define __arch_pack __attribute__((packed))
> >> +#else
> >> +#define __arch_pack
> >> +#endif
> >
> > Shouldn't this be unconditional? Just because it ends up being ok on x86
> > doesn't mean that it won't break some time later on...(do we want another
> > bad_features2 incident?)
>
> I think that packing structures when they don't need to be can actually
> be harmful, efficiency-wise. I read a nice explanation of this....
> which I can't find now.
Agreed. For in-memory only structures it makes sense to let the compiler do
whatever is the best, but for structures that are on-disk, you really have
no choice, you have to have the same layout in memory - which frequently
means packed. Unless I missed it, the structs you modified are on-disk, and
therefore _must_ be the way the docs say - which happens to be packed.
Josef 'Jeff' Sipek.
--
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like
that.
- Linus Torvalds
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-03-15 4:27 ` Josef 'Jeff' Sipek
@ 2008-03-15 4:33 ` Eric Sandeen
2008-03-15 4:51 ` Josef 'Jeff' Sipek
0 siblings, 1 reply; 47+ messages in thread
From: Eric Sandeen @ 2008-03-15 4:33 UTC (permalink / raw)
To: Josef 'Jeff' Sipek; +Cc: xfs-oss
Josef 'Jeff' Sipek wrote:
> On Fri, Mar 14, 2008 at 11:23:43PM -0500, Eric Sandeen wrote:
>> Josef 'Jeff' Sipek wrote:
>>> Shouldn't this be unconditional? Just because it ends up being ok on x86
>>> doesn't mean that it won't break some time later on...(do we want another
>>> bad_features2 incident?)
>> I think that packing structures when they don't need to be can actually
>> be harmful, efficiency-wise. I read a nice explanation of this....
>> which I can't find now.
>
> Agreed. For in-memory only structures it makes sense to let the compiler do
> whatever is the best, but for structures that are on-disk, you really have
> no choice, you have to have the same layout in memory - which frequently
> means packed. Unless I missed it, the structs you modified are on-disk, and
> therefore _must_ be the way the docs say - which happens to be packed.
Well, the docs probably don't actually say "packed" :) ... they just
assume standard/predictable layout of the structures.
So on almost all architectures they _don't_ need to be explicitly
packed, and it's my understanding that doing so when it's not neccessary
is harmful. But these 3 cases, on the odd arm abi, do need it.
A QA test to run pahole on all disk structures to look for proper sizes
/ no holes might be good... though it require debug xfs (well, xfs built
with -g).
-Eric
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
[not found] ` <20080315043622.GA11547@puku.stupidest.org>
@ 2008-03-15 4:45 ` Eric Sandeen
0 siblings, 0 replies; 47+ messages in thread
From: Eric Sandeen @ 2008-03-15 4:45 UTC (permalink / raw)
To: Chris Wedgwood; +Cc: Josef 'Jeff' Sipek, xfs-oss
Chris Wedgwood wrote:
> On Fri, Mar 14, 2008 at 11:23:43PM -0500, Eric Sandeen wrote:
>
>> I think that packing structures when they don't need to be can
>> actually be harmful, efficiency-wise. I read a nice explanation of
>> this.... which I can't find now.
>
> objdump -d would show if that was the case...
it would show if that was the case for the particular compiler you test
I guess.
-Eric
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-03-15 4:33 ` Eric Sandeen
@ 2008-03-15 4:51 ` Josef 'Jeff' Sipek
2008-03-17 18:32 ` Eric Sandeen
0 siblings, 1 reply; 47+ messages in thread
From: Josef 'Jeff' Sipek @ 2008-03-15 4:51 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs-oss
On Fri, Mar 14, 2008 at 11:33:39PM -0500, Eric Sandeen wrote:
> Josef 'Jeff' Sipek wrote:
> > On Fri, Mar 14, 2008 at 11:23:43PM -0500, Eric Sandeen wrote:
> >> Josef 'Jeff' Sipek wrote:
>
> >>> Shouldn't this be unconditional? Just because it ends up being ok on x86
> >>> doesn't mean that it won't break some time later on...(do we want another
> >>> bad_features2 incident?)
> >> I think that packing structures when they don't need to be can actually
> >> be harmful, efficiency-wise. I read a nice explanation of this....
> >> which I can't find now.
> >
> > Agreed. For in-memory only structures it makes sense to let the compiler do
> > whatever is the best, but for structures that are on-disk, you really have
> > no choice, you have to have the same layout in memory - which frequently
> > means packed. Unless I missed it, the structs you modified are on-disk, and
> > therefore _must_ be the way the docs say - which happens to be packed.
>
> Well, the docs probably don't actually say "packed" :) ... they just
> assume standard/predictable layout of the structures.
Ok, nitpicking, eh? Well, you started ;)
Yes, it is true that they don't say packed, but at the same time they don't
define any holes, and the best way to force the compiler to not make holes
is to pack the structure.
> So on almost all architectures they _don't_ need to be explicitly
> packed, and it's my understanding that doing so when it's not neccessary
> is harmful. But these 3 cases, on the odd arm abi, do need it.
My understanding of the "harmful" case is that of unaligned word access, but
the compiler takes care of that.
All in all, all the ABIs that get the right alignment without packing will
not suffer performance-wise, and the old arm ABI needs to be packed anyway.
Now, next time Linux gets ported to an architecture - if that arch has a
"bad" alignment ABI rules, XFS will break, and someone (I nominate you :-P )
will have to augment the #if...or just use packed and forget about the whole
issue. :)
Josef 'Jeff' Sipek, wondering exactly how passionate one can get about
structure member alignment :)
--
Research, n.:
Consider Columbus:
He didn't know where he was going.
When he got there he didn't know where he was.
When he got back he didn't know where he had been.
And he did it all on someone else's money.
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-03-15 4:51 ` Josef 'Jeff' Sipek
@ 2008-03-17 18:32 ` Eric Sandeen
2008-03-17 19:53 ` Josef 'Jeff' Sipek
2008-03-17 23:35 ` Timothy Shimmin
0 siblings, 2 replies; 47+ messages in thread
From: Eric Sandeen @ 2008-03-17 18:32 UTC (permalink / raw)
To: Josef 'Jeff' Sipek; +Cc: xfs-oss
Josef 'Jeff' Sipek wrote:
> Josef 'Jeff' Sipek, wondering exactly how passionate one can get about
> structure member alignment :)
Very. ;)
Tossing packed at all the ondisk stuctures bloats things badly on ia64.
cvs/linux-2.6-xfs> wc -l before.dis
166688 before.dis
cvs/linux-2.6-xfs> wc -l after.dis
182294 after.dis
That's +15606 lines.
http://digitalvampire.org/blog/index.php/2006/07/31/why-you-shouldnt-use-__attribute__packed/
Please, don't do this.
_Annotating_ ondisk structures sounds good to me, assuming something can
be done with it (i.e., testing for holes - I'd thought of this a while
ago too, but never came up with anything to make use of it) but don't
pack stuff just for fun.
-Eric
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-03-17 18:32 ` Eric Sandeen
@ 2008-03-17 19:53 ` Josef 'Jeff' Sipek
2008-03-17 20:04 ` Eric Sandeen
2008-03-17 23:35 ` Timothy Shimmin
1 sibling, 1 reply; 47+ messages in thread
From: Josef 'Jeff' Sipek @ 2008-03-17 19:53 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs-oss
On Mon, Mar 17, 2008 at 01:32:16PM -0500, Eric Sandeen wrote:
> Josef 'Jeff' Sipek wrote:
>
> > Josef 'Jeff' Sipek, wondering exactly how passionate one can get about
> > structure member alignment :)
>
> Very. ;)
>
> Tossing packed at all the ondisk stuctures bloats things badly on ia64.
>
> cvs/linux-2.6-xfs> wc -l before.dis
> 166688 before.dis
> cvs/linux-2.6-xfs> wc -l after.dis
> 182294 after.dis
>
> That's +15606 lines.
I'm not done yet! :-P
First of all, the patch I showed you actually breaks a few things that I
still need to fix.
Second, I need to find out whether all the affected structures are always
aligned on some boundary (probably 4 or 8 byte). If there indeed is some
alignment, there might be a way to reduce those 15k extra lines to something
a whole lot less - I hope.
Josef 'Jeff' Sipek.
--
A CRAY is the only computer that runs an endless loop in just 4 hours...
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-03-17 19:53 ` Josef 'Jeff' Sipek
@ 2008-03-17 20:04 ` Eric Sandeen
2008-03-17 20:28 ` Josef 'Jeff' Sipek
0 siblings, 1 reply; 47+ messages in thread
From: Eric Sandeen @ 2008-03-17 20:04 UTC (permalink / raw)
To: Josef 'Jeff' Sipek; +Cc: xfs-oss
Josef 'Jeff' Sipek wrote:
> On Mon, Mar 17, 2008 at 01:32:16PM -0500, Eric Sandeen wrote:
>> Josef 'Jeff' Sipek wrote:
>>
>>> Josef 'Jeff' Sipek, wondering exactly how passionate one can get about
>>> structure member alignment :)
>> Very. ;)
>>
>> Tossing packed at all the ondisk stuctures bloats things badly on ia64.
>>
>> cvs/linux-2.6-xfs> wc -l before.dis
>> 166688 before.dis
>> cvs/linux-2.6-xfs> wc -l after.dis
>> 182294 after.dis
>>
>> That's +15606 lines.
>
> I'm not done yet! :-P
>
> First of all, the patch I showed you actually breaks a few things that I
> still need to fix.
Oh, I wasn't trying to blame you or our patch specifically, just wanted
to highlight what I consider to be the bad idea of giving gcc a bunch of
directives that IMHO we don't need.
> Second, I need to find out whether all the affected structures are always
> aligned on some boundary (probably 4 or 8 byte). If there indeed is some
> alignment, there might be a way to reduce those 15k extra lines to something
> a whole lot less - I hope.
To what end? What are you trying to fix? If it's not reduced to 0 then
your change is introducing regressions, IMHO.
Respectfully, ;)
-Eric
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-03-17 20:04 ` Eric Sandeen
@ 2008-03-17 20:28 ` Josef 'Jeff' Sipek
0 siblings, 0 replies; 47+ messages in thread
From: Josef 'Jeff' Sipek @ 2008-03-17 20:28 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs-oss
On Mon, Mar 17, 2008 at 03:04:13PM -0500, Eric Sandeen wrote:
> Josef 'Jeff' Sipek wrote:
...
> Oh, I wasn't trying to blame you or our patch specifically, just wanted
> to highlight what I consider to be the bad idea of giving gcc a bunch of
> directives that IMHO we don't need.
Right. And yes, just plopping __attribute__((packed)) to the end of each
on-disk structure is a really bad idea - it actually make xfsqa fail :)
But living on the edge, without telling gcc what exactly we want from it is
an even worse idea! Take sb_bad_features2...that fiasco that's going to stay
with the XFS on-disk format for a long time to come, would have never
happened if the structures were properly packed/padded to begin with.
> > Second, I need to find out whether all the affected structures are always
> > aligned on some boundary (probably 4 or 8 byte). If there indeed is some
> > alignment, there might be a way to reduce those 15k extra lines to something
> > a whole lot less - I hope.
>
> To what end? What are you trying to fix? If it's not reduced to 0 then
Not packing the structures is all fine if you have one compiler, one OS, and
one architecture to care about. That worked fine when XFS ran on IRIX on
MIPS, but Linux runs on so many different ABIs that you are asking for
trouble by not packing. I can't imagine the number of supported ABIs not
growing. Packing on as-needed basis (which you suggested with your patch) is
rather messy...
1) new ABIs have to checked
2) you'll end up with a rat's nest of #ifdefs to make __arch_pack do the
right thing
Really, we need a way to tell gcc: "hey, gcc, we know what we're doing -
just trust us; don't pad, and don't worry about the alignment". packed gets
you the no-padding, and as I mentioned in my previous reply, align(X) will
hopefully take care of the alignment. Then, gcc should generate nice code to
access members that are on proper boundaries (AFAIK virtually all, if not
all, the struct members in XFS fall into this category), and slightly worse
code for few places that might exist.
The problem you saw in ia64, is because gcc generated the "worst" case code
for all the struct accesses. I _think_ that can be fixed to near-0, if not 0
on all but the few ABIs (e.g., old arm).
Josef 'Jeff' Sipek.
--
The box said "Windows XP or better required". So I installed Linux.
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-03-17 18:32 ` Eric Sandeen
2008-03-17 19:53 ` Josef 'Jeff' Sipek
@ 2008-03-17 23:35 ` Timothy Shimmin
2008-03-17 23:42 ` Josef 'Jeff' Sipek
1 sibling, 1 reply; 47+ messages in thread
From: Timothy Shimmin @ 2008-03-17 23:35 UTC (permalink / raw)
To: Eric Sandeen; +Cc: Josef 'Jeff' Sipek, xfs-oss
Eric Sandeen wrote:
> Josef 'Jeff' Sipek wrote:
>
>> Josef 'Jeff' Sipek, wondering exactly how passionate one can get about
>> structure member alignment :)
>
> Very. ;)
>
> Tossing packed at all the ondisk stuctures bloats things badly on ia64.
>
> cvs/linux-2.6-xfs> wc -l before.dis
> 166688 before.dis
> cvs/linux-2.6-xfs> wc -l after.dis
> 182294 after.dis
>
> That's +15606 lines.
>
> http://digitalvampire.org/blog/index.php/2006/07/31/why-you-shouldnt-use-__attribute__packed/
>
Interesting.
So the problem there is that gcc is doing the wrong thing
on some arches (the example being ia64, sparc64).
--Tim
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-03-17 23:35 ` Timothy Shimmin
@ 2008-03-17 23:42 ` Josef 'Jeff' Sipek
2008-03-18 4:31 ` Timothy Shimmin
0 siblings, 1 reply; 47+ messages in thread
From: Josef 'Jeff' Sipek @ 2008-03-17 23:42 UTC (permalink / raw)
To: Timothy Shimmin; +Cc: Eric Sandeen, xfs-oss
On Tue, Mar 18, 2008 at 10:35:32AM +1100, Timothy Shimmin wrote:
> Eric Sandeen wrote:
>> Josef 'Jeff' Sipek wrote:
>>> Josef 'Jeff' Sipek, wondering exactly how passionate one can get about
>>> structure member alignment :)
>> Very. ;)
>> Tossing packed at all the ondisk stuctures bloats things badly on ia64.
>> cvs/linux-2.6-xfs> wc -l before.dis
>> 166688 before.dis
>> cvs/linux-2.6-xfs> wc -l after.dis
>> 182294 after.dis
>> That's +15606 lines.
>> http://digitalvampire.org/blog/index.php/2006/07/31/why-you-shouldnt-use-__attribute__packed/
> Interesting.
> So the problem there is that gcc is doing the wrong thing
> on some arches (the example being ia64, sparc64).
Actually, it's not doing the wrong thing...
__attribute__((packed)) means:
1) condense the members of the struct leaving NO padding bytes
2) do NOT assume the entire structure is aligned on any boundary
This means, that even if you have a member that'd be nicely aligned without
the packed attribute (see below), the compiler will generate worst case
alignment code.
struct foo {
u64 a;
} __attribute__((packed));
You can put struct foo anywhere in memory, and the code accessing ->a will
_always_ work.
Using __attribute((packed,aligned(4))), tells it that the structure as a
whole will be aligned on a 4-byte boundary, but there should be no padding
bytes inserted.
Josef 'Jeff' Sipek.
--
Penguin : Linux version 2.6.23.1 on an i386 machine (6135.23 BogoMips).
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-03-17 23:42 ` Josef 'Jeff' Sipek
@ 2008-03-18 4:31 ` Timothy Shimmin
0 siblings, 0 replies; 47+ messages in thread
From: Timothy Shimmin @ 2008-03-18 4:31 UTC (permalink / raw)
To: Josef 'Jeff' Sipek; +Cc: Eric Sandeen, xfs-oss
Josef 'Jeff' Sipek wrote:
> On Tue, Mar 18, 2008 at 10:35:32AM +1100, Timothy Shimmin wrote:
>> Eric Sandeen wrote:
>>> Josef 'Jeff' Sipek wrote:
>>>> Josef 'Jeff' Sipek, wondering exactly how passionate one can get about
>>>> structure member alignment :)
>>> Very. ;)
>>> Tossing packed at all the ondisk stuctures bloats things badly on ia64.
>>> cvs/linux-2.6-xfs> wc -l before.dis
>>> 166688 before.dis
>>> cvs/linux-2.6-xfs> wc -l after.dis
>>> 182294 after.dis
>>> That's +15606 lines.
>>> http://digitalvampire.org/blog/index.php/2006/07/31/why-you-shouldnt-use-__attribute__packed/
>> Interesting.
>> So the problem there is that gcc is doing the wrong thing
>> on some arches (the example being ia64, sparc64).
>
> Actually, it's not doing the wrong thing...
>
> __attribute__((packed)) means:
>
> 1) condense the members of the struct leaving NO padding bytes
>
> 2) do NOT assume the entire structure is aligned on any boundary
>
Okay I only knew about (1) - cause that sounds more like "pack"ing to me.
So you can't assume alignment for the start of the variable
without aligned() if you use packed - Ok.
Thanks,
--Tim
> This means, that even if you have a member that'd be nicely aligned without
> the packed attribute (see below), the compiler will generate worst case
> alignment code.
>
> struct foo {
> u64 a;
> } __attribute__((packed));
>
> You can put struct foo anywhere in memory, and the code accessing ->a will
> _always_ work.
>
> Using __attribute((packed,aligned(4))), tells it that the structure as a
> whole will be aligned on a 4-byte boundary, but there should be no padding
> bytes inserted.
>
> Josef 'Jeff' Sipek.
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
@ 2008-03-18 23:31 Andre Draszik
2008-03-19 3:18 ` Eric Sandeen
0 siblings, 1 reply; 47+ messages in thread
From: Andre Draszik @ 2008-03-18 23:31 UTC (permalink / raw)
To: xfs
Hi,
(I just subscribed, so I can't reply correctly :-(
In fact,, the last two evenings I spent making XFS work on arm eabi,
where things are much better than with the old API, but still XFS
won't work out of the box.
So, Eric, if you go for the #if defined(__arm__) &&
!defined(__ARM_EABI__) approach, arm eabi will still be broken.
EABI basically behaves like other 'normal' arches/abis, but sometimes
structures get padded to have a size of a multiple of 8, i.e. padding
is added at the end of the struct, which as far as I can see for now
affects 5 structs: xfs_dir2_data_entry_t, xfs_dinode_t, xfs_sb_t,
xfs_dsb_t, and xfs_log_item_t
I must say, I like Jeff's approach of explicitly telling gcc about
alignment much better :-) It makes it a) much easier to find structs
that are in fact representations of on-disk data and thus might need
tweaking, and b) as somebody already said you fix such problems once
and forever.
E.g. for me as an absolute outsider, it was quite time consuming
finding out which structs are actually on-disk.
That said, Jeff, you mentioned that your changes don't work yet
completely - could this be because (at least from the comments) struct
xfs_sb needs to match struct xfs_dsb and you only change xfs_dsb?
Cheers,
Andre'
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
@ 2008-03-18 23:49 Andre Draszik
2008-03-19 0:23 ` Josef 'Jeff' Sipek
0 siblings, 1 reply; 47+ messages in thread
From: Andre Draszik @ 2008-03-18 23:49 UTC (permalink / raw)
To: xfs
Hi,
(I just subscribed, so I can't reply correctly :-(
In fact,, the last two evenings I spent making XFS work on arm eabi,
where things are much better than with the old API, but still XFS
won't work out of the box.
So, Eric, if you go for the #if defined(__arm__) &&
!defined(__ARM_EABI__) approach, arm eabi will still be broken.
EABI basically behaves like other 'normal' arches/abis, but sometimes
structures get padded to have a size of a multiple of 8, i.e. padding
is added at the end of the struct, which as far as I can see for now
affects 5 structs: xfs_dir2_data_entry_t, xfs_dinode_t, xfs_sb_t,
xfs_dsb_t, and xlog_rec_header_t
I must say, I like Jeff's approach of explicitly telling gcc about
alignment much better :-) It makes it a) much easier to find structs
that are in fact representations of on-disk data and thus might need
tweaking, and b) as somebody already said you fix such problems once
and forever.
E.g. for me as an absolute outsider, it was quite time consuming
finding out which structs are actually on-disk.
That said, Jeff, you mentioned that your changes don't work yet
completely - could this be because (at least from the comments) struct
xfs_sb needs to match struct xfs_dsb and you only change xfs_dsb?
Cheers,
Andre'
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-03-18 23:49 Andre Draszik
@ 2008-03-19 0:23 ` Josef 'Jeff' Sipek
2008-03-19 11:21 ` Luca Olivetti
0 siblings, 1 reply; 47+ messages in thread
From: Josef 'Jeff' Sipek @ 2008-03-19 0:23 UTC (permalink / raw)
To: Andre Draszik; +Cc: xfs
On Tue, Mar 18, 2008 at 11:49:11PM +0000, Andre Draszik wrote:
> Hi,
>
> (I just subscribed, so I can't reply correctly :-(
>
> In fact,, the last two evenings I spent making XFS work on arm eabi,
> where things are much better than with the old API, but still XFS
> won't work out of the box.
>
> So, Eric, if you go for the #if defined(__arm__) &&
> !defined(__ARM_EABI__) approach, arm eabi will still be broken.
Ouch.
> EABI basically behaves like other 'normal' arches/abis, but sometimes
> structures get padded to have a size of a multiple of 8, i.e. padding
> is added at the end of the struct, which as far as I can see for now
> affects 5 structs: xfs_dir2_data_entry_t, xfs_dinode_t, xfs_sb_t,
> xfs_dsb_t, and xlog_rec_header_t
>
> I must say, I like Jeff's approach of explicitly telling gcc about
> alignment much better :-) It makes it a) much easier to find structs
> that are in fact representations of on-disk data and thus might need
> tweaking, and b) as somebody already said you fix such problems once
> and forever.
Hopefully, there won't be any need for additional tweaking.
> E.g. for me as an absolute outsider, it was quite time consuming
> finding out which structs are actually on-disk.
Hey, I feel your pain. I just grepped the entire source tree for 'struct'
and went through them one by one.
> That said, Jeff, you mentioned that your changes don't work yet
> completely - could this be because (at least from the comments) struct
> xfs_sb needs to match struct xfs_dsb and you only change xfs_dsb?
As far as I know the patch I sent later last night does work. BUT, and I
mean *BUT*, I did not test it on anything other than x86. And even then, I
wouldn't trust it with my data just yet :) It is very possible that some
arches are still broken - it was a "request for comment", not a "please
apply".
I talked about it a bit in the IRC channel, and the SGI folks want (1) proof
that adding these attributes does not create any regressions on any of the
supported architectures (and fixes the one that's currently broken - arm),
and (2) need to make sure that the ~700 instructions (~0.3% increase) that
get added to ia64 do not cause a regression in performance. Both points are
valid, and it'll all happen sometime (hopefully) soon.
Thanks for the heads up wrt ARM EABI.
Josef 'Jeff' Sipek.
--
You measure democracy by the freedom it gives its dissidents, not the
freedom it gives its assimilated conformists.
- Abbie Hoffman
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-03-18 23:31 [PATCH] fix dir2 shortform structures on ARM old ABI Andre Draszik
@ 2008-03-19 3:18 ` Eric Sandeen
2008-03-19 3:40 ` Eric Sandeen
2008-03-19 5:11 ` Eric Sandeen
0 siblings, 2 replies; 47+ messages in thread
From: Eric Sandeen @ 2008-03-19 3:18 UTC (permalink / raw)
To: Andre Draszik; +Cc: xfs
[-- Attachment #1: Type: text/plain, Size: 2985 bytes --]
Andre Draszik wrote:
> Hi,
>
> (I just subscribed, so I can't reply correctly :-(
>
> In fact,, the last two evenings I spent making XFS work on arm eabi,
> where things are much better than with the old API, but still XFS
> won't work out of the box.
How so?
> So, Eric, if you go for the #if defined(__arm__) &&
> !defined(__ARM_EABI__) approach, arm eabi will still be broken.
Details, please.
> EABI basically behaves like other 'normal' arches/abis, but sometimes
> structures get padded to have a size of a multiple of 8, i.e. padding
> is added at the end of the struct, which as far as I can see for now
> affects 5 structs: xfs_dir2_data_entry_t, xfs_dinode_t, xfs_sb_t,
> xfs_dsb_t, and xfs_log_item_t
I did pretty exhaustive testing on new abi and saw no failures that were
clearly unique to arm, although full qa gets enough failures that I
wouldn't swear to it. What testing did you do, and what failures did
you see? And what work did you need to do to "make XFS work" on eabi?
I've helpfully provided structure layouts for the structures you mention
in the attached files, for your diffing pleasure. I think you'll find
that it's not exactly as you described.
xfs_dinode_t has no extra padding at the end, though xfs_dir2_sf, a
member of one of its unions, does (though other union members are larger
though, so the struct offsets are not changed.)
There is one other cosmetic difference just because my arm tree doesn't
have Jeff's ail_entry list change. The rest of the structures seem to
be identical.
If you have structure differences that lead to demonstrable failures,
then by all means, provide the details.
> I must say, I like Jeff's approach of explicitly telling gcc about
> alignment much better :-) It makes it a) much easier to find structs
> that are in fact representations of on-disk data and thus might need
> tweaking, and b) as somebody already said you fix such problems once
> and forever.
> E.g. for me as an absolute outsider, it was quite time consuming
> finding out which structs are actually on-disk.
At some point here I'm just going to go quietly insane.
Yes, _annotating_ things as __ondisk is great, and I have no problems
with that, although it'd be nice if something actually made use of the
annotation. But don't confuse that with telling gcc to actually treat
each of these structures differently, which is great if done properly,
and requires a huge amount of diligence.
If you guys can take this exercise to the point where you've convinced
the sgi guys that the benefits outweigh the risks, then more power to
you. In the meantime, I hope my targeted, safe fix for a demonstrable
problem which has gone begging for 5 years or so doesn't get lost in the
noise.
-Eric
>
> That said, Jeff, you mentioned that your changes don't work yet
> completely - could this be because (at least from the comments) struct
> xfs_sb needs to match struct xfs_dsb and you only change xfs_dsb?
>
>
> Cheers,
> Andre'
>
>
[-- Attachment #2: arm.structs --]
[-- Type: text/plain, Size: 8926 bytes --]
struct xfs_dir2_data_entry {
__be64 inumber; /* 0 8 */
__u8 namelen; /* 8 1 */
__u8 name[1]; /* 9 1 */
__be16 tag; /* 10 2 */
/* size: 12, cachelines: 1 */
/* last cacheline: 12 bytes */
};
struct xfs_dinode {
xfs_dinode_core_t di_core; /* 0 96 */
/* --- cacheline 1 boundary (64 bytes) was 32 bytes ago --- */
__be32 di_next_unlinked; /* 96 4 */
union {
xfs_bmdr_block_t di_bmbt; /* 4 */
xfs_bmbt_rec_32_t di_bmx[1]; /* 16 */
xfs_dir2_sf_t di_dir2sf; /* 24 */
char di_c[1]; /* 1 */
__be32 di_dev; /* 4 */
uuid_t di_muuid; /* 16 */
char di_symlink[1]; /* 1 */
} di_u; /* 100 24 */
union {
xfs_bmdr_block_t di_abmbt; /* 4 */
xfs_bmbt_rec_32_t di_abmx[1]; /* 16 */
xfs_attr_shortform_t di_attrsf; /* 8 */
} di_a; /* 124 16 */
/* --- cacheline 2 boundary (128 bytes) was 12 bytes ago --- */
/* size: 140, cachelines: 3 */
/* last cacheline: 12 bytes */
};
struct xfs_sb {
__uint32_t sb_magicnum; /* 0 4 */
__uint32_t sb_blocksize; /* 4 4 */
xfs_drfsbno_t sb_dblocks; /* 8 8 */
xfs_drfsbno_t sb_rblocks; /* 16 8 */
xfs_drtbno_t sb_rextents; /* 24 8 */
uuid_t sb_uuid; /* 32 16 */
xfs_dfsbno_t sb_logstart; /* 48 8 */
xfs_ino_t sb_rootino; /* 56 8 */
/* --- cacheline 1 boundary (64 bytes) --- */
xfs_ino_t sb_rbmino; /* 64 8 */
xfs_ino_t sb_rsumino; /* 72 8 */
xfs_agblock_t sb_rextsize; /* 80 4 */
xfs_agblock_t sb_agblocks; /* 84 4 */
xfs_agnumber_t sb_agcount; /* 88 4 */
xfs_extlen_t sb_rbmblocks; /* 92 4 */
xfs_extlen_t sb_logblocks; /* 96 4 */
__uint16_t sb_versionnum; /* 100 2 */
__uint16_t sb_sectsize; /* 102 2 */
__uint16_t sb_inodesize; /* 104 2 */
__uint16_t sb_inopblock; /* 106 2 */
char sb_fname[12]; /* 108 12 */
__uint8_t sb_blocklog; /* 120 1 */
__uint8_t sb_sectlog; /* 121 1 */
__uint8_t sb_inodelog; /* 122 1 */
__uint8_t sb_inopblog; /* 123 1 */
__uint8_t sb_agblklog; /* 124 1 */
__uint8_t sb_rextslog; /* 125 1 */
__uint8_t sb_inprogress; /* 126 1 */
__uint8_t sb_imax_pct; /* 127 1 */
/* --- cacheline 2 boundary (128 bytes) --- */
__uint64_t sb_icount; /* 128 8 */
__uint64_t sb_ifree; /* 136 8 */
__uint64_t sb_fdblocks; /* 144 8 */
__uint64_t sb_frextents; /* 152 8 */
xfs_ino_t sb_uquotino; /* 160 8 */
xfs_ino_t sb_gquotino; /* 168 8 */
__uint16_t sb_qflags; /* 176 2 */
__uint8_t sb_flags; /* 178 1 */
__uint8_t sb_shared_vn; /* 179 1 */
xfs_extlen_t sb_inoalignmt; /* 180 4 */
__uint32_t sb_unit; /* 184 4 */
__uint32_t sb_width; /* 188 4 */
/* --- cacheline 3 boundary (192 bytes) --- */
__uint8_t sb_dirblklog; /* 192 1 */
__uint8_t sb_logsectlog; /* 193 1 */
__uint16_t sb_logsectsize; /* 194 2 */
__uint32_t sb_logsunit; /* 196 4 */
__uint32_t sb_features2; /* 200 4 */
__uint32_t sb_bad_features2; /* 204 4 */
/* size: 208, cachelines: 4 */
/* last cacheline: 16 bytes */
};
struct xfs_dsb {
__be32 sb_magicnum; /* 0 4 */
__be32 sb_blocksize; /* 4 4 */
__be64 sb_dblocks; /* 8 8 */
__be64 sb_rblocks; /* 16 8 */
__be64 sb_rextents; /* 24 8 */
uuid_t sb_uuid; /* 32 16 */
__be64 sb_logstart; /* 48 8 */
__be64 sb_rootino; /* 56 8 */
/* --- cacheline 1 boundary (64 bytes) --- */
__be64 sb_rbmino; /* 64 8 */
__be64 sb_rsumino; /* 72 8 */
__be32 sb_rextsize; /* 80 4 */
__be32 sb_agblocks; /* 84 4 */
__be32 sb_agcount; /* 88 4 */
__be32 sb_rbmblocks; /* 92 4 */
__be32 sb_logblocks; /* 96 4 */
__be16 sb_versionnum; /* 100 2 */
__be16 sb_sectsize; /* 102 2 */
__be16 sb_inodesize; /* 104 2 */
__be16 sb_inopblock; /* 106 2 */
char sb_fname[12]; /* 108 12 */
__u8 sb_blocklog; /* 120 1 */
__u8 sb_sectlog; /* 121 1 */
__u8 sb_inodelog; /* 122 1 */
__u8 sb_inopblog; /* 123 1 */
__u8 sb_agblklog; /* 124 1 */
__u8 sb_rextslog; /* 125 1 */
__u8 sb_inprogress; /* 126 1 */
__u8 sb_imax_pct; /* 127 1 */
/* --- cacheline 2 boundary (128 bytes) --- */
__be64 sb_icount; /* 128 8 */
__be64 sb_ifree; /* 136 8 */
__be64 sb_fdblocks; /* 144 8 */
__be64 sb_frextents; /* 152 8 */
__be64 sb_uquotino; /* 160 8 */
__be64 sb_gquotino; /* 168 8 */
__be16 sb_qflags; /* 176 2 */
__u8 sb_flags; /* 178 1 */
__u8 sb_shared_vn; /* 179 1 */
__be32 sb_inoalignmt; /* 180 4 */
__be32 sb_unit; /* 184 4 */
__be32 sb_width; /* 188 4 */
/* --- cacheline 3 boundary (192 bytes) --- */
__u8 sb_dirblklog; /* 192 1 */
__u8 sb_logsectlog; /* 193 1 */
__be16 sb_logsectsize; /* 194 2 */
__be32 sb_logsunit; /* 196 4 */
__be32 sb_features2; /* 200 4 */
__be32 sb_bad_features2; /* 204 4 */
/* size: 208, cachelines: 4 */
/* last cacheline: 16 bytes */
};
struct xfs_log_item {
xfs_ail_entry_t li_ail; /* 0 8 */
xfs_lsn_t li_lsn; /* 8 8 */
struct xfs_log_item_desc * li_desc; /* 16 4 */
struct xfs_mount * li_mountp; /* 20 4 */
uint li_type; /* 24 4 */
uint li_flags; /* 28 4 */
struct xfs_log_item * li_bio_list; /* 32 4 */
void (*li_cb)(struct xfs_buf *, struct xfs_log_item *); /* 36 4 */
struct xfs_item_ops * li_ops; /* 40 4 */
/* size: 44, cachelines: 1 */
/* last cacheline: 44 bytes */
};
[-- Attachment #3: x86.structs --]
[-- Type: text/plain, Size: 8926 bytes --]
struct xfs_dir2_data_entry {
__be64 inumber; /* 0 8 */
__u8 namelen; /* 8 1 */
__u8 name[1]; /* 9 1 */
__be16 tag; /* 10 2 */
/* size: 12, cachelines: 1 */
/* last cacheline: 12 bytes */
};
struct xfs_dinode {
xfs_dinode_core_t di_core; /* 0 96 */
/* --- cacheline 1 boundary (64 bytes) was 32 bytes ago --- */
__be32 di_next_unlinked; /* 96 4 */
union {
xfs_bmdr_block_t di_bmbt; /* 4 */
xfs_bmbt_rec_32_t di_bmx[1]; /* 16 */
xfs_dir2_sf_t di_dir2sf; /* 22 */
char di_c[1]; /* 1 */
__be32 di_dev; /* 4 */
uuid_t di_muuid; /* 16 */
char di_symlink[1]; /* 1 */
} di_u; /* 100 24 */
union {
xfs_bmdr_block_t di_abmbt; /* 4 */
xfs_bmbt_rec_32_t di_abmx[1]; /* 16 */
xfs_attr_shortform_t di_attrsf; /* 8 */
} di_a; /* 124 16 */
/* --- cacheline 2 boundary (128 bytes) was 12 bytes ago --- */
/* size: 140, cachelines: 3 */
/* last cacheline: 12 bytes */
};
struct xfs_sb {
__uint32_t sb_magicnum; /* 0 4 */
__uint32_t sb_blocksize; /* 4 4 */
xfs_drfsbno_t sb_dblocks; /* 8 8 */
xfs_drfsbno_t sb_rblocks; /* 16 8 */
xfs_drtbno_t sb_rextents; /* 24 8 */
uuid_t sb_uuid; /* 32 16 */
xfs_dfsbno_t sb_logstart; /* 48 8 */
xfs_ino_t sb_rootino; /* 56 8 */
/* --- cacheline 1 boundary (64 bytes) --- */
xfs_ino_t sb_rbmino; /* 64 8 */
xfs_ino_t sb_rsumino; /* 72 8 */
xfs_agblock_t sb_rextsize; /* 80 4 */
xfs_agblock_t sb_agblocks; /* 84 4 */
xfs_agnumber_t sb_agcount; /* 88 4 */
xfs_extlen_t sb_rbmblocks; /* 92 4 */
xfs_extlen_t sb_logblocks; /* 96 4 */
__uint16_t sb_versionnum; /* 100 2 */
__uint16_t sb_sectsize; /* 102 2 */
__uint16_t sb_inodesize; /* 104 2 */
__uint16_t sb_inopblock; /* 106 2 */
char sb_fname[12]; /* 108 12 */
__uint8_t sb_blocklog; /* 120 1 */
__uint8_t sb_sectlog; /* 121 1 */
__uint8_t sb_inodelog; /* 122 1 */
__uint8_t sb_inopblog; /* 123 1 */
__uint8_t sb_agblklog; /* 124 1 */
__uint8_t sb_rextslog; /* 125 1 */
__uint8_t sb_inprogress; /* 126 1 */
__uint8_t sb_imax_pct; /* 127 1 */
/* --- cacheline 2 boundary (128 bytes) --- */
__uint64_t sb_icount; /* 128 8 */
__uint64_t sb_ifree; /* 136 8 */
__uint64_t sb_fdblocks; /* 144 8 */
__uint64_t sb_frextents; /* 152 8 */
xfs_ino_t sb_uquotino; /* 160 8 */
xfs_ino_t sb_gquotino; /* 168 8 */
__uint16_t sb_qflags; /* 176 2 */
__uint8_t sb_flags; /* 178 1 */
__uint8_t sb_shared_vn; /* 179 1 */
xfs_extlen_t sb_inoalignmt; /* 180 4 */
__uint32_t sb_unit; /* 184 4 */
__uint32_t sb_width; /* 188 4 */
/* --- cacheline 3 boundary (192 bytes) --- */
__uint8_t sb_dirblklog; /* 192 1 */
__uint8_t sb_logsectlog; /* 193 1 */
__uint16_t sb_logsectsize; /* 194 2 */
__uint32_t sb_logsunit; /* 196 4 */
__uint32_t sb_features2; /* 200 4 */
__uint32_t sb_bad_features2; /* 204 4 */
/* size: 208, cachelines: 4 */
/* last cacheline: 16 bytes */
};
struct xfs_dsb {
__be32 sb_magicnum; /* 0 4 */
__be32 sb_blocksize; /* 4 4 */
__be64 sb_dblocks; /* 8 8 */
__be64 sb_rblocks; /* 16 8 */
__be64 sb_rextents; /* 24 8 */
uuid_t sb_uuid; /* 32 16 */
__be64 sb_logstart; /* 48 8 */
__be64 sb_rootino; /* 56 8 */
/* --- cacheline 1 boundary (64 bytes) --- */
__be64 sb_rbmino; /* 64 8 */
__be64 sb_rsumino; /* 72 8 */
__be32 sb_rextsize; /* 80 4 */
__be32 sb_agblocks; /* 84 4 */
__be32 sb_agcount; /* 88 4 */
__be32 sb_rbmblocks; /* 92 4 */
__be32 sb_logblocks; /* 96 4 */
__be16 sb_versionnum; /* 100 2 */
__be16 sb_sectsize; /* 102 2 */
__be16 sb_inodesize; /* 104 2 */
__be16 sb_inopblock; /* 106 2 */
char sb_fname[12]; /* 108 12 */
__u8 sb_blocklog; /* 120 1 */
__u8 sb_sectlog; /* 121 1 */
__u8 sb_inodelog; /* 122 1 */
__u8 sb_inopblog; /* 123 1 */
__u8 sb_agblklog; /* 124 1 */
__u8 sb_rextslog; /* 125 1 */
__u8 sb_inprogress; /* 126 1 */
__u8 sb_imax_pct; /* 127 1 */
/* --- cacheline 2 boundary (128 bytes) --- */
__be64 sb_icount; /* 128 8 */
__be64 sb_ifree; /* 136 8 */
__be64 sb_fdblocks; /* 144 8 */
__be64 sb_frextents; /* 152 8 */
__be64 sb_uquotino; /* 160 8 */
__be64 sb_gquotino; /* 168 8 */
__be16 sb_qflags; /* 176 2 */
__u8 sb_flags; /* 178 1 */
__u8 sb_shared_vn; /* 179 1 */
__be32 sb_inoalignmt; /* 180 4 */
__be32 sb_unit; /* 184 4 */
__be32 sb_width; /* 188 4 */
/* --- cacheline 3 boundary (192 bytes) --- */
__u8 sb_dirblklog; /* 192 1 */
__u8 sb_logsectlog; /* 193 1 */
__be16 sb_logsectsize; /* 194 2 */
__be32 sb_logsunit; /* 196 4 */
__be32 sb_features2; /* 200 4 */
__be32 sb_bad_features2; /* 204 4 */
/* size: 208, cachelines: 4 */
/* last cacheline: 16 bytes */
};
struct xfs_log_item {
struct list_head li_ail; /* 0 8 */
xfs_lsn_t li_lsn; /* 8 8 */
struct xfs_log_item_desc * li_desc; /* 16 4 */
struct xfs_mount * li_mountp; /* 20 4 */
uint li_type; /* 24 4 */
uint li_flags; /* 28 4 */
struct xfs_log_item * li_bio_list; /* 32 4 */
void (*li_cb)(struct xfs_buf *, struct xfs_log_item *); /* 36 4 */
struct xfs_item_ops * li_ops; /* 40 4 */
/* size: 44, cachelines: 1 */
/* last cacheline: 44 bytes */
};
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-03-19 3:18 ` Eric Sandeen
@ 2008-03-19 3:40 ` Eric Sandeen
2008-03-19 5:11 ` Eric Sandeen
1 sibling, 0 replies; 47+ messages in thread
From: Eric Sandeen @ 2008-03-19 3:40 UTC (permalink / raw)
To: Andre Draszik; +Cc: xfs
Eric Sandeen wrote:
> xfs_dinode_t has no extra padding at the end, though xfs_dir2_sf, a
> member of one of its unions, does (though other union members are larger
> though, so the struct offsets are not changed.)
actually that's not quite right, but in any case it does not change the
size of the union or subsequent member offsets.
-Eric
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-03-19 3:18 ` Eric Sandeen
2008-03-19 3:40 ` Eric Sandeen
@ 2008-03-19 5:11 ` Eric Sandeen
2008-03-19 5:31 ` Eric Sandeen
2008-03-20 0:35 ` Timothy Shimmin
1 sibling, 2 replies; 47+ messages in thread
From: Eric Sandeen @ 2008-03-19 5:11 UTC (permalink / raw)
To: Andre Draszik; +Cc: xfs
[-- Attachment #1: Type: text/plain, Size: 658 bytes --]
Eric Sandeen wrote:
> I've helpfully provided structure layouts for the structures you mention
> in the attached files, for your diffing pleasure. I think you'll find
> that it's not exactly as you described.
Ah hell the arm structs I attached were for oldabi. It's what I get for
saving this fun work for late at night ;)
Attached are eabi structs; still only xfs_dir2_data_entry, xfs_dinode
and xfs_log_item seem to be affected by end-of-struct padding, of the
structures you mention. And xfs_log_item isn't a disk structure...
which brings me back to, what specific failures do you see as a result
of end-of-struct padding on these structs?
-Eric
[-- Attachment #2: arm-eabi.structs --]
[-- Type: text/plain, Size: 8980 bytes --]
struct xfs_dir2_data_entry {
__be64 inumber; /* 0 8 */
__u8 namelen; /* 8 1 */
__u8 name[1]; /* 9 1 */
__be16 tag; /* 10 2 */
/* size: 16, cachelines: 1 */
/* padding: 4 */
/* last cacheline: 16 bytes */
};
struct xfs_dinode {
xfs_dinode_core_t di_core; /* 0 96 */
/* --- cacheline 1 boundary (64 bytes) was 32 bytes ago --- */
__be32 di_next_unlinked; /* 96 4 */
union {
xfs_bmdr_block_t di_bmbt; /* 4 */
xfs_bmbt_rec_32_t di_bmx[1]; /* 16 */
xfs_dir2_sf_t di_dir2sf; /* 22 */
char di_c[1]; /* 1 */
__be32 di_dev; /* 4 */
uuid_t di_muuid; /* 16 */
char di_symlink[1]; /* 1 */
} di_u; /* 100 24 */
union {
xfs_bmdr_block_t di_abmbt; /* 4 */
xfs_bmbt_rec_32_t di_abmx[1]; /* 16 */
xfs_attr_shortform_t di_attrsf; /* 8 */
} di_a; /* 124 16 */
/* --- cacheline 2 boundary (128 bytes) was 12 bytes ago --- */
/* size: 144, cachelines: 3 */
/* padding: 4 */
/* last cacheline: 16 bytes */
};
struct xfs_sb {
__uint32_t sb_magicnum; /* 0 4 */
__uint32_t sb_blocksize; /* 4 4 */
xfs_drfsbno_t sb_dblocks; /* 8 8 */
xfs_drfsbno_t sb_rblocks; /* 16 8 */
xfs_drtbno_t sb_rextents; /* 24 8 */
uuid_t sb_uuid; /* 32 16 */
xfs_dfsbno_t sb_logstart; /* 48 8 */
xfs_ino_t sb_rootino; /* 56 8 */
/* --- cacheline 1 boundary (64 bytes) --- */
xfs_ino_t sb_rbmino; /* 64 8 */
xfs_ino_t sb_rsumino; /* 72 8 */
xfs_agblock_t sb_rextsize; /* 80 4 */
xfs_agblock_t sb_agblocks; /* 84 4 */
xfs_agnumber_t sb_agcount; /* 88 4 */
xfs_extlen_t sb_rbmblocks; /* 92 4 */
xfs_extlen_t sb_logblocks; /* 96 4 */
__uint16_t sb_versionnum; /* 100 2 */
__uint16_t sb_sectsize; /* 102 2 */
__uint16_t sb_inodesize; /* 104 2 */
__uint16_t sb_inopblock; /* 106 2 */
char sb_fname[12]; /* 108 12 */
__uint8_t sb_blocklog; /* 120 1 */
__uint8_t sb_sectlog; /* 121 1 */
__uint8_t sb_inodelog; /* 122 1 */
__uint8_t sb_inopblog; /* 123 1 */
__uint8_t sb_agblklog; /* 124 1 */
__uint8_t sb_rextslog; /* 125 1 */
__uint8_t sb_inprogress; /* 126 1 */
__uint8_t sb_imax_pct; /* 127 1 */
/* --- cacheline 2 boundary (128 bytes) --- */
__uint64_t sb_icount; /* 128 8 */
__uint64_t sb_ifree; /* 136 8 */
__uint64_t sb_fdblocks; /* 144 8 */
__uint64_t sb_frextents; /* 152 8 */
xfs_ino_t sb_uquotino; /* 160 8 */
xfs_ino_t sb_gquotino; /* 168 8 */
__uint16_t sb_qflags; /* 176 2 */
__uint8_t sb_flags; /* 178 1 */
__uint8_t sb_shared_vn; /* 179 1 */
xfs_extlen_t sb_inoalignmt; /* 180 4 */
__uint32_t sb_unit; /* 184 4 */
__uint32_t sb_width; /* 188 4 */
/* --- cacheline 3 boundary (192 bytes) --- */
__uint8_t sb_dirblklog; /* 192 1 */
__uint8_t sb_logsectlog; /* 193 1 */
__uint16_t sb_logsectsize; /* 194 2 */
__uint32_t sb_logsunit; /* 196 4 */
__uint32_t sb_features2; /* 200 4 */
__uint32_t sb_bad_features2; /* 204 4 */
/* size: 208, cachelines: 4 */
/* last cacheline: 16 bytes */
};
struct xfs_dsb {
__be32 sb_magicnum; /* 0 4 */
__be32 sb_blocksize; /* 4 4 */
__be64 sb_dblocks; /* 8 8 */
__be64 sb_rblocks; /* 16 8 */
__be64 sb_rextents; /* 24 8 */
uuid_t sb_uuid; /* 32 16 */
__be64 sb_logstart; /* 48 8 */
__be64 sb_rootino; /* 56 8 */
/* --- cacheline 1 boundary (64 bytes) --- */
__be64 sb_rbmino; /* 64 8 */
__be64 sb_rsumino; /* 72 8 */
__be32 sb_rextsize; /* 80 4 */
__be32 sb_agblocks; /* 84 4 */
__be32 sb_agcount; /* 88 4 */
__be32 sb_rbmblocks; /* 92 4 */
__be32 sb_logblocks; /* 96 4 */
__be16 sb_versionnum; /* 100 2 */
__be16 sb_sectsize; /* 102 2 */
__be16 sb_inodesize; /* 104 2 */
__be16 sb_inopblock; /* 106 2 */
char sb_fname[12]; /* 108 12 */
__u8 sb_blocklog; /* 120 1 */
__u8 sb_sectlog; /* 121 1 */
__u8 sb_inodelog; /* 122 1 */
__u8 sb_inopblog; /* 123 1 */
__u8 sb_agblklog; /* 124 1 */
__u8 sb_rextslog; /* 125 1 */
__u8 sb_inprogress; /* 126 1 */
__u8 sb_imax_pct; /* 127 1 */
/* --- cacheline 2 boundary (128 bytes) --- */
__be64 sb_icount; /* 128 8 */
__be64 sb_ifree; /* 136 8 */
__be64 sb_fdblocks; /* 144 8 */
__be64 sb_frextents; /* 152 8 */
__be64 sb_uquotino; /* 160 8 */
__be64 sb_gquotino; /* 168 8 */
__be16 sb_qflags; /* 176 2 */
__u8 sb_flags; /* 178 1 */
__u8 sb_shared_vn; /* 179 1 */
__be32 sb_inoalignmt; /* 180 4 */
__be32 sb_unit; /* 184 4 */
__be32 sb_width; /* 188 4 */
/* --- cacheline 3 boundary (192 bytes) --- */
__u8 sb_dirblklog; /* 192 1 */
__u8 sb_logsectlog; /* 193 1 */
__be16 sb_logsectsize; /* 194 2 */
__be32 sb_logsunit; /* 196 4 */
__be32 sb_features2; /* 200 4 */
__be32 sb_bad_features2; /* 204 4 */
/* size: 208, cachelines: 4 */
/* last cacheline: 16 bytes */
};
struct xfs_log_item {
xfs_ail_entry_t li_ail; /* 0 8 */
xfs_lsn_t li_lsn; /* 8 8 */
struct xfs_log_item_desc * li_desc; /* 16 4 */
struct xfs_mount * li_mountp; /* 20 4 */
uint li_type; /* 24 4 */
uint li_flags; /* 28 4 */
struct xfs_log_item * li_bio_list; /* 32 4 */
void (*li_cb)(struct xfs_buf *, struct xfs_log_item *); /* 36 4 */
struct xfs_item_ops * li_ops; /* 40 4 */
/* size: 48, cachelines: 1 */
/* padding: 4 */
/* last cacheline: 48 bytes */
};
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-03-19 5:11 ` Eric Sandeen
@ 2008-03-19 5:31 ` Eric Sandeen
2008-03-20 0:35 ` Timothy Shimmin
1 sibling, 0 replies; 47+ messages in thread
From: Eric Sandeen @ 2008-03-19 5:31 UTC (permalink / raw)
To: Andre Draszik; +Cc: xfs
Eric Sandeen wrote:
> Eric Sandeen wrote:
>
>> I've helpfully provided structure layouts for the structures you mention
>> in the attached files, for your diffing pleasure. I think you'll find
>> that it's not exactly as you described.
>
> Ah hell the arm structs I attached were for oldabi. It's what I get for
> saving this fun work for late at night ;)
>
> Attached are eabi structs; still only xfs_dir2_data_entry, xfs_dinode
> and xfs_log_item seem to be affected by end-of-struct padding, of the
> structures you mention. And xfs_log_item isn't a disk structure...
>
> which brings me back to, what specific failures do you see as a result
> of end-of-struct padding on these structs?
... especially since the layout is identical to ia64, padding and all!
Ok must.. stop.. replying.. to.. self.
-Eric
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-03-19 0:23 ` Josef 'Jeff' Sipek
@ 2008-03-19 11:21 ` Luca Olivetti
2008-03-19 12:53 ` Eric Sandeen
0 siblings, 1 reply; 47+ messages in thread
From: Luca Olivetti @ 2008-03-19 11:21 UTC (permalink / raw)
To: xfs
En/na Josef 'Jeff' Sipek ha escrit:
> Thanks for the heads up wrt ARM EABI.
Well, I have a linkstation lspro, even if it's running now "freelink"
(i.e. debian, oabi, for the linkstation
http://buffalo.nas-central.org/index.php/FreeLink), it's using the
stock, eabi[*], kernel (Linux lspro 2.6.12.6-arm1 #2 Mon Jul 23 22:35:39
CEST 2007 armv5tejl GNU/Linux) and xfs works just fine.
[*] though I think, but I'm not sure, it was not the real thing but
something that marvell patched in.
However, any later kernel I tried "breaks" xfs (that's why I originally
subscribed to this list), i.e. I cannot see the contents of some directories
(more details here:
http://buffalo.nas-central.org/forums/viewtopic.php?p=35061#p35061)
The strange thing is that I can mount the failing image on i386, so it
probably has the correct structures on disk.
Maybe looking at what marvell/buffalo patched in that kernel could give
some insight on the xfs issues with arm.
Bye
--
Luca
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-03-19 11:21 ` Luca Olivetti
@ 2008-03-19 12:53 ` Eric Sandeen
2008-03-19 14:11 ` Luca Olivetti
[not found] ` <47E11F4A.3090205@ventoso.org>
0 siblings, 2 replies; 47+ messages in thread
From: Eric Sandeen @ 2008-03-19 12:53 UTC (permalink / raw)
To: Luca Olivetti; +Cc: xfs
Luca Olivetti wrote:
> En/na Josef 'Jeff' Sipek ha escrit:
>
>
>> Thanks for the heads up wrt ARM EABI.
>
> Well, I have a linkstation lspro, even if it's running now "freelink"
> (i.e. debian, oabi, for the linkstation
> http://buffalo.nas-central.org/index.php/FreeLink), it's using the
> stock, eabi[*], kernel (Linux lspro 2.6.12.6-arm1 #2 Mon Jul 23 22:35:39
> CEST 2007 armv5tejl GNU/Linux) and xfs works just fine.
yeah, it should. For my list of on-disk structures, arm eabi structure
layout is identical to ia64 - I don't think any heads up is needed.
> [*] though I think, but I'm not sure, it was not the real thing but
> something that marvell patched in.
>
> However, any later kernel I tried "breaks" xfs (that's why I originally
> subscribed to this list), i.e. I cannot see the contents of some directories
> (more details here:
> http://buffalo.nas-central.org/forums/viewtopic.php?p=35061#p35061)
do you still have that small fs image? I'll take a look. There was
also an arm get_unaligned issue which hit xfs in another spot,
http://marc.info/?l=git-commits-head&m=120433318323826&w=3
might be worth seeing if you still have trouble with that fix in place
(which is slated for 2.6.25)
-Eric
> The strange thing is that I can mount the failing image on i386, so it
> probably has the correct structures on disk.
>
> Maybe looking at what marvell/buffalo patched in that kernel could give
> some insight on the xfs issues with arm.
> Bye
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-03-19 12:53 ` Eric Sandeen
@ 2008-03-19 14:11 ` Luca Olivetti
[not found] ` <47E11F4A.3090205@ventoso.org>
1 sibling, 0 replies; 47+ messages in thread
From: Luca Olivetti @ 2008-03-19 14:11 UTC (permalink / raw)
To: xfs
En/na Eric Sandeen ha escrit:
>> However, any later kernel I tried "breaks" xfs (that's why I originally
>> subscribed to this list), i.e. I cannot see the contents of some directories
>> (more details here:
>> http://buffalo.nas-central.org/forums/viewtopic.php?p=35061#p35061)
>
> do you still have that small fs image? I'll take a look. There was
> also an arm get_unaligned issue which hit xfs in another spot,
> http://marc.info/?l=git-commits-head&m=120433318323826&w=3
Sure, I'll send you privately a link
> might be worth seeing if you still have trouble with that fix in place
> (which is slated for 2.6.25)
It's not that easy for me to test, since the linkstation is my home
server :-(
Bye
--
Luca
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
[not found] ` <47E12D20.4010901@sandeen.net>
@ 2008-03-19 15:34 ` Luca Olivetti
2008-03-19 15:40 ` Eric Sandeen
[not found] ` <47E14FF1.2020100@sandeen.net>
0 siblings, 2 replies; 47+ messages in thread
From: Luca Olivetti @ 2008-03-19 15:34 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs
En/na Eric Sandeen ha escrit:
[posting also to the list since I think it may be interesting for
everybody, with sensitive information removed]
> Luca Olivetti wrote:
>> En/na Eric Sandeen ha escrit:
>>
>>> do you still have that small fs image?
>> Here's the link
>> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>>
>> Please tell me when you have downloaded it, as I'm not sure the image is
>> completely safe, so I don't like having it online.
>>
>> Bye
>
> So, made an xfs_metadump image of that (just smaller, easier to move
> around):
>
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
> (don't worry, it's not linked from anywhere, I can take it down when you
> grab it) and then:
>
> bunzip2 sda2-meta.img.bz2
> xfs_mdrestore sda2-meta.img sda2.img
> mkdir mnt
> mount -o loop sda2.img mnt/
> ls mnt
> ls mnt/sbin
>
> and this all worked fine for me on 2.6.25, eabi.
good to know!
>
> Linux fedora-arm 2.6.25-rc2 #2 Sat Feb 23 13:58:22 CST 2008 armv5tejl
> armv5tejl armv5tejl GNU/Linux
>
> Can you try the same steps on your box?
I'll report your result on the nas-central.org forum and I'll check
what's the status of 2.6.25-rc2 on the linkstation (though I see that
the orion.git repository is only updated to rc1).
If I find that it's possible to boot this kernel with no (or little ;-)
risk I'll try it.
Bye
--
Luca
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-03-19 15:34 ` Luca Olivetti
@ 2008-03-19 15:40 ` Eric Sandeen
[not found] ` <47E14FF1.2020100@sandeen.net>
1 sibling, 0 replies; 47+ messages in thread
From: Eric Sandeen @ 2008-03-19 15:40 UTC (permalink / raw)
To: Luca Olivetti; +Cc: xfs
Luca Olivetti wrote:
>> Can you try the same steps on your box?
>
> I'll report your result on the nas-central.org forum and I'll check
> what's the status of 2.6.25-rc2 on the linkstation (though I see that
> the orion.git repository is only updated to rc1).
> If I find that it's possible to boot this kernel with no (or little ;-)
> risk I'll try it.
You might also try that same image on your older kernel, to be sure the
test is valid (i.e., my test sequence still breaks for you on the old
kernel).
-Eric
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
[not found] ` <47E14FF1.2020100@sandeen.net>
@ 2008-03-19 18:24 ` Luca Olivetti
0 siblings, 0 replies; 47+ messages in thread
From: Luca Olivetti @ 2008-03-19 18:24 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs
El Wed, 19 Mar 2008 12:40:01 -0500
Eric Sandeen <sandeen@sandeen.net> escribió:
> Luca Olivetti wrote:
>
> > I'll report your result on the nas-central.org forum and I'll check
> > what's the status of 2.6.25-rc2 on the linkstation (though I see
> > that the orion.git repository is only updated to rc1).
> > If I find that it's possible to boot this kernel with no (or
> > little ;-) risk I'll try it.
> >
> > Bye
>
> FWIW... I think you guys would have much more luck if you bring these
> problems to the xfs list. Keeping them on the forums pretty much
> ensures that no xfs developer will ever see them. :)
Sure, but I'm not a developer, just a lurker
that reacted to the trigger word "arm" ;-) I'm just posting to the forum to know the status of the kernel for the
linkstation.
I think that the developers are subscribed to this list and exposed
some of the problem with the linkstation a while ago.
Bye
--
Luca
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-03-19 5:11 ` Eric Sandeen
2008-03-19 5:31 ` Eric Sandeen
@ 2008-03-20 0:35 ` Timothy Shimmin
1 sibling, 0 replies; 47+ messages in thread
From: Timothy Shimmin @ 2008-03-20 0:35 UTC (permalink / raw)
To: Eric Sandeen; +Cc: Andre Draszik, xfs
Eric Sandeen wrote:
> Eric Sandeen wrote:
>
>> I've helpfully provided structure layouts for the structures you mention
>> in the attached files, for your diffing pleasure. I think you'll find
>> that it's not exactly as you described.
>
> Ah hell the arm structs I attached were for oldabi. It's what I get for
> saving this fun work for late at night ;)
>
> Attached are eabi structs; still only xfs_dir2_data_entry, xfs_dinode
> and xfs_log_item seem to be affected by end-of-struct padding, of the
> structures you mention. And xfs_log_item isn't a disk structure...
>
> which brings me back to, what specific failures do you see as a result
> of end-of-struct padding on these structs?
>
Which reminds me when writing 122 that I noticed with xfs_dinode
but didn't think the end of struct padding would affect things -
remember chatting to Nathan at the time IIRC.
Actually, now that I think about it (Tim waking up a bit :-),
the xfs_dinode_t is of limited value, because a lot of those
union fields at the end aren't actually used directly and just
give an indication of what the layout is like.
We are in the variable literal area there.
--Tim
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-03-15 3:24 Eric Sandeen
2008-03-15 4:17 ` Josef 'Jeff' Sipek
@ 2008-03-20 3:02 ` Eric Sandeen
2008-05-05 7:38 ` Barry Naujok
2008-06-06 14:15 ` Eric Sandeen
2008-04-09 19:53 ` Eric Sandeen
2008-04-23 0:58 ` Eric Sandeen
3 siblings, 2 replies; 47+ messages in thread
From: Eric Sandeen @ 2008-03-20 3:02 UTC (permalink / raw)
To: xfs-oss
Here's the userspace side.
Jeff, I guess this means you have more work to do ;)
-Eric
Index: xfs-cmds/xfsprogs/include/platform_defs.h.in
===================================================================
--- xfs-cmds.orig/xfsprogs/include/platform_defs.h.in
+++ xfs-cmds/xfsprogs/include/platform_defs.h.in
@@ -147,4 +147,11 @@ typedef unsigned long long __psunsigned_
| (minor&IRIX_DEV_MAXMIN)))
#define IRIX_DEV_TO_KDEVT(dev) makedev(IRIX_DEV_MAJOR(dev),IRIX_DEV_MINOR(dev))
+/* ARM old ABI has some weird alignment/padding */
+#if defined(__arm__) && !defined(__ARM_EABI__)
+#define __arch_pack __attribute__((packed))
+#else
+#define __arch_pack
+#endif
+
#endif /* __XFS_PLATFORM_DEFS_H__ */
Index: xfs-cmds/xfsprogs/include/xfs_dir2_sf.h
===================================================================
--- xfs-cmds.orig/xfsprogs/include/xfs_dir2_sf.h
+++ xfs-cmds/xfsprogs/include/xfs_dir2_sf.h
@@ -62,7 +62,7 @@ typedef union {
* Normalized offset (in a data block) of the entry, really xfs_dir2_data_off_t.
* Only need 16 bits, this is the byte offset into the single block form.
*/
-typedef struct { __uint8_t i[2]; } xfs_dir2_sf_off_t;
+typedef struct { __uint8_t i[2]; } __arch_pack xfs_dir2_sf_off_t;
/*
* The parent directory has a dedicated field, and the self-pointer must
@@ -76,14 +76,14 @@ typedef struct xfs_dir2_sf_hdr {
__uint8_t count; /* count of entries */
__uint8_t i8count; /* count of 8-byte inode #s */
xfs_dir2_inou_t parent; /* parent dir inode number */
-} xfs_dir2_sf_hdr_t;
+} __arch_pack xfs_dir2_sf_hdr_t;
typedef struct xfs_dir2_sf_entry {
__uint8_t namelen; /* actual name length */
xfs_dir2_sf_off_t offset; /* saved offset */
__uint8_t name[1]; /* name, variable size */
xfs_dir2_inou_t inumber; /* inode number, var. offset */
-} xfs_dir2_sf_entry_t;
+} __arch_pack xfs_dir2_sf_entry_t;
typedef struct xfs_dir2_sf {
xfs_dir2_sf_hdr_t hdr; /* shortform header */
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-03-15 3:24 Eric Sandeen
2008-03-15 4:17 ` Josef 'Jeff' Sipek
2008-03-20 3:02 ` Eric Sandeen
@ 2008-04-09 19:53 ` Eric Sandeen
2008-04-23 0:58 ` Eric Sandeen
3 siblings, 0 replies; 47+ messages in thread
From: Eric Sandeen @ 2008-04-09 19:53 UTC (permalink / raw)
To: xfs-oss
Eric Sandeen wrote:
> This should fix the longstanding issues with xfs and old ABI
> arm boxes, which lead to various asserts and xfs shutdowns,
> and for which an (incorrect) patch has been floating around
> for years. (Said patch made ARM internally consistent, but
> altered the normal xfs on-disk format such that it looked
> corrupted on other architectures):
> http://lists.arm.linux.org.uk/lurker/message/20040311.002034.5ecf21a2.html
So, I'm wondering what the sgi guys think of this. I know Jeff wants an
all-singing, all-dancing pack-and-align patch, and maybe when it's ready
it could replace this, but I wonder if maybe now this could go in just,
you know, to fix the bug? :)
Thanks,
-Eric
> Old ABI ARM has interesting packing & padding; for example
> on ARM old abi:
>
> struct xfs_dir2_sf_entry {
> __uint8_t namelen; /* 0 1 */
>
> /* XXX 3 bytes hole, try to pack */
>
> xfs_dir2_sf_off_t offset; /* 4 4 */
> __uint8_t name[1]; /* 8 1 */
>
> /* XXX 3 bytes hole, try to pack */
>
> xfs_dir2_inou_t inumber; /* 12 8 */
>
> /* size: 20, cachelines: 1 */
> /* sum members: 14, holes: 2, sum holes: 6 */
> /* last cacheline: 20 bytes */
> };
>
> but on x86:
>
> struct xfs_dir2_sf_entry {
> __uint8_t namelen; /* 0 1 */
> xfs_dir2_sf_off_t offset; /* 1 2 */
> __uint8_t name[1]; /* 3 1 */
> xfs_dir2_inou_t inumber; /* 4 8 */
>
> /* size: 12, cachelines: 1 */
> /* last cacheline: 12 bytes */
> };
>
> ... this sort of discrepancy leads to problems.
>
> I've verified this patch by comparing the on-disk structure
> layouts using pahole from the dwarves package, as well as
> running through a bit of xfsqa under qemu-arm, modified so
> that the check/repair phase after each test actually executes
> check/repair from the x86 host, on the filesystem populated
> by the arm emulator. Thus far it all looks good.
>
> There are 2 other structures with extra padding at the end,
> but they don't seem to cause trouble. I suppose they could
> be packed as well: xfs_dir2_data_unused_t and xfs_dir2_sf_t.
>
> Note that userspace needs a similar treatment, and any
> filesystems which were running with the previous rogue
> "fix" will now see corruption (either in the kernel, or
> during xfs_repair) with this fix properly in place; it
> may be worth teaching xfs_repair to identify and fix that
> specific issue.
>
> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
>
> ---
>
> Index: linux-2.6.24/fs/xfs/linux-2.6/xfs_linux.h
> ===================================================================
> --- linux-2.6.24.orig/fs/xfs/linux-2.6/xfs_linux.h
> +++ linux-2.6.24/fs/xfs/linux-2.6/xfs_linux.h
> @@ -300,4 +300,11 @@ static inline __uint64_t howmany_64(__ui
> return x;
> }
>
> +/* ARM old ABI has some weird alignment/padding */
> +#if defined(__arm__) && !defined(__ARM_EABI__)
> +#define __arch_pack __attribute__((packed))
> +#else
> +#define __arch_pack
> +#endif
> +
> #endif /* __XFS_LINUX__ */
> Index: linux-2.6.24/fs/xfs/xfs_dir2_sf.h
> ===================================================================
> --- linux-2.6.24.orig/fs/xfs/xfs_dir2_sf.h
> +++ linux-2.6.24/fs/xfs/xfs_dir2_sf.h
> @@ -62,7 +62,7 @@ typedef union {
> * Normalized offset (in a data block) of the entry, really xfs_dir2_data_off_t.
> * Only need 16 bits, this is the byte offset into the single block form.
> */
> -typedef struct { __uint8_t i[2]; } xfs_dir2_sf_off_t;
> +typedef struct { __uint8_t i[2]; } __arch_pack xfs_dir2_sf_off_t;
>
> /*
> * The parent directory has a dedicated field, and the self-pointer must
> @@ -76,14 +76,14 @@ typedef struct xfs_dir2_sf_hdr {
> __uint8_t count; /* count of entries */
> __uint8_t i8count; /* count of 8-byte inode #s */
> xfs_dir2_inou_t parent; /* parent dir inode number */
> -} xfs_dir2_sf_hdr_t;
> +} __arch_pack xfs_dir2_sf_hdr_t;
>
> typedef struct xfs_dir2_sf_entry {
> __uint8_t namelen; /* actual name length */
> xfs_dir2_sf_off_t offset; /* saved offset */
> __uint8_t name[1]; /* name, variable size */
> xfs_dir2_inou_t inumber; /* inode number, var. offset */
> -} xfs_dir2_sf_entry_t;
> +} __arch_pack xfs_dir2_sf_entry_t;
>
> typedef struct xfs_dir2_sf {
> xfs_dir2_sf_hdr_t hdr; /* shortform header */
>
>
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-03-15 3:24 Eric Sandeen
` (2 preceding siblings ...)
2008-04-09 19:53 ` Eric Sandeen
@ 2008-04-23 0:58 ` Eric Sandeen
2008-05-02 20:55 ` Eric Sandeen
3 siblings, 1 reply; 47+ messages in thread
From: Eric Sandeen @ 2008-04-23 0:58 UTC (permalink / raw)
To: xfs-oss
Eric Sandeen wrote:
> This should fix the longstanding issues with xfs and old ABI
> arm boxes, which lead to various asserts and xfs shutdowns,
> and for which an (incorrect) patch has been floating around
> for years. (Said patch made ARM internally consistent, but
> altered the normal xfs on-disk format such that it looked
> corrupted on other architectures):
> http://lists.arm.linux.org.uk/lurker/message/20040311.002034.5ecf21a2.html
ping again...
There is still the cache flushing issue, I guess, but I think the
on-disk alignment is still worth fixing.
Oh, I'm sorry Jeff - I meant "fixing." :)
Thanks,
-Eric
> Old ABI ARM has interesting packing & padding; for example
> on ARM old abi:
>
> struct xfs_dir2_sf_entry {
> __uint8_t namelen; /* 0 1 */
>
> /* XXX 3 bytes hole, try to pack */
>
> xfs_dir2_sf_off_t offset; /* 4 4 */
> __uint8_t name[1]; /* 8 1 */
>
> /* XXX 3 bytes hole, try to pack */
>
> xfs_dir2_inou_t inumber; /* 12 8 */
>
> /* size: 20, cachelines: 1 */
> /* sum members: 14, holes: 2, sum holes: 6 */
> /* last cacheline: 20 bytes */
> };
>
> but on x86:
>
> struct xfs_dir2_sf_entry {
> __uint8_t namelen; /* 0 1 */
> xfs_dir2_sf_off_t offset; /* 1 2 */
> __uint8_t name[1]; /* 3 1 */
> xfs_dir2_inou_t inumber; /* 4 8 */
>
> /* size: 12, cachelines: 1 */
> /* last cacheline: 12 bytes */
> };
>
> ... this sort of discrepancy leads to problems.
>
> I've verified this patch by comparing the on-disk structure
> layouts using pahole from the dwarves package, as well as
> running through a bit of xfsqa under qemu-arm, modified so
> that the check/repair phase after each test actually executes
> check/repair from the x86 host, on the filesystem populated
> by the arm emulator. Thus far it all looks good.
>
> There are 2 other structures with extra padding at the end,
> but they don't seem to cause trouble. I suppose they could
> be packed as well: xfs_dir2_data_unused_t and xfs_dir2_sf_t.
>
> Note that userspace needs a similar treatment, and any
> filesystems which were running with the previous rogue
> "fix" will now see corruption (either in the kernel, or
> during xfs_repair) with this fix properly in place; it
> may be worth teaching xfs_repair to identify and fix that
> specific issue.
>
> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
>
> ---
>
> Index: linux-2.6.24/fs/xfs/linux-2.6/xfs_linux.h
> ===================================================================
> --- linux-2.6.24.orig/fs/xfs/linux-2.6/xfs_linux.h
> +++ linux-2.6.24/fs/xfs/linux-2.6/xfs_linux.h
> @@ -300,4 +300,11 @@ static inline __uint64_t howmany_64(__ui
> return x;
> }
>
> +/* ARM old ABI has some weird alignment/padding */
> +#if defined(__arm__) && !defined(__ARM_EABI__)
> +#define __arch_pack __attribute__((packed))
> +#else
> +#define __arch_pack
> +#endif
> +
> #endif /* __XFS_LINUX__ */
> Index: linux-2.6.24/fs/xfs/xfs_dir2_sf.h
> ===================================================================
> --- linux-2.6.24.orig/fs/xfs/xfs_dir2_sf.h
> +++ linux-2.6.24/fs/xfs/xfs_dir2_sf.h
> @@ -62,7 +62,7 @@ typedef union {
> * Normalized offset (in a data block) of the entry, really xfs_dir2_data_off_t.
> * Only need 16 bits, this is the byte offset into the single block form.
> */
> -typedef struct { __uint8_t i[2]; } xfs_dir2_sf_off_t;
> +typedef struct { __uint8_t i[2]; } __arch_pack xfs_dir2_sf_off_t;
>
> /*
> * The parent directory has a dedicated field, and the self-pointer must
> @@ -76,14 +76,14 @@ typedef struct xfs_dir2_sf_hdr {
> __uint8_t count; /* count of entries */
> __uint8_t i8count; /* count of 8-byte inode #s */
> xfs_dir2_inou_t parent; /* parent dir inode number */
> -} xfs_dir2_sf_hdr_t;
> +} __arch_pack xfs_dir2_sf_hdr_t;
>
> typedef struct xfs_dir2_sf_entry {
> __uint8_t namelen; /* actual name length */
> xfs_dir2_sf_off_t offset; /* saved offset */
> __uint8_t name[1]; /* name, variable size */
> xfs_dir2_inou_t inumber; /* inode number, var. offset */
> -} xfs_dir2_sf_entry_t;
> +} __arch_pack xfs_dir2_sf_entry_t;
>
> typedef struct xfs_dir2_sf {
> xfs_dir2_sf_hdr_t hdr; /* shortform header */
>
>
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-04-23 0:58 ` Eric Sandeen
@ 2008-05-02 20:55 ` Eric Sandeen
2008-05-05 7:08 ` David Chinner
0 siblings, 1 reply; 47+ messages in thread
From: Eric Sandeen @ 2008-05-02 20:55 UTC (permalink / raw)
To: xfs-oss
Eric Sandeen wrote:
> Eric Sandeen wrote:
>> This should fix the longstanding issues with xfs and old ABI
>> arm boxes, which lead to various asserts and xfs shutdowns,
>> and for which an (incorrect) patch has been floating around
>> for years. (Said patch made ARM internally consistent, but
>> altered the normal xfs on-disk format such that it looked
>> corrupted on other architectures):
>> http://lists.arm.linux.org.uk/lurker/message/20040311.002034.5ecf21a2.html
>
> ping again...
ping #3...
> There is still the cache flushing issue, I guess, but I think the
> on-disk alignment is still worth fixing.
>
> Oh, I'm sorry Jeff - I meant "fixing." :)
>
> Thanks,
> -Eric
>
>> Old ABI ARM has interesting packing & padding; for example
>> on ARM old abi:
>>
>> struct xfs_dir2_sf_entry {
>> __uint8_t namelen; /* 0 1 */
>>
>> /* XXX 3 bytes hole, try to pack */
>>
>> xfs_dir2_sf_off_t offset; /* 4 4 */
>> __uint8_t name[1]; /* 8 1 */
>>
>> /* XXX 3 bytes hole, try to pack */
>>
>> xfs_dir2_inou_t inumber; /* 12 8 */
>>
>> /* size: 20, cachelines: 1 */
>> /* sum members: 14, holes: 2, sum holes: 6 */
>> /* last cacheline: 20 bytes */
>> };
>>
>> but on x86:
>>
>> struct xfs_dir2_sf_entry {
>> __uint8_t namelen; /* 0 1 */
>> xfs_dir2_sf_off_t offset; /* 1 2 */
>> __uint8_t name[1]; /* 3 1 */
>> xfs_dir2_inou_t inumber; /* 4 8 */
>>
>> /* size: 12, cachelines: 1 */
>> /* last cacheline: 12 bytes */
>> };
>>
>> ... this sort of discrepancy leads to problems.
>>
>> I've verified this patch by comparing the on-disk structure
>> layouts using pahole from the dwarves package, as well as
>> running through a bit of xfsqa under qemu-arm, modified so
>> that the check/repair phase after each test actually executes
>> check/repair from the x86 host, on the filesystem populated
>> by the arm emulator. Thus far it all looks good.
>>
>> There are 2 other structures with extra padding at the end,
>> but they don't seem to cause trouble. I suppose they could
>> be packed as well: xfs_dir2_data_unused_t and xfs_dir2_sf_t.
>>
>> Note that userspace needs a similar treatment, and any
>> filesystems which were running with the previous rogue
>> "fix" will now see corruption (either in the kernel, or
>> during xfs_repair) with this fix properly in place; it
>> may be worth teaching xfs_repair to identify and fix that
>> specific issue.
>>
>> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
>>
>> ---
>>
>> Index: linux-2.6.24/fs/xfs/linux-2.6/xfs_linux.h
>> ===================================================================
>> --- linux-2.6.24.orig/fs/xfs/linux-2.6/xfs_linux.h
>> +++ linux-2.6.24/fs/xfs/linux-2.6/xfs_linux.h
>> @@ -300,4 +300,11 @@ static inline __uint64_t howmany_64(__ui
>> return x;
>> }
>>
>> +/* ARM old ABI has some weird alignment/padding */
>> +#if defined(__arm__) && !defined(__ARM_EABI__)
>> +#define __arch_pack __attribute__((packed))
>> +#else
>> +#define __arch_pack
>> +#endif
>> +
>> #endif /* __XFS_LINUX__ */
>> Index: linux-2.6.24/fs/xfs/xfs_dir2_sf.h
>> ===================================================================
>> --- linux-2.6.24.orig/fs/xfs/xfs_dir2_sf.h
>> +++ linux-2.6.24/fs/xfs/xfs_dir2_sf.h
>> @@ -62,7 +62,7 @@ typedef union {
>> * Normalized offset (in a data block) of the entry, really xfs_dir2_data_off_t.
>> * Only need 16 bits, this is the byte offset into the single block form.
>> */
>> -typedef struct { __uint8_t i[2]; } xfs_dir2_sf_off_t;
>> +typedef struct { __uint8_t i[2]; } __arch_pack xfs_dir2_sf_off_t;
>>
>> /*
>> * The parent directory has a dedicated field, and the self-pointer must
>> @@ -76,14 +76,14 @@ typedef struct xfs_dir2_sf_hdr {
>> __uint8_t count; /* count of entries */
>> __uint8_t i8count; /* count of 8-byte inode #s */
>> xfs_dir2_inou_t parent; /* parent dir inode number */
>> -} xfs_dir2_sf_hdr_t;
>> +} __arch_pack xfs_dir2_sf_hdr_t;
>>
>> typedef struct xfs_dir2_sf_entry {
>> __uint8_t namelen; /* actual name length */
>> xfs_dir2_sf_off_t offset; /* saved offset */
>> __uint8_t name[1]; /* name, variable size */
>> xfs_dir2_inou_t inumber; /* inode number, var. offset */
>> -} xfs_dir2_sf_entry_t;
>> +} __arch_pack xfs_dir2_sf_entry_t;
>>
>> typedef struct xfs_dir2_sf {
>> xfs_dir2_sf_hdr_t hdr; /* shortform header */
>>
>>
>>
>
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-05-02 20:55 ` Eric Sandeen
@ 2008-05-05 7:08 ` David Chinner
2008-05-05 13:07 ` Eric Sandeen
2008-05-06 4:21 ` Timothy Shimmin
0 siblings, 2 replies; 47+ messages in thread
From: David Chinner @ 2008-05-05 7:08 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs-oss
On Fri, May 02, 2008 at 03:55:45PM -0500, Eric Sandeen wrote:
> Eric Sandeen wrote:
> > Eric Sandeen wrote:
> >> This should fix the longstanding issues with xfs and old ABI
> >> arm boxes, which lead to various asserts and xfs shutdowns,
> >> and for which an (incorrect) patch has been floating around
> >> for years. (Said patch made ARM internally consistent, but
> >> altered the normal xfs on-disk format such that it looked
> >> corrupted on other architectures):
> >> http://lists.arm.linux.org.uk/lurker/message/20040311.002034.5ecf21a2.html
> >
> > ping again...
>
> ping #3...
<sigh>
Looks like if I don't pick it up then nobody is going to answer.
I'll run it through my ia64 and x86_64 test boxes and if it's ok
then I'll commit it.
Did you ever send an equivalent userspace patch?
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-03-20 3:02 ` Eric Sandeen
@ 2008-05-05 7:38 ` Barry Naujok
2008-06-06 14:15 ` Eric Sandeen
1 sibling, 0 replies; 47+ messages in thread
From: Barry Naujok @ 2008-05-05 7:38 UTC (permalink / raw)
To: xfs-oss; +Cc: David Chinner
On Thu, 20 Mar 2008 14:02:27 +1100, Eric Sandeen <sandeen@sandeen.net>
wrote:
> Here's the userspace side.
Dave, yes he did!
> Jeff, I guess this means you have more work to do ;)
>
> -Eric
>
>
> Index: xfs-cmds/xfsprogs/include/platform_defs.h.in
> ===================================================================
> --- xfs-cmds.orig/xfsprogs/include/platform_defs.h.in
> +++ xfs-cmds/xfsprogs/include/platform_defs.h.in
> @@ -147,4 +147,11 @@ typedef unsigned long long __psunsigned_
> | (minor&IRIX_DEV_MAXMIN)))
> #define
> IRIX_DEV_TO_KDEVT(dev) makedev(IRIX_DEV_MAJOR(dev),IRIX_DEV_MINOR(dev))
> +/* ARM old ABI has some weird alignment/padding */
> +#if defined(__arm__) && !defined(__ARM_EABI__)
> +#define __arch_pack __attribute__((packed))
> +#else
> +#define __arch_pack
> +#endif
> +
> #endif /* __XFS_PLATFORM_DEFS_H__ */
> Index: xfs-cmds/xfsprogs/include/xfs_dir2_sf.h
> ===================================================================
> --- xfs-cmds.orig/xfsprogs/include/xfs_dir2_sf.h
> +++ xfs-cmds/xfsprogs/include/xfs_dir2_sf.h
> @@ -62,7 +62,7 @@ typedef union {
> * Normalized offset (in a data block) of the entry, really
> xfs_dir2_data_off_t.
> * Only need 16 bits, this is the byte offset into the single block
> form.
> */
> -typedef struct { __uint8_t i[2]; } xfs_dir2_sf_off_t;
> +typedef struct { __uint8_t i[2]; } __arch_pack xfs_dir2_sf_off_t;
> /*
> * The parent directory has a dedicated field, and the self-pointer must
> @@ -76,14 +76,14 @@ typedef struct xfs_dir2_sf_hdr {
> __uint8_t count; /* count of entries */
> __uint8_t i8count; /* count of 8-byte inode #s */
> xfs_dir2_inou_t parent; /* parent dir inode number */
> -} xfs_dir2_sf_hdr_t;
> +} __arch_pack xfs_dir2_sf_hdr_t;
> typedef struct xfs_dir2_sf_entry {
> __uint8_t namelen; /* actual name length */
> xfs_dir2_sf_off_t offset; /* saved offset */
> __uint8_t name[1]; /* name, variable size */
> xfs_dir2_inou_t inumber; /* inode number, var. offset */
> -} xfs_dir2_sf_entry_t;
> +} __arch_pack xfs_dir2_sf_entry_t;
> typedef struct xfs_dir2_sf {
> xfs_dir2_sf_hdr_t hdr; /* shortform header */
>
>
>
>
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-05-05 7:08 ` David Chinner
@ 2008-05-05 13:07 ` Eric Sandeen
2008-05-06 4:21 ` Timothy Shimmin
1 sibling, 0 replies; 47+ messages in thread
From: Eric Sandeen @ 2008-05-05 13:07 UTC (permalink / raw)
To: David Chinner; +Cc: xfs-oss
David Chinner wrote:
> On Fri, May 02, 2008 at 03:55:45PM -0500, Eric Sandeen wrote:
>> Eric Sandeen wrote:
>>> Eric Sandeen wrote:
>>>> This should fix the longstanding issues with xfs and old ABI
>>>> arm boxes, which lead to various asserts and xfs shutdowns,
>>>> and for which an (incorrect) patch has been floating around
>>>> for years. (Said patch made ARM internally consistent, but
>>>> altered the normal xfs on-disk format such that it looked
>>>> corrupted on other architectures):
>>>> http://lists.arm.linux.org.uk/lurker/message/20040311.002034.5ecf21a2.html
>>> ping again...
>> ping #3...
>
> <sigh>
>
> Looks like if I don't pick it up then nobody is going to answer.
> I'll run it through my ia64 and x86_64 test boxes and if it's ok
> then I'll commit it.
>
> Did you ever send an equivalent userspace patch?
I did ... I can resend too.
-Eric
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-05-05 7:08 ` David Chinner
2008-05-05 13:07 ` Eric Sandeen
@ 2008-05-06 4:21 ` Timothy Shimmin
2008-05-06 13:43 ` Eric Sandeen
1 sibling, 1 reply; 47+ messages in thread
From: Timothy Shimmin @ 2008-05-06 4:21 UTC (permalink / raw)
To: David Chinner; +Cc: Eric Sandeen, xfs-oss
David Chinner wrote:
> On Fri, May 02, 2008 at 03:55:45PM -0500, Eric Sandeen wrote:
>> Eric Sandeen wrote:
>>> Eric Sandeen wrote:
>>>> This should fix the longstanding issues with xfs and old ABI
>>>> arm boxes, which lead to various asserts and xfs shutdowns,
>>>> and for which an (incorrect) patch has been floating around
>>>> for years. (Said patch made ARM internally consistent, but
>>>> altered the normal xfs on-disk format such that it looked
>>>> corrupted on other architectures):
>>>> http://lists.arm.linux.org.uk/lurker/message/20040311.002034.5ecf21a2.html
>>> ping again...
>> ping #3...
>
> <sigh>
>
> Looks like if I don't pick it up then nobody is going to answer.
> I'll run it through my ia64 and x86_64 test boxes and if it's ok
> then I'll commit it.
>
As it only defines __arch_pack for __arm__,
I literally can't see how on earth it won't pass for ia64 and x86-64,
though I realise (I guess) we need to test to be sure :)
So Eric tested this on qemu-arm with success.
And there was a little debate over whether ARM-EABI would work
currently in XFS,
with Luca Olivetti saying in one kernel he has success and in another
he doesn't. And Andre Draszik saying that for ARM-EABI it wouldn't
work.
That aside, Eric has tried out on ARM without EABI (old ABI) and has had success,
so it is at least useful for this case.
I don't see us doing any arm testing for this ourselves :)
--Tim
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-05-06 4:21 ` Timothy Shimmin
@ 2008-05-06 13:43 ` Eric Sandeen
2008-06-05 5:38 ` Eric Sandeen
0 siblings, 1 reply; 47+ messages in thread
From: Eric Sandeen @ 2008-05-06 13:43 UTC (permalink / raw)
To: Timothy Shimmin; +Cc: David Chinner, xfs-oss
Timothy Shimmin wrote:
> David Chinner wrote:
>> On Fri, May 02, 2008 at 03:55:45PM -0500, Eric Sandeen wrote:
>>> Eric Sandeen wrote:
>>>> Eric Sandeen wrote:
>>>>> This should fix the longstanding issues with xfs and old ABI
>>>>> arm boxes, which lead to various asserts and xfs shutdowns,
>>>>> and for which an (incorrect) patch has been floating around
>>>>> for years. (Said patch made ARM internally consistent, but
>>>>> altered the normal xfs on-disk format such that it looked
>>>>> corrupted on other architectures):
>>>>> http://lists.arm.linux.org.uk/lurker/message/20040311.002034.5ecf21a2.html
>>>> ping again...
>>> ping #3...
>> <sigh>
>>
>> Looks like if I don't pick it up then nobody is going to answer.
>> I'll run it through my ia64 and x86_64 test boxes and if it's ok
>> then I'll commit it.
>>
> As it only defines __arch_pack for __arm__,
> I literally can't see how on earth it won't pass for ia64 and x86-64,
> though I realise (I guess) we need to test to be sure :)
>
> So Eric tested this on qemu-arm with success.
> And there was a little debate over whether ARM-EABI would work
> currently in XFS,
> with Luca Olivetti saying in one kernel he has success and in another
> he doesn't. And Andre Draszik saying that for ARM-EABI it wouldn't
> work.
The patch should only affect behavior on *old* abi:
+#if defined(__arm__) && !defined(__ARM_EABI__)
it is the only one with the unique alignment that matters here.
There *is* still another issue on some arm chips related to processor
cache flushing; I didn't see the problem in qemu because it the emulator
does not have this behavior.
But, it's a separate issue from the structure alignment this patch
addresses.
One thing at a time. :)
Thanks,
-Eric
> That aside, Eric has tried out on ARM without EABI (old ABI) and has had success,
> so it is at least useful for this case.
> I don't see us doing any arm testing for this ourselves :)
>
> --Tim
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-05-06 13:43 ` Eric Sandeen
@ 2008-06-05 5:38 ` Eric Sandeen
2008-06-05 5:46 ` Mark Goodwin
2008-06-05 5:49 ` Chris Wedgwood
0 siblings, 2 replies; 47+ messages in thread
From: Eric Sandeen @ 2008-06-05 5:38 UTC (permalink / raw)
To: Timothy Shimmin; +Cc: xfs-oss
Eric Sandeen wrote:
> Timothy Shimmin wrote:
>> David Chinner wrote:
>>> On Fri, May 02, 2008 at 03:55:45PM -0500, Eric Sandeen wrote:
>>>> Eric Sandeen wrote:
>>>>> Eric Sandeen wrote:
>>>>>> This should fix the longstanding issues with xfs and old ABI
>>>>>> arm boxes, which lead to various asserts and xfs shutdowns,
>>>>>> and for which an (incorrect) patch has been floating around
>>>>>> for years. (Said patch made ARM internally consistent, but
>>>>>> altered the normal xfs on-disk format such that it looked
>>>>>> corrupted on other architectures):
>>>>>> http://lists.arm.linux.org.uk/lurker/message/20040311.002034.5ecf21a2.html
>>>>> ping again...
>>>> ping #3...
>>> <sigh>
Guys, this is SIMPLE, SAFE, and it fixes a CORRUPTION BUG.
is it EVER going to get checked in?
-Eric
>>> Looks like if I don't pick it up then nobody is going to answer.
>>> I'll run it through my ia64 and x86_64 test boxes and if it's ok
>>> then I'll commit it.
>>>
>> As it only defines __arch_pack for __arm__,
>> I literally can't see how on earth it won't pass for ia64 and x86-64,
>> though I realise (I guess) we need to test to be sure :)
>>
>> So Eric tested this on qemu-arm with success.
>> And there was a little debate over whether ARM-EABI would work
>> currently in XFS,
>> with Luca Olivetti saying in one kernel he has success and in another
>> he doesn't. And Andre Draszik saying that for ARM-EABI it wouldn't
>> work.
>
> The patch should only affect behavior on *old* abi:
>
> +#if defined(__arm__) && !defined(__ARM_EABI__)
>
> it is the only one with the unique alignment that matters here.
>
> There *is* still another issue on some arm chips related to processor
> cache flushing; I didn't see the problem in qemu because it the emulator
> does not have this behavior.
>
> But, it's a separate issue from the structure alignment this patch
> addresses.
>
> One thing at a time. :)
>
> Thanks,
>
> -Eric
>
>> That aside, Eric has tried out on ARM without EABI (old ABI) and has had success,
>> so it is at least useful for this case.
>> I don't see us doing any arm testing for this ourselves :)
>>
>> --Tim
>>
>
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-06-05 5:38 ` Eric Sandeen
@ 2008-06-05 5:46 ` Mark Goodwin
2008-06-05 5:49 ` Eric Sandeen
2008-06-05 5:49 ` Chris Wedgwood
1 sibling, 1 reply; 47+ messages in thread
From: Mark Goodwin @ 2008-06-05 5:46 UTC (permalink / raw)
To: Eric Sandeen; +Cc: Timothy Shimmin, xfs-oss
Eric Sandeen wrote:
> Eric Sandeen wrote:
>> Timothy Shimmin wrote:
>>> David Chinner wrote:
>>>> On Fri, May 02, 2008 at 03:55:45PM -0500, Eric Sandeen wrote:
>>>>> Eric Sandeen wrote:
>>>>>> Eric Sandeen wrote:
>>>>>>> This should fix the longstanding issues with xfs and old ABI
>>>>>>> arm boxes, which lead to various asserts and xfs shutdowns,
>>>>>>> and for which an (incorrect) patch has been floating around
>>>>>>> for years. (Said patch made ARM internally consistent, but
>>>>>>> altered the normal xfs on-disk format such that it looked
>>>>>>> corrupted on other architectures):
>>>>>>> http://lists.arm.linux.org.uk/lurker/message/20040311.002034.5ecf21a2.html
>>>>>> ping again...
>>>>> ping #3...
>>>> <sigh>
>
> Guys, this is SIMPLE, SAFE, and it fixes a CORRUPTION BUG.
> is it EVER going to get checked in?
Please take it in Tim, that nasty CORRUPTION word caught my attention :)
Cheers
>
> -Eric
>
>>>> Looks like if I don't pick it up then nobody is going to answer.
>>>> I'll run it through my ia64 and x86_64 test boxes and if it's ok
>>>> then I'll commit it.
>>>>
>>> As it only defines __arch_pack for __arm__,
>>> I literally can't see how on earth it won't pass for ia64 and x86-64,
>>> though I realise (I guess) we need to test to be sure :)
>>>
>>> So Eric tested this on qemu-arm with success.
>>> And there was a little debate over whether ARM-EABI would work
>>> currently in XFS,
>>> with Luca Olivetti saying in one kernel he has success and in another
>>> he doesn't. And Andre Draszik saying that for ARM-EABI it wouldn't
>>> work.
>> The patch should only affect behavior on *old* abi:
>>
>> +#if defined(__arm__) && !defined(__ARM_EABI__)
>>
>> it is the only one with the unique alignment that matters here.
>>
>> There *is* still another issue on some arm chips related to processor
>> cache flushing; I didn't see the problem in qemu because it the emulator
>> does not have this behavior.
>>
>> But, it's a separate issue from the structure alignment this patch
>> addresses.
>>
>> One thing at a time. :)
>>
>> Thanks,
>>
>> -Eric
>>
>>> That aside, Eric has tried out on ARM without EABI (old ABI) and has had success,
>>> so it is at least useful for this case.
>>> I don't see us doing any arm testing for this ourselves :)
>>>
>>> --Tim
>>>
>>
>
>
--
Mark Goodwin markgw@sgi.com
Engineering Manager for XFS and PCP Phone: +61-3-99631937
SGI Australian Software Group Cell: +61-4-18969583
-------------------------------------------------------------
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-06-05 5:46 ` Mark Goodwin
@ 2008-06-05 5:49 ` Eric Sandeen
2008-06-05 6:02 ` Mark Goodwin
0 siblings, 1 reply; 47+ messages in thread
From: Eric Sandeen @ 2008-06-05 5:49 UTC (permalink / raw)
To: markgw; +Cc: Timothy Shimmin, xfs-oss
Mark Goodwin wrote:
>
> Eric Sandeen wrote:
>> Eric Sandeen wrote:
>>> Timothy Shimmin wrote:
>>>> David Chinner wrote:
>>>>> On Fri, May 02, 2008 at 03:55:45PM -0500, Eric Sandeen wrote:
>>>>>> Eric Sandeen wrote:
>>>>>>> Eric Sandeen wrote:
>>>>>>>> This should fix the longstanding issues with xfs and old ABI
>>>>>>>> arm boxes, which lead to various asserts and xfs shutdowns,
>>>>>>>> and for which an (incorrect) patch has been floating around
>>>>>>>> for years. (Said patch made ARM internally consistent, but
>>>>>>>> altered the normal xfs on-disk format such that it looked
>>>>>>>> corrupted on other architectures):
>>>>>>>> http://lists.arm.linux.org.uk/lurker/message/20040311.002034.5ecf21a2.html
>>>>>>> ping again...
>>>>>> ping #3...
>>>>> <sigh>
>> Guys, this is SIMPLE, SAFE, and it fixes a CORRUPTION BUG.
>> is it EVER going to get checked in?
>
> Please take it in Tim, that nasty CORRUPTION word caught my attention :)
>
> Cheers
heh, thanks Mark. Even though it's only CORRUPTION ON ARM I guess the
shouting worked. :)
Seriously though if you guys have any problems with it please let me
know but I don't want it to just get dropped.
-Eric
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-06-05 5:38 ` Eric Sandeen
2008-06-05 5:46 ` Mark Goodwin
@ 2008-06-05 5:49 ` Chris Wedgwood
2008-06-05 5:52 ` Eric Sandeen
2008-06-05 6:34 ` Eric Sandeen
1 sibling, 2 replies; 47+ messages in thread
From: Chris Wedgwood @ 2008-06-05 5:49 UTC (permalink / raw)
To: Eric Sandeen; +Cc: Timothy Shimmin, xfs-oss
On Thu, Jun 05, 2008 at 12:38:30AM -0500, Eric Sandeen wrote:
> Guys, this is SIMPLE, SAFE, and it fixes a CORRUPTION BUG.
[...]
> >> As it only defines __arch_pack for __arm__,
__arch_pack is a horrible name and not very intuitive, what's wrong
with __on_disk or something else?
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-06-05 5:49 ` Chris Wedgwood
@ 2008-06-05 5:52 ` Eric Sandeen
2008-06-05 6:34 ` Eric Sandeen
1 sibling, 0 replies; 47+ messages in thread
From: Eric Sandeen @ 2008-06-05 5:52 UTC (permalink / raw)
To: Chris Wedgwood; +Cc: Timothy Shimmin, xfs-oss
Chris Wedgwood wrote:
> On Thu, Jun 05, 2008 at 12:38:30AM -0500, Eric Sandeen wrote:
>
>> Guys, this is SIMPLE, SAFE, and it fixes a CORRUPTION BUG.
>
> [...]
>
>>>> As it only defines __arch_pack for __arm__,
>
> __arch_pack is a horrible name and not very intuitive, what's wrong
> with __on_disk or something else?
>
because __on_disk implies that it's on disk.
__arch_pack means that it's packed on some arches.
Not the same thing.
If anyone wants to change the name to __purple_ponies or whatever that's
fine, but the intent is to pack these 3(?) and only these 3 structs on
this arch and only this arch, at least for now.
'til Jeff gets his all-singing all-dancing no-regression gcc annotation
in place anyway.
-Eric
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-06-05 5:49 ` Eric Sandeen
@ 2008-06-05 6:02 ` Mark Goodwin
2008-06-05 6:04 ` Mark Goodwin
2008-06-05 6:06 ` Eric Sandeen
0 siblings, 2 replies; 47+ messages in thread
From: Mark Goodwin @ 2008-06-05 6:02 UTC (permalink / raw)
To: Eric Sandeen; +Cc: Timothy Shimmin, xfs-oss
Eric Sandeen wrote:
>
> heh, thanks Mark. Even though it's only CORRUPTION ON ARM I guess the
> shouting worked. :)
Well, we're dealing with apparent insidious corruption after
failed btree AG allocations (which aren't supposed to fail).
This seems to stem from the fixes for the ENOSPC deadlock bugs
(two years ago, see below). you and Nathan probably remember
this ..?
Timothy Shimmin wrote:
> Okay some history in xfs-dev archives on this bug...
> plenty of reading here :)
> Reverse chronological order with initial report from
> guy at NEC:
>
> May 2006
> Review thread b/w Nathan and Ying Ping:
> http://ils.corp.sgi.com/Archives/xfs-dev/200605/msg00128.html
>
> April 2006
> Thread - dgc, Ying, nathan
> http://ils.corp.sgi.com/Archives/xfs-dev/200604/msg00005.html
>
> March 2006 - 2 threads
> http://ils.corp.sgi.com/Archives/xfs-dev/200603/msg00002.html
> http://ils.corp.sgi.com/Archives/xfs-dev/200603/msg00140.html
>
> Feb 2006
> http://ils.corp.sgi.com/Archives/xfs-dev/200602/msg00062.html
> Initial report and suggested test case by Asano Masahiro - NEC
> (fwd'ed by Eric).
> Plenty of commentary by Asano.
> Thread - including comments by Steve Lord:
> http://thread.gmane.org/gmane.comp.file-systems.xfs.general/13268
--
Mark Goodwin markgw@sgi.com
Engineering Manager for XFS and PCP Phone: +61-3-99631937
SGI Australian Software Group Cell: +61-4-18969583
-------------------------------------------------------------
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-06-05 6:02 ` Mark Goodwin
@ 2008-06-05 6:04 ` Mark Goodwin
2008-06-05 6:06 ` Eric Sandeen
1 sibling, 0 replies; 47+ messages in thread
From: Mark Goodwin @ 2008-06-05 6:04 UTC (permalink / raw)
To: markgw; +Cc: Eric Sandeen, Timothy Shimmin, xfs-oss
Just realized you can't read the ils threads. But you can read this one:
http://thread.gmane.org/gmane.comp.file-systems.xfs.general/13268
-- Mark
Mark Goodwin wrote:
>
>
> Eric Sandeen wrote:
>>
>> heh, thanks Mark. Even though it's only CORRUPTION ON ARM I guess the
>> shouting worked. :)
>
> Well, we're dealing with apparent insidious corruption after
> failed btree AG allocations (which aren't supposed to fail).
> This seems to stem from the fixes for the ENOSPC deadlock bugs
> (two years ago, see below). you and Nathan probably remember
> this ..?
>
> Timothy Shimmin wrote:
>> Okay some history in xfs-dev archives on this bug...
>> plenty of reading here :)
>> Reverse chronological order with initial report from
>> guy at NEC:
>>
>> May 2006
>> Review thread b/w Nathan and Ying Ping:
>> http://ils.corp.sgi.com/Archives/xfs-dev/200605/msg00128.html
>>
>> April 2006
>> Thread - dgc, Ying, nathan
>> http://ils.corp.sgi.com/Archives/xfs-dev/200604/msg00005.html
>>
>> March 2006 - 2 threads
>> http://ils.corp.sgi.com/Archives/xfs-dev/200603/msg00002.html
>> http://ils.corp.sgi.com/Archives/xfs-dev/200603/msg00140.html
>>
>> Feb 2006
>> http://ils.corp.sgi.com/Archives/xfs-dev/200602/msg00062.html
>> Initial report and suggested test case by Asano Masahiro - NEC
>> (fwd'ed by Eric).
>> Plenty of commentary by Asano.
>> Thread - including comments by Steve Lord:
>> http://thread.gmane.org/gmane.comp.file-systems.xfs.general/13268
>
--
Mark Goodwin markgw@sgi.com
Engineering Manager for XFS and PCP Phone: +61-3-99631937
SGI Australian Software Group Cell: +61-4-18969583
-------------------------------------------------------------
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-06-05 6:02 ` Mark Goodwin
2008-06-05 6:04 ` Mark Goodwin
@ 2008-06-05 6:06 ` Eric Sandeen
1 sibling, 0 replies; 47+ messages in thread
From: Eric Sandeen @ 2008-06-05 6:06 UTC (permalink / raw)
To: markgw; +Cc: Timothy Shimmin, xfs-oss
Mark Goodwin wrote:
>
> Eric Sandeen wrote:
>> heh, thanks Mark. Even though it's only CORRUPTION ON ARM I guess the
>> shouting worked. :)
>
> Well, we're dealing with apparent insidious corruption after
> failed btree AG allocations (which aren't supposed to fail).
> This seems to stem from the fixes for the ENOSPC deadlock bugs
> (two years ago, see below). you and Nathan probably remember
> this ..?
nah it's easier to hit than that. Just run xfs-qa on arm with old abi
and you'll hit it plenty quickly. there are other calculations around
that assume no padding.
Even if it doesn't look corrupted on arm, the filesystem isn't portable.
-Eric
> Timothy Shimmin wrote:
>> Okay some history in xfs-dev archives on this bug...
>> plenty of reading here :)
>> Reverse chronological order with initial report from
>> guy at NEC:
>>
>> May 2006
>> Review thread b/w Nathan and Ying Ping:
>> http://ils.corp.sgi.com/Archives/xfs-dev/200605/msg00128.html
>>
>> April 2006
>> Thread - dgc, Ying, nathan
>> http://ils.corp.sgi.com/Archives/xfs-dev/200604/msg00005.html
>>
>> March 2006 - 2 threads
>> http://ils.corp.sgi.com/Archives/xfs-dev/200603/msg00002.html
>> http://ils.corp.sgi.com/Archives/xfs-dev/200603/msg00140.html
>>
>> Feb 2006
>> http://ils.corp.sgi.com/Archives/xfs-dev/200602/msg00062.html
>> Initial report and suggested test case by Asano Masahiro - NEC
>> (fwd'ed by Eric).
>> Plenty of commentary by Asano.
>> Thread - including comments by Steve Lord:
>> http://thread.gmane.org/gmane.comp.file-systems.xfs.general/13268
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-06-05 5:49 ` Chris Wedgwood
2008-06-05 5:52 ` Eric Sandeen
@ 2008-06-05 6:34 ` Eric Sandeen
1 sibling, 0 replies; 47+ messages in thread
From: Eric Sandeen @ 2008-06-05 6:34 UTC (permalink / raw)
To: Chris Wedgwood; +Cc: Timothy Shimmin, xfs-oss
Chris Wedgwood wrote:
> On Thu, Jun 05, 2008 at 12:38:30AM -0500, Eric Sandeen wrote:
>
>> Guys, this is SIMPLE, SAFE, and it fixes a CORRUPTION BUG.
>
> [...]
>
>>>> As it only defines __arch_pack for __arm__,
>
> __arch_pack is a horrible name and not very intuitive, what's wrong
> with __on_disk or something else?
>
>
seriously, if you don't like the name or the style of the fix that's
fine, we can fix that up, but I went to enough trouble to track down the
issue and test the fix it seems worth actually... fixing it.
If you want to __on_disk annotate everything and only pack it on arm
OABI that might be less hacky. cw almost convinced me of this.
I was just going for "least invasive" here.
-Eric
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] fix dir2 shortform structures on ARM old ABI
2008-03-20 3:02 ` Eric Sandeen
2008-05-05 7:38 ` Barry Naujok
@ 2008-06-06 14:15 ` Eric Sandeen
1 sibling, 0 replies; 47+ messages in thread
From: Eric Sandeen @ 2008-06-06 14:15 UTC (permalink / raw)
To: xfs-oss; +Cc: Barry Naujok
Eric Sandeen wrote:
> Here's the userspace side.
>
Just a reminder after Dave's reminder. :)
-Eric
> -Eric
>
>
> Index: xfs-cmds/xfsprogs/include/platform_defs.h.in
> ===================================================================
> --- xfs-cmds.orig/xfsprogs/include/platform_defs.h.in
> +++ xfs-cmds/xfsprogs/include/platform_defs.h.in
> @@ -147,4 +147,11 @@ typedef unsigned long long __psunsigned_
> | (minor&IRIX_DEV_MAXMIN)))
> #define IRIX_DEV_TO_KDEVT(dev) makedev(IRIX_DEV_MAJOR(dev),IRIX_DEV_MINOR(dev))
>
> +/* ARM old ABI has some weird alignment/padding */
> +#if defined(__arm__) && !defined(__ARM_EABI__)
> +#define __arch_pack __attribute__((packed))
> +#else
> +#define __arch_pack
> +#endif
> +
> #endif /* __XFS_PLATFORM_DEFS_H__ */
> Index: xfs-cmds/xfsprogs/include/xfs_dir2_sf.h
> ===================================================================
> --- xfs-cmds.orig/xfsprogs/include/xfs_dir2_sf.h
> +++ xfs-cmds/xfsprogs/include/xfs_dir2_sf.h
> @@ -62,7 +62,7 @@ typedef union {
> * Normalized offset (in a data block) of the entry, really xfs_dir2_data_off_t.
> * Only need 16 bits, this is the byte offset into the single block form.
> */
> -typedef struct { __uint8_t i[2]; } xfs_dir2_sf_off_t;
> +typedef struct { __uint8_t i[2]; } __arch_pack xfs_dir2_sf_off_t;
>
> /*
> * The parent directory has a dedicated field, and the self-pointer must
> @@ -76,14 +76,14 @@ typedef struct xfs_dir2_sf_hdr {
> __uint8_t count; /* count of entries */
> __uint8_t i8count; /* count of 8-byte inode #s */
> xfs_dir2_inou_t parent; /* parent dir inode number */
> -} xfs_dir2_sf_hdr_t;
> +} __arch_pack xfs_dir2_sf_hdr_t;
>
> typedef struct xfs_dir2_sf_entry {
> __uint8_t namelen; /* actual name length */
> xfs_dir2_sf_off_t offset; /* saved offset */
> __uint8_t name[1]; /* name, variable size */
> xfs_dir2_inou_t inumber; /* inode number, var. offset */
> -} xfs_dir2_sf_entry_t;
> +} __arch_pack xfs_dir2_sf_entry_t;
>
> typedef struct xfs_dir2_sf {
> xfs_dir2_sf_hdr_t hdr; /* shortform header */
>
>
>
>
>
^ permalink raw reply [flat|nested] 47+ messages in thread
end of thread, other threads:[~2008-06-06 14:15 UTC | newest]
Thread overview: 47+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-18 23:31 [PATCH] fix dir2 shortform structures on ARM old ABI Andre Draszik
2008-03-19 3:18 ` Eric Sandeen
2008-03-19 3:40 ` Eric Sandeen
2008-03-19 5:11 ` Eric Sandeen
2008-03-19 5:31 ` Eric Sandeen
2008-03-20 0:35 ` Timothy Shimmin
-- strict thread matches above, loose matches on Subject: below --
2008-03-18 23:49 Andre Draszik
2008-03-19 0:23 ` Josef 'Jeff' Sipek
2008-03-19 11:21 ` Luca Olivetti
2008-03-19 12:53 ` Eric Sandeen
2008-03-19 14:11 ` Luca Olivetti
[not found] ` <47E11F4A.3090205@ventoso.org>
[not found] ` <47E12D20.4010901@sandeen.net>
2008-03-19 15:34 ` Luca Olivetti
2008-03-19 15:40 ` Eric Sandeen
[not found] ` <47E14FF1.2020100@sandeen.net>
2008-03-19 18:24 ` Luca Olivetti
2008-03-15 3:24 Eric Sandeen
2008-03-15 4:17 ` Josef 'Jeff' Sipek
2008-03-15 4:23 ` Eric Sandeen
2008-03-15 4:27 ` Josef 'Jeff' Sipek
2008-03-15 4:33 ` Eric Sandeen
2008-03-15 4:51 ` Josef 'Jeff' Sipek
2008-03-17 18:32 ` Eric Sandeen
2008-03-17 19:53 ` Josef 'Jeff' Sipek
2008-03-17 20:04 ` Eric Sandeen
2008-03-17 20:28 ` Josef 'Jeff' Sipek
2008-03-17 23:35 ` Timothy Shimmin
2008-03-17 23:42 ` Josef 'Jeff' Sipek
2008-03-18 4:31 ` Timothy Shimmin
[not found] ` <20080315043622.GA11547@puku.stupidest.org>
2008-03-15 4:45 ` Eric Sandeen
2008-03-20 3:02 ` Eric Sandeen
2008-05-05 7:38 ` Barry Naujok
2008-06-06 14:15 ` Eric Sandeen
2008-04-09 19:53 ` Eric Sandeen
2008-04-23 0:58 ` Eric Sandeen
2008-05-02 20:55 ` Eric Sandeen
2008-05-05 7:08 ` David Chinner
2008-05-05 13:07 ` Eric Sandeen
2008-05-06 4:21 ` Timothy Shimmin
2008-05-06 13:43 ` Eric Sandeen
2008-06-05 5:38 ` Eric Sandeen
2008-06-05 5:46 ` Mark Goodwin
2008-06-05 5:49 ` Eric Sandeen
2008-06-05 6:02 ` Mark Goodwin
2008-06-05 6:04 ` Mark Goodwin
2008-06-05 6:06 ` Eric Sandeen
2008-06-05 5:49 ` Chris Wedgwood
2008-06-05 5:52 ` Eric Sandeen
2008-06-05 6:34 ` Eric Sandeen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox