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: <20080103203546.GM3351@webber.adilger.int>
Date:	Thu, 3 Jan 2008 13:35:46 -0700
From:	Andreas Dilger <adilger@....com>
To:	Eric Sandeen <sandeen@...hat.com>
Cc:	linux-ext4@...r.kernel.org, Alex Tomas <Alex.Tomas@....COM>
Subject: Re: [PATCH] UPDATED2: types fixup for mballoc

On Jan 03, 2008  14:10 -0600, Eric Sandeen wrote:
> @@ -1732,17 +1735,19 @@ static void ext4_mb_scan_aligned(struct 
> +	/* find first stripe-aligned block in group */
> +	a = e4b->bd_group * EXT4_BLOCKS_PER_GROUP(sb)
>  		+ le32_to_cpu(sbi->s_es->s_first_data_block);
> +	a += sbi->s_stripe - 1;

Why not just have "+ sbi->s_stipe - 1" on the previous line, instead of "+="?
Also minor coding style nit: the "+" is normally at the end of the previous
line instead of at the start of the next line, so:

	/* find first stripe-aligned block in group */
	a = e4b->bd_group * EXT4_BLOCKS_PER_GROUP(sb) +
		le32_to_cpu(sbi->s_es->s_first_data_block) + sbi->s_stripe - 1;

> +	a = (a * sbi->s_stripe) - le32_to_cpu(sbi->s_es->s_first_data_block);
> +	i = do_div(a, EXT4_BLOCKS_PER_GROUP(sb));

I guess this doesn't stricly need to be a modulus either, because we know
which group this will be in and can just subtract the start.  You can just do:
 
	/* find first stripe-aligned block in this group */
	group_start = e4b->bd_group * EXT4_BLOCKS_PER_GROUP(sb) +;
		le32_to_cpu(sbi->s_es->s_first_data_block);

	a = group_start + sbi->s_stripe - 1;
	do_div(a, sbi->s_stripe);
	a = (a * sbi->s_stripe) - group_start;

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