[Top] [All Lists]

Re: [xfs-masters] [PATCH] fs: Add new pre-allocation ioctls to vfs for c

To: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Subject: Re: [xfs-masters] [PATCH] fs: Add new pre-allocation ioctls to vfs for compatibility with legacy xfs ioctls
From: Boaz Harrosh <bharrosh@xxxxxxxxxxx>
Date: Mon, 02 Feb 2009 11:33:59 +0200
Cc: Arnd Bergmann <arnd@xxxxxxxx>, Christoph Hellwig <hch@xxxxxxxxxxxxx>, Eric Sandeen <sandeen@xxxxxxxxxxx>, mfasheh@xxxxxxxx, joel.becker@xxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, xfs-masters@xxxxxxxxxxx, viro@xxxxxxxxxxxxxxxxxx, Ankit Jain <me@xxxxxxxxxxxxx>, linux-fsdevel@xxxxxxxxxxxxxxx, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, xfs@xxxxxxxxxxx, ocfs2-devel@xxxxxxxxxxxxxx
In-reply-to: <Pine.LNX.4.64.0902020942230.11930@anakin>
References: <20090130171423.f99c88d0.akpm@xxxxxxxxxxxxxxxxxxxx> <20090201164130.GA32276@xxxxxxxxxxxxx> <4985D48A.6090007@xxxxxxxxxxx> <200902020131.04203.arnd@xxxxxxxx> <4986AEE8.5040609@xxxxxxxxxxx> <Pine.LNX.4.64.0902020942230.11930@anakin>
User-agent: Thunderbird/3.0a2 (X11; 2008072418)
Geert Uytterhoeven wrote:
> On Mon, 2 Feb 2009, Boaz Harrosh wrote:
>> Arnd Bergmann wrote:
>>> No, the compiler is correct, it has to generate more complex code
>>> if it cannot assume that data is naturally aligned and the architecture
>>> does not support unaligned loads. If you don't understand this, please
>>> at least read the list archives about the last five times this came up
>>> before claiming that the compiler is broken.
>> Wrong!! Sorry, you guys don't listen.
>> I'm talking of the case where the structures are EXACTLY the same anyway
>> you look at them. sizeof(foo) == sizeof(foo_packed) and 
>> offsetof(foo_memmber) == offsetof(foo_packed_member) for every member of
>> the structure. foo && foo_packed are declared exactly the same but with
>> __attribute__((packed(1))) applied to the later.
>> THEN in ia64 case the compiler is brain dead, because it relates
>> "unalignment" to packed(1) which are two different things.
> The natural alignment of a structure is max(alignment(member)), for all
> members. With __attribute__((packed)), the natural alignment of the structure
> is 1, so the compiler cannot assume anything.

No the natural alignment is what it is, after the application of
__attribute__((packed(1))). In a well defined structure that is a no-opt.
But yes in ai64 the gcc programmers got lazy and did not make that analysis
after laying out the structure.

> While the ints in the structure may still be at offsets 0, 4, 8, and so on,
> this doesn't say anything about their actual memory addresses, as the struct
> base address itself may be unaligned.

The base address can be unaligned even if the structure is aligned. In that
case you need the __atrubute__((aligned)) thingy. It is true that if the 
is though unaligned, the compiler will have to assume unalignment in array 
but if the sizeof(foo_packed) is naturally aligned at the output then the 
has all the needed information to know that even if I declared __packed, it 
and knows that it is well aligned at the end.

> Gr{oetje,eeting}s,
>                                               Geert

Please note that I gave up on the compiler and understand that the use of 
is dangerous in some cases, sigh. My standing point is to make sure there are 
no guesses
left, and a BUILD_BUG_ON to make sure of that.


<Prev in Thread] Current Thread [Next in Thread>