[PATCH] fs/buffer.c: Loop rewrite within grow_buffers for findingsizebits
From: John Anthony Kazos Jr.
Date: Mon Mar 26 2007 - 11:06:55 EST
From: John Anthony Kazos Jr. <jakj@xxxxxxxxxxx>
This patch alters the (do...while) construct to a simple (while) and saves
one increment operation. It's entirely possible that gcc optimizes away
the first iteration anyway, but in case it doesn't (and also because it's
easier to read this way), I think this is better.
Signed-off-by: John Anthony Kazos Jr. <jakj@xxxxxxxxxxx>
---
--- linux-2.6.20.4/fs/buffer.c.orig 2007-03-26 09:42:15.000000000 -0400
+++ linux-2.6.20.4/fs/buffer.c 2007-03-26 10:10:25.000000000 -0400
@@ -1045,10 +1045,10 @@ grow_buffers(struct block_device *bdev,
pgoff_t index;
int sizebits;
- sizebits = -1;
- do {
+ sizebits = 0;
+ while ((size << sizebits) < PAGE_SIZE) {
sizebits++;
- } while ((size << sizebits) < PAGE_SIZE);
+ }
index = block >> sizebits;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/