From: Andre Noll <maan@systemlinux.org>
To: Neil Brown <neilb@suse.de>
Cc: linux-raid@vger.kernel.org
Subject: Re: [PATCH 7/8] md: update_size(): Remove useless variable "fit".
Date: Wed, 9 Jul 2008 11:14:27 +0200 [thread overview]
Message-ID: <20080709091427.GV23944@skl-net.de> (raw)
In-Reply-To: <18547.62297.913913.977355@notabene.brown>
[-- Attachment #1: Type: text/plain, Size: 2388 bytes --]
On 09:08, Neil Brown wrote:
> On Saturday April 5, maan@systemlinux.org wrote:
> >
> > Signed-off-by: Andre Noll <maan@systemlinux.org>
> > ---
> > drivers/md/md.c | 3 +--
> > 1 files changed, 1 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/md/md.c b/drivers/md/md.c
> > index 3f22ec7..98a024c 100644
> > --- a/drivers/md/md.c
> > +++ b/drivers/md/md.c
> > @@ -4459,7 +4459,6 @@ static int update_size(mddev_t *mddev, unsigned long size)
> > mdk_rdev_t * rdev;
> > int rv;
> > struct list_head *tmp;
> > - int fit = (size == 0);
> >
> > if (mddev->pers->resize == NULL)
> > return -EINVAL;
> > @@ -4479,7 +4478,7 @@ static int update_size(mddev_t *mddev, unsigned long size)
> > sector_t avail;
> > avail = rdev->size * 2;
> >
> > - if (fit && (size == 0 || size > avail/2))
> > + if (size == 0 || size > avail/2)
> > size = avail/2;
> > if (avail < ((sector_t)size << 1))
> > return -ENOSPC;
>
> This is wrong.
> The old code tested for "size == 0" once outside a loop.
> The new code does the test inside a loop which potentially changes
> size.
Oops, right you are. Please drop.
> If you are keen to do some more tidying up, I would really love it if
> all internal values that are currently stored as 'K' would instead be
> stored as sectors.
> So for example with update_size, we could make the value that is
> passed in be a number of sectors, get rid of those divisions.
Of course the size unit exported to user space programs via sysfs must
not change. So if we change update_size() as you propose, the division
has to be done in the size_store() instead, which calls update_size()
with a value obtained from sysfs.
Therefore I think it's impossible to completely get rid of the
divisions/multiplications without breaking user space, but it might
still be worth to change the internal representations.
I will have a look at it, but I might need some further advice.
> BTW your patches arrive without a valid "To" field. The Date is odd
> too.
They were generated by git-format-patch and then bounced to the
list. The date is "correct" in the sense that I checked them in back
then. I'll see that subsequent patches have a proper date and a valid
"To" field.
Thanks
Andre
--
The only person who always got his work done by Friday was Robinson Crusoe
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2008-07-09 9:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-08 15:55 [PATCH 0/8] md: More patches for md.c Andre Noll
2008-03-23 15:09 ` [PATCH 1/8] md: Simplify uuid_equal() Andre Noll
2008-03-23 15:21 ` [PATCH 2/8] md: Simplify sb_equal() Andre Noll
2008-07-08 22:54 ` Neil Brown
2008-03-25 19:55 ` [PATCH 3/8] md: alloc_disk_sb(): Return proper error value Andre Noll
2008-03-25 20:38 ` [PATCH 4/8] md: analyze_sbs(): Fix potential NULL-pointer dereference Andre Noll
2008-07-08 23:09 ` Neil Brown
2008-03-26 0:25 ` [PATCH 5/8] md: Simplify restart_array() Andre Noll
2008-03-29 19:12 ` [PATCH 6/8] md: get_disk_info(): Don't convert between signed and unsigned and back Andre Noll
2008-04-05 13:54 ` [PATCH 7/8] md: update_size(): Remove useless variable "fit" Andre Noll
2008-07-08 23:08 ` Neil Brown
2008-07-09 9:14 ` Andre Noll [this message]
2008-07-09 9:39 ` Neil Brown
2008-04-25 18:20 ` [PATCH 8/8] md: Simplify update_size() Andre Noll
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=20080709091427.GV23944@skl-net.de \
--to=maan@systemlinux.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).