From 48b2bd92f675700268be42da6c3c47aa6a0c9b21 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 16 Apr 2003 22:52:11 -0700 Subject: [PATCH] [PATCH] Fix orlov allocator boundary case 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 file changed, 9 insertions(+) diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c index 2410843491f1..af48364bcab8 100644 --- a/fs/ext2/ialloc.c +++ b/fs/ext2/ialloc.c @@ -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: -- 2.39.5