mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chul Lee <chur.lee@samsung.com>
To: dave@jikos.cz, "'?????????'" <jaegeuk.kim@samsung.com>
Cc: viro@zeniv.linux.org.uk, "'Theodore Ts'o'" <tytso@mit.edu>,
	gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	cm224.lee@samsung.com, jooyoung.hwang@samsung.com,
	linux-fsdevel@vger.kernel.org
Subject: RE: [PATCH 02/16] f2fs: add on-disk layout
Date: Tue, 09 Oct 2012 14:27:56 +0900	[thread overview]
Message-ID: <007301cda5de$d68251c0$8386f540$%lee@samsung.com> (raw)
In-Reply-To: <20121006222104.GA4405@twin.jikos.cz>

Dear David Sterba,

David Sterba wrote:
> On Fri, Oct 05, 2012 at 08:56:44PM +0900, ????????? wrote:
> > +struct node_footer {
> > +	__le32 nid;		/* node id */
> > +	__le32 ino;		/* inode nunmber */
> > +	__le32 cold:1;		/* cold mark */
> > +	__le32 fsync:1;		/* fsync mark */
> > +	__le32 dentry:1;	/* dentry mark */
> > +	__le32 offset:29;	/* offset in inode's node space */
> 
> A bitfield for a on-disk structure? This will have endianity issues,
> (but I don't know if you intend to support big-endian). It's not enough
> to use cpu_to_le* as in
> 
> fill_node_footer(...) {
> 
> 	rn->footer.offset = cpu_to_le32(ofs);
> 
> }
> 
> because the bitfield inside the structure will be already defined
> reversed. The cpu_to_le macro will only convert value of 'ofs' but will
> place it to different bits than it would on a little-endian arch.
> 
> There are macros to define bitfields in an endian-neutral way (or do it
> by #ifdefs though it also involves duplicating the item names), or you
> can alternatively use two structs fr disk-only and memory-only access,
> the disk one stores __le32 with value combined of all and the in-memory
> gets set up properly and will look like your current version of the
> structure.
> 
> (More about not using bitfields
> http://yarchive.net/comp/linux/bitfields.html)

I appreciate your kind feedback, but we should've avoided using bitfields
for on-disk structure. As you suggested, we'll revise them. The latter
approach would be good.

> 
> 
> david

Chul


  reply	other threads:[~2012-10-09  5:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-05 11:56 김재극
2012-10-05 17:46 ` Martin Steigerwald
2012-10-06 18:25   ` Jaegeuk Kim
2012-10-05 17:54 ` Dan Luedtke
2012-10-05 21:09   ` Boaz Harrosh
2012-10-06 18:19     ` Jaegeuk Kim
2012-10-06 22:21 ` David Sterba
2012-10-09  5:27   ` Chul Lee [this message]
2012-10-07  6:42 ` Stefan Hajnoczi
2012-10-10  5:52   ` Jaegeuk Kim
2012-10-12 21:05 ` Arnd Bergmann
2012-10-13 11:39   ` Jaegeuk Kim

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='007301cda5de$d68251c0$8386f540$%lee@samsung.com' \
    --to=chur.lee@samsung.com \
    --cc=cm224.lee@samsung.com \
    --cc=dave@jikos.cz \
    --cc=gregkh@linuxfoundation.org \
    --cc=jaegeuk.kim@samsung.com \
    --cc=jooyoung.hwang@samsung.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=viro@zeniv.linux.org.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome