diff options
author | Valerie Clement <valerie.clement@bull.net> | 2008-05-14 01:31:14 +0200 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-05-14 01:31:14 +0200 |
commit | 1930479c4b6bbcb6f164a5b3498e0d98329967f4 (patch) | |
tree | 2f0185f4d4b30fea72a1b90e24de28e440ebce18 /fs/sync.c | |
parent | ext4: fix typos in messages and comments (journalled -> journaled) (diff) | |
download | linux-1930479c4b6bbcb6f164a5b3498e0d98329967f4.tar.xz linux-1930479c4b6bbcb6f164a5b3498e0d98329967f4.zip |
ext4: mballoc fix mb_normalize_request algorithm for 1KB block size filesystems
In case of inode preallocation, the number of blocks to allocate depends
on the file size and it is calculated in ext4_mb_normalize_request().
Each group in the filesystem is then checked to find one that can be
used for allocation; this is done in ext4_mb_good_group().
When a file bigger than 4MB is created, the requested number of blocks
to preallocate, calculated by ext4_mb_normalize_request is 4096.
However for a filesystem with 1KB block size, the maximum size of the
block buddies used by the multiblock allocator is 2048, so none of
groups in the filesystem satisfies the search criteria in
ext4_mb_good_group(). Scanning all the filesystem groups impacts
performance.
This was demonstrated by using a freshly created, 70GB, 1k block
filesystem, with caches dropped write before the test via
/proc/sys/vm/drop_caches, and with the filesystem mounted with
nodelalloc and nodealloc,nomballoc. The time to write an 8 megabyte
file using "dd if=/dev/zero of=/mnt/test/fo bs=8k count=1k conv=fsync"
took 35.5091 seconds (236kB/s) with nodellaloc, and 0.233754 seconds
(35.9 MB/s) with the nodelloc,nomballoc options. With a 1TB partition,
it took several minutes to write 8MB!
This patch modifies the algorithm in ext4_mb_normalize_group_request to
calculate the number of blocks to allocate by taking into account the
maximum size of free blocks chunks handled by the multiblock allocator.
It has also been tested for filesystems with 2KB and 4KB block sizes to
ensure that those cases don't regress.
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Valerie Clement <valerie.clement@bull.net>
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/sync.c')
0 files changed, 0 insertions, 0 deletions