lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20070221155820.de9f2f16.akpm@linux-foundation.org>
Date:	Wed, 21 Feb 2007 15:58:20 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Oleg Verych <olecom@...wer.upol.cz>
Cc:	NeilBrown <neilb@...e.de>, linux-raid@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 006 of 6] md: Add support for reshape of a raid6

On Thu, 22 Feb 2007 00:36:22 +0100
Oleg Verych <olecom@...wer.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@...e.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.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