From: Andreas Dilger <adilger@clusterfs.com>
To: Johann Lombardi <johann.lombardi@bull.net>
Cc: Kalpak Shah <kalpak@clusterfs.com>,
linux-ext4 <linux-ext4@vger.kernel.org>, tytso <tytso@mit.edu>,
sct <sct@redhat.com>
Subject: Re: [RFC] [PATCH 1/1] Nanosecond timestamps
Date: Wed, 7 Feb 2007 13:39:46 -0700 [thread overview]
Message-ID: <20070207203946.GB6565@schatzie.adilger.int> (raw)
In-Reply-To: <20070206151242.GB3140@lombardij>
On Feb 06, 2007 16:12 +0100, Johann Lombardi wrote:
> > + if (sbi->s_inode_size > EXT3_GOOD_OLD_INODE_SIZE) {
> > + EXT3_SB(sb)->s_want_extra_isize = sizeof(struct ext3_inode) - EXT3_GOOD_OLD_INODE_SIZE;
>
> Maybe EXT3_SB(sb)-> could be replaced by sbi-> here and in the lines below.
Yes, this should definitely be done. It also increases clarity between
sbi->s_want_extra_isize and es->s_want_extra_isize.
> > + if (EXT3_SB(sb)->s_want_extra_isize <
> > + le32_to_cpu(es->s_min_extra_isize))
> ^^
> > + EXT3_SB(sb)->s_want_extra_isize =
> > + le32_to_cpu(es->s_min_extra_isize);
> ^^
> Since es->s_{min,want}_extra_isize are both __u16 (BTW, shouldn't it be
> __le16?), I think you should use le16_to_cpu() instead of le32_to_cpu().
You are right - this works fine on little endian systems, but fails on
big endian systems where you will get the other half of the word.
This has been a bug in several places already, and I wonder if the
le*_to_cpu() and cpu_to_le*() macros shouldn't do some type checking
instead of just casting the variable to the specified type?
The only problem is if casting constants it would be a bit of a pain
to have to cast them explicitly, though we could have something like:
#define le16_to_cpu(var) (__builtin_constant(var) || !typecheck(__u16, var) ? \
__constant_cpu_to_le16(var) : __le16_to_cpu(var))
The only question is whether "typecheck" adds extra variables on the stack
or if the compiler will always optimize them away.
> > + /* Check if enough inode space is available */
> > + if (EXT3_GOOD_OLD_INODE_SIZE + EXT3_SB(sb)->s_want_extra_isize >
> > + sbi->s_inode_size) {
> > + EXT3_SB(sb)->s_want_extra_isize = sizeof(struct ext3_inode) - EXT3_GOOD_OLD_INODE_SIZE;
> > + printk(KERN_INFO "EXT3-fs: required extra inode space not"
> > + "available.\n");
> > + }
>
> If the inode size is EXT3_GOOD_OLD_INODE_SIZE, sbi->s_want_extra_isize won't
> be initialized. However, it should not be an issue because the ext3_sb_info
> is set to zero in ext3_fill_super().
So I'm not sure I understand if you have an objection or if this is just a
comment. sbi->s_want_extra_isize will be zero and it is not possible for
sbi->s_inode_size < EXT3_GOOD_OLD_INODE_SIZE so this case won't be hit.
Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.
next prev parent reply other threads:[~2007-02-07 20:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-02 14:49 [RFC] [PATCH 1/1] Nanosecond timestamps Kalpak Shah
2007-02-06 15:12 ` Johann Lombardi
2007-02-07 20:39 ` Andreas Dilger [this message]
2007-02-07 21:05 ` Dave Kleikamp
2007-02-08 10:33 ` Johann Lombardi
2007-02-08 10:30 ` Johann Lombardi
2007-02-13 13:16 ` [PATCH Take2 " Kalpak Shah
2007-02-19 9:56 ` Johann Lombardi
2007-02-07 20:50 ` [RFC] [PATCH " Johann Lombardi
-- strict thread matches above, loose matches on Subject: below --
2007-02-02 14:39 [RFC] [PATCH 1/1] nanosecond timestamps Kalpak Shah
2007-02-06 4:09 ` Theodore Tso
2007-02-07 17:58 ` Andreas Dilger
2007-02-15 17:51 ` Theodore Tso
2007-02-25 10:36 ` Andrew Morton
2007-02-26 21:42 ` Andreas Dilger
2007-02-26 23:20 ` Dave Kleikamp
2007-02-27 0:11 ` Andreas Dilger
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=20070207203946.GB6565@schatzie.adilger.int \
--to=adilger@clusterfs.com \
--cc=johann.lombardi@bull.net \
--cc=kalpak@clusterfs.com \
--cc=linux-ext4@vger.kernel.org \
--cc=sct@redhat.com \
--cc=tytso@mit.edu \
/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;
as well as URLs for NNTP newsgroup(s).