linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: NeilBrown <neilb@suse.de>
Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org,
	Dan Williams <dan.j.williams@intel.com>
Subject: Re: [PATCH] md: Subject: introduce get_priority_stripe() to improve raid456 write performance
Date: Thu, 27 Mar 2008 23:22:52 -0700	[thread overview]
Message-ID: <20080327232252.20764ac4.akpm@linux-foundation.org> (raw)
In-Reply-To: <1080328054528.30605@suse.de>

On Fri, 28 Mar 2008 16:45:28 +1100 NeilBrown <neilb@suse.de> wrote:

> +static ssize_t
> +raid5_store_preread_threshold(mddev_t *mddev, const char *page, size_t len)
> +{
> +	raid5_conf_t *conf = mddev_to_conf(mddev);
> +	char *end;
> +	int new;
> +	if (len >= PAGE_SIZE)
> +		return -EINVAL;
> +	if (!conf)
> +		return -ENODEV;
> +
> +	new = simple_strtoul(page, &end, 10);
> +	if (!*page || (*end && *end != '\n'))
> +		return -EINVAL;
> +	if (new > conf->max_nr_stripes || new < 0)
> +		return -EINVAL;
> +	conf->bypass_threshold = new;
> +	return len;
> +}

checkpatch 0.16 (which I misfiled and have thus far failed to merge up)
sayeth:

WARNING: consider using strict_strtoul in preference to simple_strtoul
#258: FILE: drivers/md/raid5.c:4090:
+       new = simple_strtoul(page, &end, 10);

the reason being that code which uses simple_strtoul() can treat
"42-what-a-todo" as "42", which seems a bit sloppy.

Your code won't have that failing, because it explicitly checks that the
input ended in \0 or \n.  But strict_strtoul() internally does that, so this
open-coded test could be removed.


  reply	other threads:[~2008-03-28  6:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080328164351.30557.patches@notabene>
2008-03-28  5:45 ` [PATCH] md: Subject: introduce get_priority_stripe() to improve raid456 write performance NeilBrown
2008-03-28  6:22   ` Andrew Morton [this message]
2008-03-28 19:33     ` Dan Williams
2008-03-28 21:10       ` NeilBrown
2008-03-29 16:33         ` Dan Williams

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=20080327232252.20764ac4.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    /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).