* [PATCH] mballoc: allocate stripe-multiple IOs on stripe boundaries
@ 2010-07-14 21:10 Eric Sandeen
2010-07-14 21:33 ` Andreas Dilger
2010-07-26 22:52 ` Ted Ts'o
0 siblings, 2 replies; 3+ messages in thread
From: Eric Sandeen @ 2010-07-14 21:10 UTC (permalink / raw)
To: ext4 development; +Cc: Mike Snitzer
For some reason, today mballoc only allocates IOs which are exactly
stripe-sized on a stripe boundary. If you have a multiple (say, a
128k IO on a 64k stripe) you may end up unaligned.
It seems to me that a simple change to align stripe-multiple IOs
on stripe boundaries would be a very good idea, unless this breaks
some other mballoc heuristic for some reason...
Reported-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 12b3bc0..f64a439 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -1821,8 +1821,7 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac,
/*
* This is a special case for storages like raid5
- * we try to find stripe-aligned chunks for stripe-size requests
- * XXX should do so at least for multiples of stripe size as well
+ * we try to find stripe-aligned chunks for stripe-size-multiple requests
*/
static noinline_for_stack
void ext4_mb_scan_aligned(struct ext4_allocation_context *ac,
@@ -2094,8 +2093,8 @@ repeat:
ac->ac_groups_scanned++;
if (cr == 0)
ext4_mb_simple_scan_group(ac, &e4b);
- else if (cr == 1 &&
- ac->ac_g_ex.fe_len == sbi->s_stripe)
+ else if (cr == 1 && sbi->s_stripe &&
+ !(ac->ac_g_ex.fe_len % sbi->s_stripe))
ext4_mb_scan_aligned(ac, &e4b);
else
ext4_mb_complex_scan_group(ac, &e4b);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mballoc: allocate stripe-multiple IOs on stripe boundaries
2010-07-14 21:10 [PATCH] mballoc: allocate stripe-multiple IOs on stripe boundaries Eric Sandeen
@ 2010-07-14 21:33 ` Andreas Dilger
2010-07-26 22:52 ` Ted Ts'o
1 sibling, 0 replies; 3+ messages in thread
From: Andreas Dilger @ 2010-07-14 21:33 UTC (permalink / raw)
To: Eric Sandeen; +Cc: ext4 development, Mike Snitzer
Ah, good catch. We don't notice this on Lustre, since we always use at most 1MB writes from the network and always configure with 1MB stripe size.
On 2010-07-14, at 15:10, Eric Sandeen wrote:
> For some reason, today mballoc only allocates IOs which are exactly
> stripe-sized on a stripe boundary. If you have a multiple (say, a
> 128k IO on a 64k stripe) you may end up unaligned.
>
> It seems to me that a simple change to align stripe-multiple IOs
> on stripe boundaries would be a very good idea, unless this breaks
> some other mballoc heuristic for some reason...
>
> Reported-by: Mike Snitzer <snitzer@redhat.com>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 12b3bc0..f64a439 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -1821,8 +1821,7 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac,
>
> /*
> * This is a special case for storages like raid5
> - * we try to find stripe-aligned chunks for stripe-size requests
> - * XXX should do so at least for multiples of stripe size as well
> + * we try to find stripe-aligned chunks for stripe-size-multiple requests
> */
> static noinline_for_stack
> void ext4_mb_scan_aligned(struct ext4_allocation_context *ac,
> @@ -2094,8 +2093,8 @@ repeat:
> ac->ac_groups_scanned++;
> if (cr == 0)
> ext4_mb_simple_scan_group(ac, &e4b);
> - else if (cr == 1 &&
> - ac->ac_g_ex.fe_len == sbi->s_stripe)
> + else if (cr == 1 && sbi->s_stripe &&
> + !(ac->ac_g_ex.fe_len % sbi->s_stripe))
> ext4_mb_scan_aligned(ac, &e4b);
> else
> ext4_mb_complex_scan_group(ac, &e4b);
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Cheers, Andreas
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mballoc: allocate stripe-multiple IOs on stripe boundaries
2010-07-14 21:10 [PATCH] mballoc: allocate stripe-multiple IOs on stripe boundaries Eric Sandeen
2010-07-14 21:33 ` Andreas Dilger
@ 2010-07-26 22:52 ` Ted Ts'o
1 sibling, 0 replies; 3+ messages in thread
From: Ted Ts'o @ 2010-07-26 22:52 UTC (permalink / raw)
To: Eric Sandeen; +Cc: ext4 development, Mike Snitzer
On Wed, Jul 14, 2010 at 04:10:23PM -0500, Eric Sandeen wrote:
> For some reason, today mballoc only allocates IOs which are exactly
> stripe-sized on a stripe boundary. If you have a multiple (say, a
> 128k IO on a 64k stripe) you may end up unaligned.
>
> It seems to me that a simple change to align stripe-multiple IOs
> on stripe boundaries would be a very good idea, unless this breaks
> some other mballoc heuristic for some reason...
I've added this to the ext4 tree, thanks.
- Ted
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-07-26 22:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-14 21:10 [PATCH] mballoc: allocate stripe-multiple IOs on stripe boundaries Eric Sandeen
2010-07-14 21:33 ` Andreas Dilger
2010-07-26 22:52 ` Ted Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox