From: Dan Williams <dan.j.williams@intel.com>
To: NeilBrown <neilb@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] md: Subject: introduce get_priority_stripe() to improve raid456 write performance
Date: Sat, 29 Mar 2008 09:33:22 -0700 [thread overview]
Message-ID: <1206808402.28946.6.camel@dwillia2-linux.ch.intel.com> (raw)
In-Reply-To: <39784.192.168.1.70.1206738637.squirrel@neil.brown.name>
On Fri, 2008-03-28 at 14:10 -0700, NeilBrown wrote:
> On Sat, March 29, 2008 6:33 am, Dan Williams wrote:
> > 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;
> > + unsigned long new;
> > if (len >= PAGE_SIZE)
> > return -EINVAL;
> > if (!conf)
> > return -ENODEV;
> >
> > - new = simple_strtoul(page, &end, 10);
> > - if (!*page || (*end && *end != '\n'))
> > + if (strict_strtoul(page, 10, &new))
> > return -EINVAL;
> > - if (new > conf->max_nr_stripes || new < 0)
> > + if (new > conf->max_nr_stripes || (int) new < 0)
>
> I had suggested that "new < 0" test when I saw that 'new' was an 'int'.
> A better suggestion would have been to make 'new' 'unsigned'.
> Now that you have done that, the "< 0" it pointless and
> should go.
Yeah, ->max_nr_stripes will always be less than (1 << 63).
> Otherwise
> Acked-By: NeilBrown <neilb@suse.de>
Thanks, new patch follows,
Dan
------snip------>
Subject: md: raid5.c convert simple_strtoul to strict_strtoul
From: Dan Williams <dan.j.williams@intel.com>
strict_strtoul handles the open-coded sanity checks in
raid5_store_stripe_cache_size and raid5_store_preread_threshold
Acked-by: NeilBrown <neilb@suse.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
drivers/md/raid5.c | 14 +++++---------
1 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index bc39369..e43e27a 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -4034,15 +4034,13 @@ static ssize_t
raid5_store_stripe_cache_size(mddev_t *mddev, const char *page, size_t len)
{
raid5_conf_t *conf = mddev_to_conf(mddev);
- char *end;
- int new;
+ unsigned long new;
if (len >= PAGE_SIZE)
return -EINVAL;
if (!conf)
return -ENODEV;
- new = simple_strtoul(page, &end, 10);
- if (!*page || (*end && *end != '\n') )
+ if (strict_strtoul(page, 10, &new))
return -EINVAL;
if (new <= 16 || new > 32768)
return -EINVAL;
@@ -4080,17 +4078,15 @@ 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;
+ unsigned long new;
if (len >= PAGE_SIZE)
return -EINVAL;
if (!conf)
return -ENODEV;
- new = simple_strtoul(page, &end, 10);
- if (!*page || (*end && *end != '\n'))
+ if (strict_strtoul(page, 10, &new))
return -EINVAL;
- if (new > conf->max_nr_stripes || new < 0)
+ if (new > conf->max_nr_stripes)
return -EINVAL;
conf->bypass_threshold = new;
return len;
prev parent reply other threads:[~2008-03-29 16:33 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
2008-03-28 19:33 ` Dan Williams
2008-03-28 21:10 ` NeilBrown
2008-03-29 16:33 ` Dan Williams [this message]
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=1206808402.28946.6.camel@dwillia2-linux.ch.intel.com \
--to=dan.j.williams@intel.com \
--cc=akpm@linux-foundation.org \
--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).