[Tux3] [PATCH 03/10] Fix ileaf aligment

Daniel Phillips phillips at phunq.net
Fri Oct 17 04:04:08 PDT 2008


On Friday 17 October 2008 03:53, OGAWA Hirofumi wrote:
> Daniel Phillips <phillips at phunq.net> writes:
> 
> > On Friday 17 October 2008 02:59, OGAWA Hirofumi wrote:
> >> Daniel Phillips <phillips at phunq.net> writes:
> >> 
> >> >> -struct ileaf { u16 magic, count; inum_t ibase; char table[]; };
> >> >> +struct ileaf { u16 magic, count; u32 pad; inum_t ibase; char table[]; };
> >> >>  
> >> >>  /*
> >> >>   * inode leaf format
> >> >
> >> > Good catch.  A better way to fix this is using gcc attribute packed,
> >> > which is done by the Tux3 macro PACKED:
> >> 
> >> But, I think the result of it is aliment fault on some archs.
> >
> > Do you have an example of that?  I was discussing this point with Chris
> > Mason a week or two ago and he didn't know of any arch where it didn't
> > work.
> 
> It may work actually, but e.g. arm, mips, superh, generetes alignment
> fault, then fault handler checks detail and fix it, or will calls
> BUG_ON() if source is kernel.
> 
> There is no merit to generate alignment fault.

I had the impression that gcc is supposed to generate code to access
the fields bytewise on architectures that generate alignment faults,
when the compiler can't prove statically that the fields are aligned.
I could be completely wrong about that...

Daniel

_______________________________________________
Tux3 mailing list
Tux3 at tux3.org
http://tux3.org/cgi-bin/mailman/listinfo/tux3



More information about the Tux3 mailing list