Skip to contentSkip to conversation

ocfs2: Always try for maximum bits with new local alloc windows

PATCH New Mark Fasheh 2 participants 3 messages Mar 12, 2010 – Mar 18, 2010 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 fs/ocfs2/localalloc.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
fs/ocfs2/localalloc.c +4 -2
index 9ab9d33..955a60b 100644
@@ -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,
Signature · 1 line
1.6.4.2
#1 lore raw

PATCH 1/1 ocfs2: Always try for maximum bits with new local alloc windows

Quoted 29 lines · Mark Fasheh

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.

---
 fs/ocfs2/localalloc.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
fs/ocfs2/localalloc.c +1 -1
index 9ab9d33..955a60b 100644
@@ -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) {

fs/ocfs2/localalloc.c static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb, · line 1073

Quoted 6 lines
fs/ocfs2/localalloc.c +1 -1
@@ -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.

---
 fs/ocfs2/localalloc.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
fs/ocfs2/localalloc.c +3 -1
index 9ab9d33..2cad0db 100644
@@ -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,
Signature · 1 line
1.6.4.2
#2 lore raw

PATCH 1/1 ocfs2: Always try for maximum bits with new local alloc windows

Quoted 5 lines · Mark Fasheh

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

This patch is now in the fixes branch of ocfs2.git.

Joel

Signature · 9 lines
Life's Little Instruction Book #356

	"Be there when people need you."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127