ext4: only load buddy bitmap in ext4_trim_fs() when it is needed
authorLukas Czerner <lczerner@redhat.com>
Tue, 24 May 2011 22:16:27 +0000 (18:16 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 24 May 2011 22:16:27 +0000 (18:16 -0400)
commit78944086663e6c1b03f3d60bf7610128149be5fc
treefac4b6257258ffc15b59c8d42b6c569948daaed2
parentc867516de5256e9cfba2ec5847fa27e0f0ddd2c5
ext4: only load buddy bitmap in ext4_trim_fs() when it is needed

Currently we are loading buddy ext4_mb_load_buddy() for every block
group we are going through in ext4_trim_fs() in many cases just to find
out that there is not enough space to be bothered with. As Amir Goldstein
suggested we can use bb_free information directly from ext4_group_info.

This commit removes ext4_mb_load_buddy() from ext4_trim_fs() and rather
get the ext4_group_info via ext4_get_group_info() and use the bb_free
information directly from that. This avoids unnecessary call to load
buddy in the case the group does not have enough free space to trim.
Loading buddy is now moved to ext4_trim_all_free().

Tested by me with xfstests 251.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/mballoc.c