All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: Boaz Harrosh <bharrosh@panasas.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	mfasheh@suse.com, joel.becker@oracle.com,
	linux-kernel@vger.kernel.org, hch@infradead.org,
	xfs-masters@oss.sgi.com,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	viro@zeniv.linux.org.uk, Ankit Jain <me@ankitjain.org>,
	linux-fsdevel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	xfs@oss.sgi.com, ocfs2-devel@oss.oracle.com
Subject: Re: [xfs-masters] [PATCH] fs: Add new pre-allocation ioctls to vfs for compatibility with legacy xfs ioctls
Date: Sun, 01 Feb 2009 10:35:50 -0600	[thread overview]
Message-ID: <4985CF66.6090409@sandeen.net> (raw)
In-Reply-To: <4985CCFA.4070008@panasas.com>

Boaz Harrosh wrote:
> Eric Sandeen wrote:
>> Boaz Harrosh wrote:
>>
>> ...
>>
>>> I don't understand
>>>
>>> if you have a structure like
>>> struct foo {
>>> 	u32 one;
>>> 	u32 two;
>>> };
>>> vs
>>> struct foo_packed {
>>> 	u32 one;
>>> 	u32 two;
>>> } __packed;
>>>
>>> Just adding an __attribute__((packed)) to it clearly does not change
>>> the layout of the structure. Are you saying the __attribute__((packed))
>>> is an hint to the compiler that foo_packed might be used unaligned. This
>>> is just brain-dead, because I can use an unaligned pointer to foo just as
>>> I can to foo_packed. Otherwise there is no difference what-so-ever between
>>> the two. I have to see it to believe. It is totally the wrong hint in the
>>> wrong place taking away valuable meaning of saying "please don't use padding
>>> holes in this structure"
>>>
>>> Sorry for been so slow, I just don't get it.
>>> Boaz
>> While I'm no gcc guru, I can confirm that gratuitous use of the packed
>> attribute is suboptimal; adding "packed" to every ondisk structure made
>> obdump -d xfs.ko | wc -l explode by about 15,000 lines on ia64.
> 
> Yes! but are the structures the same? that is sizeof(foo_packed) == sizeof(foo) ?
> If not then clearly above is expected.

Yes, they are the same.  They're disk structure definitions after all;
ia64 doesn't *need* the packing, but adding the packed attribute changes
the code that gcc generates.

See also, perhaps,
http://digitalvampire.org/blog/index.php/2006/07/31/why-you-shouldnt-use-__attribute__packed/

For an interface like this maybe it's fine, but sprnkling it around like
pixie dust may not be a good plan.  :)

-Eric

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

WARNING: multiple messages have this Message-ID (diff)
From: Eric Sandeen <sandeen@sandeen.net>
To: Boaz Harrosh <bharrosh@panasas.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	Arnd Bergmann <arnd@arndb.de>,
	mfasheh@suse.com, joel.becker@oracle.com,
	linux-kernel@vger.kernel.org, hch@infradead.org,
	xfs-masters@oss.sgi.com, viro@zeniv.linux.org.uk,
	Ankit Jain <me@ankitjain.org>,
	linux-fsdevel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	xfs@oss.sgi.com, ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [xfs-masters] [PATCH] fs: Add new pre-allocation ioctls to vfs for compatibility with legacy xfs ioctls
Date: Sun, 01 Feb 2009 16:36:28 -0000	[thread overview]
Message-ID: <4985CF66.6090409@sandeen.net> (raw)
In-Reply-To: <4985CCFA.4070008@panasas.com>

Boaz Harrosh wrote:
> Eric Sandeen wrote:
>> Boaz Harrosh wrote:
>>
>> ...
>>
>>> I don't understand
>>>
>>> if you have a structure like
>>> struct foo {
>>> 	u32 one;
>>> 	u32 two;
>>> };
>>> vs
>>> struct foo_packed {
>>> 	u32 one;
>>> 	u32 two;
>>> } __packed;
>>>
>>> Just adding an __attribute__((packed)) to it clearly does not change
>>> the layout of the structure. Are you saying the __attribute__((packed))
>>> is an hint to the compiler that foo_packed might be used unaligned. This
>>> is just brain-dead, because I can use an unaligned pointer to foo just as
>>> I can to foo_packed. Otherwise there is no difference what-so-ever between
>>> the two. I have to see it to believe. It is totally the wrong hint in the
>>> wrong place taking away valuable meaning of saying "please don't use padding
>>> holes in this structure"
>>>
>>> Sorry for been so slow, I just don't get it.
>>> Boaz
>> While I'm no gcc guru, I can confirm that gratuitous use of the packed
>> attribute is suboptimal; adding "packed" to every ondisk structure made
>> obdump -d xfs.ko | wc -l explode by about 15,000 lines on ia64.
> 
> Yes! but are the structures the same? that is sizeof(foo_packed) == sizeof(foo) ?
> If not then clearly above is expected.

