Commit 48b2bd92 authored by Andrew Morton's avatar Andrew Morton Committed by Ben Collins

[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.
parent 98d51dce
...@@ -410,6 +410,15 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent) ...@@ -410,6 +410,15 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
goto found; 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; return -1;
found: found:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment