浏览代码

ext3: Avoid loading bitmaps for full groups during block allocation

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).

Jan Kara: Added a comment and changed check to use cpu-endian value.

Signed-off-by: "Frans van de Wiel" <fvdw@fvdw.eu>
Signed-off-by: Jan Kara <jack@suse.cz>
Frans van de Wiel 15 年之前
父节点
当前提交
8cef107a1d
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      fs/ext3/balloc.c

+ 6 - 0
fs/ext3/balloc.c

@@ -1583,6 +1583,12 @@ retry_alloc:
 		if (!gdp)
 		if (!gdp)
 			goto io_error;
 			goto io_error;
 		free_blocks = le16_to_cpu(gdp->bg_free_blocks_count);
 		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
 		 * skip this group if the number of
 		 * free blocks is less than half of the reservation
 		 * free blocks is less than half of the reservation