linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Oleg Verych <olecom@flower.upol.cz>
Cc: NeilBrown <neilb@suse.de>,
	linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 006 of 6] md: Add support for reshape of a raid6
Date: Wed, 21 Feb 2007 15:58:20 -0800	[thread overview]
Message-ID: <20070221155820.de9f2f16.akpm@linux-foundation.org> (raw)
In-Reply-To: <E1HK10Y-0001MY-CB@flower>

On Thu, 22 Feb 2007 00:36:22 +0100
Oleg Verych <olecom@flower.upol.cz> wrote:

> > From: Andrew Morton
> > Newsgroups: gmane.linux.raid,gmane.linux.kernel
> > Subject: Re: [PATCH 006 of 6] md: Add support for reshape of a raid6
> > Date: Wed, 21 Feb 2007 14:48:06 -0800
> 
> Hallo.
> 
> > On Tue, 20 Feb 2007 17:35:16 +1100
> > NeilBrown <neilb@suse.de> wrote:
> >
> >> +		for (i = conf->raid_disks ; i-- ;  ) {
> >
> > That statement should be dragged out, shot, stomped on then ceremonially
> > incinerated.
> >
> > What's wrong with doing
> >
> > 	for (i = 0; i < conf->raid_disks; i++) {
> >
> > in a manner which can be understood without alcoholic fortification?
> >
> > ho hum.
> 
> In case someone likes to do job, GCC usually ought to do, i would
> suggest something like this instead:
> 
>        if (expanded && test_bit(STRIPE_EXPANDING, &sh->state)) {
>                /* Need to write out all blocks after computing P&Q */
> -               sh->disks = conf->raid_disks;
> +	       	i = conf->raid_disks;
> +		sh->disks = i;
> -               sh->pd_idx = stripe_to_pdidx(sh->sector, conf,
> -                                            conf->raid_disks);
> +               sh->pd_idx = stripe_to_pdidx(sh->sector, conf, i);
> 
>                compute_parity6(sh, RECONSTRUCT_WRITE);
> -               for (i = conf->raid_disks ; i-- ;  ) {
> +		do {
>                        set_bit(R5_LOCKED, &sh->dev[i].flags);
>                        locked++;
>                        set_bit(R5_Wantwrite, &sh->dev[i].flags);
> -               }
> +		} while (--i);
> 
>                clear_bit(STRIPE_EXPANDING, &sh->state);
>        } else if (expanded) {
> 
> In any case this is subject of scripts/bloat-o-meter.

This:

--- a/drivers/md/raid5.c~a
+++ a/drivers/md/raid5.c
@@ -2364,7 +2364,7 @@ static void handle_stripe6(struct stripe
 		sh->pd_idx = stripe_to_pdidx(sh->sector, conf,
 					     conf->raid_disks);
 		compute_parity6(sh, RECONSTRUCT_WRITE);
-		for (i = conf->raid_disks ; i-- ;  ) {
+		for (i = 0; i < conf->raid_disks; ++) {
 			set_bit(R5_LOCKED, &sh->dev[i].flags);
 			locked++;
 			set_bit(R5_Wantwrite, &sh->dev[i].flags);
_

reduces the size of drivers/md/raid5.o's .text by two bytes.



  reply	other threads:[~2007-02-21 23:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-20  6:34 [PATCH 000 of 6] md: Assorted fixes and features for md for 2.6.21 NeilBrown
2007-02-20  6:34 ` [PATCH 001 of 6] md: Fix raid10 recovery problem NeilBrown
2007-02-20  6:34 ` [PATCH 002 of 6] md: RAID6: clean up CPUID and FPU enter/exit code NeilBrown
2007-02-20  6:35 ` [PATCH 003 of 6] md: Move warning about creating a raid array on partitions of the one device NeilBrown
2007-02-20  6:35 ` [PATCH 004 of 6] md: Clean out unplug and other queue function on md shutdown NeilBrown
2007-02-20  6:35 ` [PATCH 005 of 6] md: Restart a (raid5) reshape that has been aborted due to a read/write error NeilBrown
2007-02-20  6:35 ` [PATCH 006 of 6] md: Add support for reshape of a raid6 NeilBrown
2007-02-21 22:48   ` Andrew Morton
2007-02-21 23:36     ` Oleg Verych
2007-02-21 23:58       ` Andrew Morton [this message]
2007-02-21 23:57         ` Rafael J. Wysocki
2007-02-22  2:39     ` Neil Brown
2007-02-22  2:57       ` Andrew Morton
2007-02-23 12:15         ` Helge Hafting
2007-02-23 15:52     ` Bill Davidsen
2007-02-20 23:22 ` [PATCH 000 of 6] md: Assorted fixes and features for md for 2.6.21 Bill Davidsen

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=20070221155820.de9f2f16.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=olecom@flower.upol.cz \
    /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).