diff options
author | Tao Ma <tao.ma@oracle.com> | 2010-03-01 19:06:35 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2010-03-01 19:06:35 -0500 |
commit | cc483f102c3f703e853c96f95a654f0106fb2603 (patch) | |
tree | 82f340b2301b01dfd5d6aca693808f9f1a774b8e /Documentation/isapnp.txt | |
parent | 23e2af3518facab6838d7aac1f46fbd7a5a290ce (diff) | |
download | op-kernel-dev-cc483f102c3f703e853c96f95a654f0106fb2603.zip op-kernel-dev-cc483f102c3f703e853c96f95a654f0106fb2603.tar.gz |
ext4: Fix fencepost error in chosing choosing group vs file preallocation.
The ext4 multiblock allocator decides whether to use group or file
preallocation based on the file size. When the file size reaches
s_mb_stream_request (default is 16 blocks), it changes to use a
file-specific preallocation. This is cool, but it has a tiny problem.
See a simple script:
mkfs.ext4 -b 1024 /dev/sda8 1000000
mount -t ext4 -o nodelalloc /dev/sda8 /mnt/ext4
for((i=0;i<5;i++))
do
cat /mnt/4096>>/mnt/ext4/a #4096 is a file with 4096 characters.
cat /mnt/4096>>/mnt/ext4/b
done
debuge4fs -R 'stat a' /dev/sda8|grep BLOCKS -A 1
And you get
BLOCKS:
(0-14):8705-8719, (15):2356, (16-19):8465-8468
So there are 3 extents, a bit strange for the lonely 15th logical
block. As we write to the 16 blocks, we choose file preallocation in
ext4_mb_group_or_file, but in ext4_mb_normalize_request, we meet with
the 16*1024 range, so no preallocation will be carried. file b then
reserves the space after '2356', so when when write 16, we start from
another part.
This patch just change the check in ext4_mb_group_or_file, so
that for the lonely 15 we will still use group preallocation.
After the patch, we will get:
debuge4fs -R 'stat a' /dev/sda8|grep BLOCKS -A 1
BLOCKS:
(0-15):8705-8720, (16-19):8465-8468
Looks more sane. Thanks.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'Documentation/isapnp.txt')
0 files changed, 0 insertions, 0 deletions