android_kernel_xiaomi_sm7250/fs/ext4
Valerie Clement 1930479c4b 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>
2008-05-13 19:31:14 -04:00
..
acl.c ext4: fix wrong gfp type under transaction 2008-04-29 22:02:02 -04:00
acl.h
balloc.c ext4: move headers out of include/linux 2008-04-29 18:13:32 -04:00
bitmap.c ext4: move headers out of include/linux 2008-04-29 18:13:32 -04:00
dir.c ext4: move headers out of include/linux 2008-04-29 18:13:32 -04:00
ext4_extents.h ext4: move headers out of include/linux 2008-04-29 18:13:32 -04:00
ext4_i.h ext4: move headers out of include/linux 2008-04-29 18:13:32 -04:00
ext4_jbd2.c ext4: move headers out of include/linux 2008-04-29 18:13:32 -04:00
ext4_jbd2.h ext4: move headers out of include/linux 2008-04-29 18:13:32 -04:00
ext4_sb.h ext4: move headers out of include/linux 2008-04-29 18:13:32 -04:00
ext4.h ext4: move headers out of include/linux 2008-04-29 18:13:32 -04:00
extents.c ext4: update ctime and mtime for truncate with extents. 2008-04-29 22:00:41 -04:00
file.c ext4: move headers out of include/linux 2008-04-29 18:13:32 -04:00
fsync.c ext4: move headers out of include/linux 2008-04-29 18:13:32 -04:00
group.h ext4: add ext4_group_t, and change all group variables to this type. 2008-01-28 23:58:27 -05:00
hash.c ext4: move headers out of include/linux 2008-04-29 18:13:32 -04:00
ialloc.c ext4: mark inode dirty after initializing the extent tree 2008-04-29 22:00:36 -04:00
inode.c ext4: fix test ext_generic_write_end() copied return value 2008-04-29 22:01:18 -04:00
ioctl.c ext4: move headers out of include/linux 2008-04-29 18:13:32 -04:00
Makefile ext4: Add multi block allocator for ext4 2008-01-29 00:19:52 -05:00
mballoc.c ext4: mballoc fix mb_normalize_request algorithm for 1KB block size filesystems 2008-05-13 19:31:14 -04:00
mballoc.h ext4: Move mballoc headers/structures to a seperate header file mballoc.h 2008-04-29 22:01:31 -04:00
migrate.c ext4: move headers out of include/linux 2008-04-29 18:13:32 -04:00
namei.c ext4: Fix update of mtime and ctime on rename 2008-04-29 22:02:11 -04:00
namei.h
resize.c ext4: fix wrong gfp type under transaction 2008-04-29 22:02:02 -04:00
super.c ext4: fix typos in messages and comments (journalled -> journaled) 2008-05-13 21:27:55 -04:00
symlink.c ext4: move headers out of include/linux 2008-04-29 18:13:32 -04:00
xattr_security.c ext4: move headers out of include/linux 2008-04-29 18:13:32 -04:00
xattr_trusted.c ext4: move headers out of include/linux 2008-04-29 18:13:32 -04:00
xattr_user.c ext4: move headers out of include/linux 2008-04-29 18:13:32 -04:00
xattr.c ext3/4: fix uninitialized bs in ext3/4_xattr_set_handle() 2008-05-14 19:11:14 -07:00
xattr.h ext4: make ext4_xattr_list() static 2008-04-17 10:38:59 -04:00