All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: Eric Sandeen <sandeen@redhat.com>,
	linux-ext4@vger.kernel.org, Alex Tomas <Alex.Tomas@Sun.COM>
Subject: Re: [PATCH] UPDATED2: types fixup for mballoc
Date: Thu, 03 Jan 2008 15:07:48 -0600	[thread overview]
Message-ID: <477D4EA4.6040402@redhat.com> (raw)
In-Reply-To: <20080103203546.GM3351@webber.adilger.int>

Andreas Dilger wrote:
> 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 "+="?

hmm good point.

> 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;

Ok, that was inherited :)

>> +	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;

Ok, I knew I had stared at this for too long :)

4th try coming soon.

-Eric

  reply	other threads:[~2008-01-03 21:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-15 22:56 [PATCH] types fixup for mballoc Eric Sandeen
2007-11-16  4:49 ` Eric Sandeen
2008-01-02 20:01   ` [PATCH] UPDATED: " Eric Sandeen
2008-01-03 19:17     ` Andreas Dilger
2008-01-03 19:24       ` Eric Sandeen
2008-01-03 20:10         ` [PATCH] UPDATED2: " Eric Sandeen
2008-01-03 20:35           ` Andreas Dilger
2008-01-03 21:07             ` Eric Sandeen [this message]
2008-01-08 19:54           ` [PATCH] UPDATED3: " Eric Sandeen
2008-01-09  3:47             ` Andreas Dilger

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=477D4EA4.6040402@redhat.com \
    --to=sandeen@redhat.com \
    --cc=Alex.Tomas@Sun.COM \
    --cc=linux-ext4@vger.kernel.org \
    /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.