From: Jan Kara <jack@suse.cz>
To: Simon Xu <xu.simon@oracle.com>
Cc: jack@suse.cz, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ext2: reduce redundant check of '*options'
Date: Mon, 17 Jan 2011 18:02:03 +0100 [thread overview]
Message-ID: <20110117170203.GF5294@quack.suse.cz> (raw)
In-Reply-To: <1294922362-2237-1-git-send-email-xu.simon@oracle.com>
On Thu 13-01-11 20:39:22, Simon Xu wrote:
> We don't need to check whether '*options' equals to ',' twice.
Well, but the code is so rarely executed that even if the compiler would
not be able to optimize out the second test, it would not matter. And the
code is not better readable afterwards either. So I find this more or less
unnecessary code churn...
Seriously, if you want to do some useful fixing then have a look for
example at making ext3/4 (in fact JBD/JBD2) handle transaction allocation
failures gratefully. Currently we just loop in start_this_handle()
infinitely until we can make the allocation which is a bit dumb. So it
would be good, to make as many places as possible able to handle ENOMEM
from start_this_handle() and propagate the error to user space. In some
cases, it might not be easily possible (e.g. during writeout of dirty
memory, where proper handling needs more thought) but lots of cases
should be rather simple and need just auditing the code paths. Thanks.
Honza
>
> Signed-off-by: Simon Xu <xu.simon@oracle.com>
> ---
> fs/ext2/super.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/ext2/super.c b/fs/ext2/super.c
> index 7731695..bd5b66b 100644
> --- a/fs/ext2/super.c
> +++ b/fs/ext2/super.c
> @@ -377,13 +377,13 @@ static unsigned long get_sb_block(void **data)
> return 1; /* Default location */
> options += 3;
> sb_block = simple_strtoul(options, &options, 0);
> - if (*options && *options != ',') {
> + if (*options == ',') {
> + options++;
> + } else if (*options) {
> printk("EXT2-fs: Invalid sb specification: %s\n",
> (char *) *data);
> return 1;
> }
> - if (*options == ',')
> - options++;
> *data = (void *) options;
> return sb_block;
> }
> --
> 1.7.3.5
>
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2011-01-17 17:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-13 12:39 [PATCH] ext2: reduce redundant check of '*options' Simon Xu
2011-01-17 17:02 ` Jan Kara [this message]
2011-01-18 13:43 ` Ted Ts'o
2011-01-18 22:24 ` Jan Kara
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=20110117170203.GF5294@quack.suse.cz \
--to=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xu.simon@oracle.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 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).