Mark Fasheh
2010-Mar-12 02:30 UTC
[Ocfs2-devel] [PATCH] ocfs2: Always try for maximum bits with new local alloc windows
What we were doing before was to ask for the current window size as the maximum allocation. This had the effect of limiting the amount of allocation we could get for the local alloc during times when the window size was shrunk due to fragmentation. In some cases, that could actually *increase* fragmentation by artificially limiting the number of bits we can accept. So while we still want to ask for a minimum number of bits equal to window size, there is no reason why we should limit the number of bits the local alloc should accept. Hence always allow the maximum number of local alloc bits. Signed-off-by: Mark Fasheh <mfasheh at suse.com> --- fs/ocfs2/localalloc.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c index 9ab9d33..955a60b 100644 --- a/fs/ocfs2/localalloc.c +++ b/fs/ocfs2/localalloc.c @@ -1002,7 +1002,7 @@ static int ocfs2_local_alloc_reserve_for_window(struct ocfs2_super *osb, } retry_enospc: - (*ac)->ac_bits_wanted = osb->local_alloc_bits; + (*ac)->ac_bits_wanted = osb->local_alloc_default_bits; status = ocfs2_reserve_cluster_bitmap_bits(osb, *ac); if (status == -ENOSPC) { @@ -1069,7 +1069,7 @@ static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb, /* we used the generic suballoc reserve function, but we set * everything up nicely, so there's no reason why we can't use * the more specific cluster api to claim bits. */ - status = ocfs2_claim_clusters(osb, handle, ac, osb->local_alloc_bits, + status = ocfs2_claim_clusters(osb, handle, ac, osb->local_alloc_default_bits, &cluster_off, &cluster_count); if (status == -ENOSPC) { retry_enospc: @@ -1087,6 +1087,8 @@ retry_enospc: mlog(ML_NOTICE, "LASTATE: tryalloc (nested) %u bits\n", osb->local_alloc_bits); + ac->ac_bits_wanted = osb->local_alloc_default_bits; + status = ocfs2_claim_clusters(osb, handle, ac, osb->local_alloc_bits, &cluster_off, -- 1.6.4.2
Mark Fasheh
2010-Mar-12 02:43 UTC
[Ocfs2-devel] [PATCH] ocfs2: Always try for maximum bits with new local alloc windows
On Thu, Mar 11, 2010 at 06:30:11PM -0800, Mark Fasheh wrote:> What we were doing before was to ask for the current window size as the > maximum allocation. This had the effect of limiting the amount of allocation > we could get for the local alloc during times when the window size was > shrunk due to fragmentation. In some cases, that could actually *increase* > fragmentation by artificially limiting the number of bits we can accept. So > while we still want to ask for a minimum number of bits equal to window > size, there is no reason why we should limit the number of bits the local > alloc should accept. Hence always allow the maximum number of local alloc > bits. > > Signed-off-by: Mark Fasheh <mfasheh at suse.com> > --- > fs/ocfs2/localalloc.c | 6 ++++-- > 1 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c > index 9ab9d33..955a60b 100644 > --- a/fs/ocfs2/localalloc.c > +++ b/fs/ocfs2/localalloc.c > @@ -1002,7 +1002,7 @@ static int ocfs2_local_alloc_reserve_for_window(struct ocfs2_super *osb, > } > > retry_enospc: > - (*ac)->ac_bits_wanted = osb->local_alloc_bits; > + (*ac)->ac_bits_wanted = osb->local_alloc_default_bits; > > status = ocfs2_reserve_cluster_bitmap_bits(osb, *ac); > if (status == -ENOSPC) { > @@ -1069,7 +1069,7 @@ static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb, > /* we used the generic suballoc reserve function, but we set > * everything up nicely, so there's no reason why we can't use > * the more specific cluster api to claim bits. */ > - status = ocfs2_claim_clusters(osb, handle, ac, osb->local_alloc_bits, > + status = ocfs2_claim_clusters(osb, handle, ac, osb->local_alloc_default_bits, > &cluster_off, &cluster_count);Tao pointed out to me that this change is unnecessary. Updated patch follows. --Mark [PATCH] ocfs2: Always try for maximum bits with new local alloc windows What we were doing before was to ask for the current window size as the maximum allocation. This had the effect of limiting the amount of allocation we could get for the local alloc during times when the window size was shrunk due to fragmentation. In some cases, that could actually *increase* fragmentation by artificially limiting the number of bits we can accept. So while we still want to ask for a minimum number of bits equal to window size, there is no reason why we should limit the number of bits the local alloc should accept. Hence always allow the maximum number of local alloc bits. Signed-off-by: Mark Fasheh <mfasheh at suse.com> --- fs/ocfs2/localalloc.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c index 9ab9d33..2cad0db 100644 --- a/fs/ocfs2/localalloc.c +++ b/fs/ocfs2/localalloc.c @@ -1002,7 +1002,7 @@ static int ocfs2_local_alloc_reserve_for_window(struct ocfs2_super *osb, } retry_enospc: - (*ac)->ac_bits_wanted = osb->local_alloc_bits; + (*ac)->ac_bits_wanted = osb->local_alloc_default_bits; status = ocfs2_reserve_cluster_bitmap_bits(osb, *ac); if (status == -ENOSPC) { @@ -1087,6 +1087,8 @@ retry_enospc: mlog(ML_NOTICE, "LASTATE: tryalloc (nested) %u bits\n", osb->local_alloc_bits); + ac->ac_bits_wanted = osb->local_alloc_default_bits; + status = ocfs2_claim_clusters(osb, handle, ac, osb->local_alloc_bits, &cluster_off, -- 1.6.4.2