ext2: Avoid loading bitmaps for full groups during block allocation
authorJan Kara <jack@suse.cz>
Mon, 29 Mar 2010 11:55:39 +0000 (13:55 +0200)
committerJan Kara <jack@suse.cz>
Fri, 21 May 2010 17:30:37 +0000 (19:30 +0200)
There is no point in loading bitmap for groups which are completely full.
This causes noticeable performance problems (and memory pressure) on small
systems with large full filesystem
(http://marc.info/?l=linux-ext4&m=126843108314310&w=2).

Port of the same ext3 patch.

Signed-off-by: Jan Kara <jack@suse.cz>
fs/ext2/balloc.c

index 3cf038c055d7b587290b05bd659624985e9d1056..e8766a3967760f07b210e10e3b879f2c6af62872 100644 (file)
@@ -1331,6 +1331,12 @@ retry_alloc:
                        goto io_error;
 
                free_blocks = le16_to_cpu(gdp->bg_free_blocks_count);
+               /*
+                * skip this group (and avoid loading bitmap) if there
+                * are no free blocks
+                */
+               if (!free_blocks)
+                       continue;
                /*
                 * skip this group if the number of
                 * free blocks is less than half of the reservation