Yes, they are the same.  They're disk structure definitions after all;
ia64 doesn't *need* the packing, but adding the packed attribute changes
the code that gcc generates.

See also, perhaps,
http://digitalvampire.org/blog/index.php/2006/07/31/why-you-shouldnt-use-__attribute__packed/

For an interface like this maybe it's fine, but sprnkling it around like
pixie dust may not be a good plan.  :)

-Eric

WARNING: multiple messages have this Message-ID (diff)
From: Eric Sandeen <sandeen@sandeen.net>
To: Boaz Harrosh <bharrosh@panasas.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	Arnd Bergmann <arnd@arndb.de>,
	mfasheh@suse.com, joel.becker@oracle.com,
	linux-kernel@vger.kernel.org, hch@infradead.org,
	xfs-masters@oss.sgi.com, viro@zeniv.linux.org.uk,
	Ankit Jain <me@ankitjain.org>,
	linux-fsdevel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	xfs@oss.sgi.com, ocfs2-devel@oss.oracle.com
Subject: Re: [xfs-masters] [PATCH] fs: Add new pre-allocation ioctls to vfs for compatibility with legacy xfs ioctls
Date: Sun, 01 Feb 2009 10:35:50 -0600	[thread overview]
Message-ID: <4985CF66.6090409@sandeen.net> (raw)
In-Reply-To: <4985CCFA.4070008@panasas.com>

Boaz Harrosh wrote:
> Eric Sandeen wrote:
>> Boaz Harrosh wrote:
>>
>> ...
>>
>>> I don't understand
>>>
>>> if you have a structure like
>>> struct foo {
>>> 	u32 one;
>>> 	u32 two;
>>> };
>>> vs
>>> struct foo_packed {
>>> 	u32 one;
>>> 	u32 two;
>>> } __packed;
>>>
>>> Just adding an __attribute__((packed)) to it clearly does not change
>>> the layout of the structure. Are you saying the __attribute__((packed))
>>> is an hint to the compiler that foo_packed might be used unaligned. This
>>> is just brain-dead, because I can use an unaligned pointer to foo just as
>>> I can to foo_packed. Otherwise there is no difference what-so-ever between
>>> the two. I have to see it to believe. It is totally the wrong hint in the
>>> wrong place taking away valuable meaning of saying "please don't use padding
>>> holes in this structure"
>>>
>>> Sorry for been so slow, I just don't get it.
>>> Boaz
>> While I'm no gcc guru, I can confirm that gratuitous use of the packed
>> attribute is suboptimal; adding "packed" to every ondisk structure made
>> obdump -d xfs.ko | wc -l explode by about 15,000 lines on ia64.
> 
> Yes! but are the structures the same? that is sizeof(foo_packed) == sizeof(foo) ?
> If not then clearly above is expected.

Yes, they are the same.  They're disk structure definitions after all;
ia64 doesn't *need* the packing, but adding the packed attribute changes
the code that gcc generates.

See also, perhaps,
http://digitalvampire.org/blog/index.php/2006/07/31/why-you-shouldnt-use-__attribute__packed/

For an interface like this maybe it's fine, but sprnkling it around like
pixie dust may not be a good plan.  :)

