diff options
author | Theodore Ts'o <tytso@mit.edu> | 2011-05-23 15:13:02 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-05-23 15:13:02 -0400 |
commit | 072bd7ea74d4b60149a33967d29666bbd84e7709 (patch) | |
tree | 1d09215dcc30192254e62b84a8515220413cfa40 /fs/ext4/extents.c | |
parent | 28e35e42fb255cbaeee8b9f89643f26fe376374d (diff) |
ext4: use truncate_setsize() unconditionally
In commit c8d46e41 (ext4: Add flag to files with blocks intentionally
past EOF), if the EOFBLOCKS_FL flag is set, we call ext4_truncate()
before calling vmtruncate(). This caused any allocated but unwritten
blocks created by calling fallocate() with the FALLOC_FL_KEEP_SIZE
flag to be dropped. This was done to make to make sure that
EOFBLOCKS_FL would not be cleared while still leaving blocks past
i_size allocated. This was not necessary, since ext4_truncate()
guarantees that blocks past i_size will be dropped, even in the case
where truncate() has increased i_size before calling ext4_truncate().
So fix this by removing the EOFBLOCKS_FL special case treatment in
ext4_setattr(). In addition, use truncate_setsize() followed by a
call to ext4_truncate() instead of using vmtruncate(). This is more
efficient since it skips the call to inode_newsize_ok(), which has
been checked already by inode_change_ok(). This is also in a win in
the case where EOFBLOCKS_FL is set since it avoids calling
ext4_truncate() twice.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/extents.c')
0 files changed, 0 insertions, 0 deletions