linux/fs/ext4
Theodore Ts'o 072bd7ea74 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>
2011-05-23 15:13:02 -04:00
..
acl.c userns: rename is_owner_or_cap to inode_owner_or_capable 2011-03-23 19:47:13 -07:00
acl.h fs: provide rcu-walk aware permission i_ops 2011-01-07 17:50:29 +11:00
balloc.c ext4: move ext4_add_groupblocks() to mballoc.c 2011-05-09 10:46:41 -04:00
bitmap.c ext4: Change unsigned long to unsigned int 2008-11-05 00:14:04 -05:00
block_validity.c ext4: rename {exit,init}_ext4_*() to ext4_{exit,init}_*() 2010-10-27 21:30:14 -04:00
dir.c ext4: Use ext4_error_file() to print the pathname to the corrupted inode 2011-01-10 12:10:55 -05:00
ext4.h ext4: count hits/misses of extent cache and expose in sysfs 2011-05-22 21:24:16 -04:00
ext4_extents.h ext4: drop ec_type from the ext4_ext_cache structure 2011-01-10 12:13:26 -05:00
ext4_jbd2.c ext4: remove unneeded ext4_journal_get_undo_access 2011-05-09 10:58:45 -04:00
ext4_jbd2.h ext4: remove unneeded ext4_journal_get_undo_access 2011-05-09 10:58:45 -04:00
extents.c ext4: fix unbalanced up_write() in ext4_ext_truncate() error path 2011-05-22 21:33:00 -04:00
file.c ext4: serialize unaligned asynchronous DIO 2011-02-12 08:17:34 -05:00
fsync.c ext4: use EXT4FS_DEBUG instead of EXT4_DEBUG in fsync.c 2011-05-09 10:25:54 -04:00
hash.c ext4: Add support for non-native signed/unsigned htree hash algorithms 2008-10-28 13:21:44 -04:00
ialloc.c Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 2011-03-25 09:57:41 -07:00
inode.c ext4: use truncate_setsize() unconditionally 2011-05-23 15:13:02 -04:00
ioctl.c Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 2011-03-25 09:57:41 -07:00
Kconfig ext4: Don't ask about supporting ext2/3 in ext4 if ext4 is not configured 2009-12-21 10:54:09 -05:00
Makefile ext4: use bio layer instead of buffer layer in mpage_da_submit_io 2010-10-27 21:30:10 -04:00
mballoc.c ext4: remove alloc_semp 2011-05-09 21:52:36 -04:00
mballoc.h ext4: remove alloc_semp 2011-05-09 21:52:36 -04:00
migrate.c ext4: set extents flag when migrating file to use extents 2011-05-03 09:34:42 -04:00
move_extent.c ext4: clean up some wait_on_page_writeback calls 2011-05-18 13:53:20 -04:00
namei.c ext4: don't dereference null pointer when make_indexed_dir() fails 2011-05-15 00:19:41 -04:00
page-io.c ext4: don't set PageUptodate in ext4_end_bio() 2011-04-30 13:26:26 -04:00
resize.c ext4: unify the ext4_handle_release_buffer() api 2011-03-20 22:57:02 -04:00
super.c ext4: count hits/misses of extent cache and expose in sysfs 2011-05-22 21:24:16 -04:00
symlink.c ext4: symlink must be handled via filesystem specific operation 2010-05-16 02:00:00 -04:00
xattr.c ext4: unify the ext4_handle_release_buffer() api 2011-03-20 22:57:02 -04:00
xattr.h fs/vfs/security: pass last path component to LSM on inode creation 2011-02-01 11:12:29 -05:00
xattr_security.c fs/vfs/security: pass last path component to LSM on inode creation 2011-02-01 11:12:29 -05:00
xattr_trusted.c ext4: constify xattr_handler 2010-05-21 18:31:19 -04:00
xattr_user.c ext4: constify xattr_handler 2010-05-21 18:31:19 -04:00