-Eric


  reply	other threads:[~2009-02-01 16:37 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-28 20:59 [PATCH] fs: Add new pre-allocation ioctls to vfs for compatibility with legacy xfs ioctls Ankit Jain
2009-01-28 20:59 ` Ankit Jain
2009-01-28 20:59 ` [Ocfs2-devel] " Ankit Jain
2009-01-31  0:22 ` Andrew Morton
2009-01-31  0:23   ` [Ocfs2-devel] " Andrew Morton
2009-01-31  0:22   ` Andrew Morton
2009-01-31  0:38   ` Arnd Bergmann
2009-01-31  0:39     ` [Ocfs2-devel] " Arnd Bergmann
2009-01-31  0:38     ` Arnd Bergmann
2009-01-31  1:14     ` Andrew Morton
2009-01-31  1:14       ` [Ocfs2-devel] " Andrew Morton
2009-01-31  1:14       ` Andrew Morton
2009-01-31  1:48       ` Arnd Bergmann
2009-01-31  1:49         ` [Ocfs2-devel] " Arnd Bergmann
2009-01-31  1:48         ` Arnd Bergmann
2009-01-31  1:48         ` Arnd Bergmann
2009-02-01  9:48         ` Boaz Harrosh
2009-02-01  9:48           ` [Ocfs2-devel] " Boaz Harrosh
2009-02-01  9:48           ` Boaz Harrosh
2009-02-01 10:05           ` Geert Uytterhoeven
2009-02-01 10:05             ` [Ocfs2-devel] " Geert Uytterhoeven
2009-02-01 10:05             ` Geert Uytterhoeven
2009-02-01 10:39             ` Boaz Harrosh
2009-02-01 10:39               ` [Ocfs2-devel] " Boaz Harrosh
2009-02-01 10:39               ` Boaz Harrosh
2009-02-01 10:59               ` Geert Uytterhoeven
2009-02-01 11:00                 ` [Ocfs2-devel] " Geert Uytterhoeven
2009-02-01 10:59                 ` Geert Uytterhoeven
2009-02-01 12:32                 ` Boaz Harrosh
2009-02-01 12:33                   ` [Ocfs2-devel] " Boaz Harrosh
2009-02-01 12:32                   ` Boaz Harrosh
2009-02-01 15:37                   ` [xfs-masters] " Eric Sandeen
2009-02-01 15:41                     ` [Ocfs2-devel] " Eric Sandeen
2009-02-01 15:37                     ` Eric Sandeen
2009-02-01 16:25                     ` Boaz Harrosh
2009-02-01 16:26                       ` [Ocfs2-devel] " Boaz Harrosh
2009-02-01 16:25                       ` Boaz Harrosh
2009-02-01 16:35                       ` Eric Sandeen [this message]
2009-02-01 16:36                         ` [Ocfs2-devel] " Eric Sandeen
2009-02-01 16:35                         ` Eric Sandeen
2009-02-01 16:41                         ` Christoph Hellwig
2009-02-01 16:45                           ` [Ocfs2-devel] " Christoph Hellwig
2009-02-01 16:41                           ` Christoph Hellwig
2009-02-01 16:57                           ` Boaz Harrosh
2009-02-01 16:58                             ` [Ocfs2-devel] " Boaz Harrosh
2009-02-01 16:57                             ` Boaz Harrosh
2009-02-02  0:31                             ` Arnd Bergmann
2009-02-02  0:32                               ` [Ocfs2-devel] " Arnd Bergmann
2009-02-02  0:31                               ` Arnd Bergmann
2009-02-02  8:29                               ` Boaz Harrosh
2009-02-02  8:30                                 ` [Ocfs2-devel] " Boaz Harrosh
2009-02-02  8:29                                 ` Boaz Harrosh
2009-02-02  8:45                                 ` Geert Uytterhoeven
2009-02-02  8:45                                   ` [Ocfs2-devel] " Geert Uytterhoeven
2009-02-02  8:45                                   ` Geert Uytterhoeven
2009-02-02  9:33                                   ` Boaz Harrosh
2009-02-02  9:34                                     ` [Ocfs2-devel] " Boaz Harrosh
2009-02-02  9:33                                     ` Boaz Harrosh
2009-02-02 20:51                                     ` Jamie Lokier
2009-02-02 20:53                                       ` [Ocfs2-devel] " Jamie Lokier
2009-02-02 20:51                                       ` Jamie Lokier
2009-02-03  7:31                                       ` Boaz Harrosh
2009-02-03  7:32                                         ` [Ocfs2-devel] " Boaz Harrosh
2009-02-03  7:31                                         ` Boaz Harrosh
2009-02-03 11:21                                         ` Jamie Lokier
2009-02-03 11:21                                           ` [Ocfs2-devel] " Jamie Lokier
2009-02-03 11:21                                           ` Jamie Lokier
2009-06-19 18:28 ` Christoph Hellwig
2009-06-19 18:28   ` [Ocfs2-devel] " Christoph Hellwig
2009-06-19 18:28   ` Christoph Hellwig
2009-06-20  8:13   ` Arnd Bergmann
2009-06-23 22:05     ` [Ocfs2-devel] " Arnd Bergmann
2009-06-20  8:13     ` Arnd Bergmann
2009-06-21 18:41     ` [xfs-masters] " Christoph Hellwig
2009-06-21 18:46       ` [Ocfs2-devel] " Christoph Hellwig
2009-06-21 18:41       ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4985CF66.6090409@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=bharrosh@panasas.com \
    --cc=geert@linux-m68k.org \
    --cc=hch@infradead.org \
    --cc=joel.becker@oracle.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=me@ankitjain.org \
    --cc=mfasheh@suse.com \
    --cc=ocfs2-devel@oss.oracle.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=xfs-masters@oss.sgi.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.