From: Andrew Morton <akpm@linux-foundation.org>
To: Kalpak Shah <kalpak@clusterfs.com>
Cc: cmm@us.ibm.com, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-ext4@vger.kernel.org
Subject: Re: [EXT4 set 7][PATCH 1/1]Remove 32000 subdirs limit.
Date: Fri, 13 Jul 2007 09:53:43 -0700 [thread overview]
Message-ID: <20070713095343.d2e76775.akpm@linux-foundation.org> (raw)
In-Reply-To: <1184322648.4315.2.camel@garfield.linsyssoft.com>
On Fri, 13 Jul 2007 16:00:48 +0530 Kalpak Shah <kalpak@clusterfs.com> wrote:
> > >
> > > - if (inode->i_nlink >= EXT4_LINK_MAX)
> > > + if (EXT4_DIR_LINK_MAX(inode))
> > > return -EMLINK;
> >
> > argh. WHY_IS_EXT4_FULL_OF_UPPER_CASE_MACROS_WHICH_COULD_BE_IMPLEMENTED
> > as_lower_case_inlines? Sigh. It's all the old-timers, I guess.
> >
> > EXT4_DIR_LINK_MAX() is buggy: it evaluates its arg twice.
>
> #define EXT4_DIR_LINK_MAX(dir) (!is_dx(dir) && (dir)->i_nlink >= EXT4_LINK_MAX)
>
> This just checks if directory has hash indexing in which case we need not worry about EXT4_LINK_MAX subdir limit. If directory is not hash indexed then we will need to enforce a max subdir limit.
>
> Sorry, I didn't understand what is the problem with this macro?
Macros should never evaluate their argument more than once, because if they
do they will misbehave when someone passes them an
expression-with-side-effects:
struct inode *p = q;
EXT4_DIR_LINK_MAX(p++);
one expects `p' to have the value q+1 here. But it might be q+2.
and
EXT4_DIR_LINK_MAX(some_function());
might cause some_function() to be called twice.
This is one of the many problems which gets fixed when we write code in C
rather than in cpp.
next prev parent reply other threads:[~2007-07-13 16:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-01 7:38 [EXT4 set 7][PATCH 1/1]Remove 32000 subdirs limit Mingming Cao
2007-07-11 5:40 ` Andrew Morton
2007-07-11 12:45 ` Andreas Dilger
2007-07-13 10:30 ` Kalpak Shah
2007-07-13 12:22 ` Pekka Enberg
2007-07-13 16:53 ` Andrew Morton [this message]
2007-07-17 9:49 ` Kalpak Shah
2007-07-22 22:52 ` Ingo Oeser
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=20070713095343.d2e76775.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=cmm@us.ibm.com \
--cc=kalpak@clusterfs.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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.