ext4: Fix bugs in mballoc's stream allocation mode
commit5a69bbda790cdc3deb8425c6f726d22005e99b93
authorTheodore Ts'o <tytso@mit.edu>
Mon, 10 Aug 2009 02:01:13 +0000 (9 22:01 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 14 Dec 2009 16:06:07 +0000 (14 08:06 -0800)
treeb92fffff62d3fa321cdf8957ba4493e045500ed4
parent8be78bc620adf972f6d33bc6202ba1b85fdd4db5
ext4: Fix bugs in mballoc's stream allocation mode

(cherry picked from commit 4ba74d00a20256e22f159cb288ff34b587608917)

The logic around sbi->s_mb_last_group and sbi->s_mb_last_start was all
screwed up.  These fields were getting unconditionally all the time,
set even when stream allocation had not taken place, and if they were
being used when the file was smaller than s_mb_stream_request, which
is when the allocation should _not_ be doing stream allocation.

Fix this by determining whether or not we stream allocation should
take place once, in ext4_mb_group_or_file(), and setting a flag which
gets used in ext4_mb_regular_allocator() and ext4_mb_use_best_found().
This simplifies the code and assures that we are consistently using
(or not using) the stream allocation logic.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/ext4/ext4.h
fs/ext4/mballoc.c