From: Andre Noll <maan@systemlinux.org>
To: NeilBrown <neilb@suse.de>
Cc: linux-raid@vger.kernel.org
Subject: Re: [md PATCH 4/6] md/raid5: change reshape-progress measurement to cope with reshaping backwards.
Date: Mon, 30 Mar 2009 11:09:38 +0200 [thread overview]
Message-ID: <20090330090938.GT17185@skl-net.de> (raw)
In-Reply-To: <38a7f1dc05f8b3cedebd2e30a0288929.squirrel@neil.brown.name>
[-- Attachment #1: Type: text/plain, Size: 1045 bytes --]
On 06:54, NeilBrown wrote:
> > Is it only me who finds such code hard to comprehend? Given that
> > the patch adds checks of the form
> >
> > (delta < 0 && s < r) || (delta >= 0 && s >= r)
>
> They are really of the form
> delta < 0 ? s < r : s >= r
Yeah right. This underlines that it is easy to get wrong :)
> static inline inorder(mddev_t *mddev, sector_t a, sector_t b)
> {
> if (mddev->delta_disks < 0)
> return b > a;
> else
> return a <= b;
> }
>
> However sometimes it is '<' vs '>=' and sometimes '<' vs '>',
> so I'm not sure it would apply universally.....
Return -1, 0, or 1, i.e. something like this:
static inline int inorder(int delta, sector_t a, sector_t b)
{
int x;
if (a < b)
x = 1;
else if (a > b)
x = -1;
else x = 0;
if (delta < 0)
x = -x;
return x;
}
Of course, the callers would need to be adapted slightly.
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:[~2009-03-30 9:09 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-24 8:53 [md PATCH 0/6] Reduce the number of devices in RAID4/5/6 NeilBrown
2009-03-24 8:53 ` [md PATCH 1/6] md/raid5: drop qd_idx from r6_state NeilBrown
2009-03-24 8:53 ` [md PATCH 4/6] md/raid5: change reshape-progress measurement to cope with reshaping backwards NeilBrown
2009-03-27 16:19 ` Andre Noll
2009-03-27 19:54 ` NeilBrown
2009-03-30 9:09 ` Andre Noll [this message]
[not found] ` <49CE1713.9070707@tmr.com>
2009-03-30 9:20 ` Andre Noll
2009-03-24 8:53 ` [md PATCH 6/6] Documentation/md.txt update NeilBrown
2009-03-27 16:19 ` Andre Noll
2009-03-27 19:43 ` NeilBrown
2009-03-24 8:53 ` [md PATCH 3/6] md: add explicit method to signal the end of a reshape NeilBrown
2009-03-24 8:53 ` [md PATCH 5/6] md: allow number of drives in raid5 to be reduced NeilBrown
2009-03-27 16:19 ` Andre Noll
2009-03-27 19:39 ` NeilBrown
2009-03-24 8:53 ` [md PATCH 2/6] md/raid5: enhance raid5_size to work correctly with negative delta_disks NeilBrown
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=20090330090938.GT17185@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 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.