ext4: do not normalize block requests from fallocate()
commit556b27abf73833923d5cd4be80006292e1b31662
authorVivek Haldar <haldar@google.com>
Wed, 25 May 2011 11:41:54 +0000 (25 07:41 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 25 May 2011 11:41:54 +0000 (25 07:41 -0400)
tree588fa7c3db66afb545921cdfc894f0a41e66dc49
parenta4bb6b64e39abc0e41ca077725f2a72c868e7622
ext4: do not normalize block requests from fallocate()

Currently, an fallocate request of size slightly larger than a power of
2 is turned into two block requests, each a power of 2, with the extra
blocks pre-allocated for future use. When an application calls
fallocate, it already has an idea about how large the file may grow so
there is usually little benefit to reserve extra blocks on the
preallocation list. This reduces disk fragmentation.

Tested: fsstress. Also verified manually that fallocat'ed files are
contiguously laid out with this change (whereas without it they begin at
power-of-2 boundaries, leaving blocks in between). CPU usage of
fallocate is not appreciably higher.  In a tight fallocate loop, CPU
usage hovers between 5%-8% with this change, and 5%-7% without it.

Using a simulated file system aging program which the file system to
70%, the percentage of free extents larger than 8MB (as measured by
e2freefrag) increased from 38.8% without this change, to 69.4% with
this change.

Signed-off-by: Vivek Haldar <haldar@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/ext4.h
fs/ext4/extents.c