[patch] Fix orlov allocator boundary case

From: Andrew Morton (akpm@digeo.com)
Date: Thu Apr 17 2003 - 14:21:42 EST


Stephen Hemminger <shemminger@osdl.org> wrote:
>
> Recent (post 2.5.67) versions of the kernel break the creation
> of the initial ram disk.

OK, here be the fix.

I'm a bit peeved that this wasn't discovered until it hit Linus's tree.
Weren't these patches in -mjb as well?

In the interests of SMP scalability the ext2 free blocks and free inodes
counters are "approximate". But there is a piece of code in the Orlov
allocator which fails due to boundary conditions on really small
filesystems.

Fix that up via a final allocation pass which simply uses first-fit for
allocation of a directory inode.

 fs/ext2/ialloc.c | 9 +++++++++
 1 files changed, 9 insertions(+)

diff -puN fs/ext2/ialloc.c~orlov-approx-counter-fix fs/ext2/ialloc.c
--- 25/fs/ext2/ialloc.c~orlov-approx-counter-fix 2003-04-17 12:12:33.000000000 -0700
+++ 25-akpm/fs/ext2/ialloc.c 2003-04-17 12:14:09.000000000 -0700
@@ -410,6 +410,15 @@ fallback:
                         goto found;
         }
 
+ if (avefreei) {
+ /*
+ * The free-inodes counter is approximate, and for really small
+ * filesystems the above test can fail to find any blockgroups
+ */
+ avefreei = 0;
+ goto fallback;
+ }
+
         return -1;
 
 found:

_

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Apr 23 2003 - 22:00:22 EST