linux/fs
npiggin@suse.de 7bb46a6734 fs: introduce new truncate sequence
Introduce a new truncate calling sequence into fs/mm subsystems. Rather than
setattr > vmtruncate > truncate, have filesystems call their truncate sequence
from ->setattr if filesystem specific operations are required. vmtruncate is
deprecated, and truncate_pagecache and inode_newsize_ok helpers introduced
previously should be used.

simple_setattr is introduced for simple in-ram filesystems to implement
the new truncate sequence. Eventually all filesystems should be converted
to implement a setattr, and the default code in notify_change should go
away.

simple_setsize is also introduced to perform just the ATTR_SIZE portion
of simple_setattr (ie. changing i_size and trimming pagecache).

To implement the new truncate sequence:
- filesystem specific manipulations (eg freeing blocks) must be done in
  the setattr method rather than ->truncate.
- vmtruncate can not be used by core code to trim blocks past i_size in
  the event of write failure after allocation, so this must be performed
  in the fs code.
- convert usage of helpers block_write_begin, nobh_write_begin,
  cont_write_begin, and *blockdev_direct_IO* to use _newtrunc postfixed
  variants. These avoid calling vmtruncate to trim blocks (see previous).
- inode_setattr should not be used. generic_setattr is a new function
  to be used to copy simple attributes into the generic inode.
- make use of the better opportunity to handle errors with the new sequence.

Big problem with the previous calling sequence: the filesystem is not called
until i_size has already changed.  This means it is not allowed to fail the
call, and also it does not know what the previous i_size was. Also, generic
code calling vmtruncate to truncate allocated blocks in case of error had
no good way to return a meaningful error (or, for example, atomically handle
block deallocation).

Cc: Christoph Hellwig <hch@lst.de>
Acked-by: Jan Kara <jack@suse.cz>
Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2010-05-27 22:15:33 -04:00
..
9p drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
adfs rename the generic fsync implementations 2010-05-27 22:06:06 -04:00
affs drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
afs drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
autofs fs/: do not fallback to default_llseek() when readdir() uses BKL 2010-05-27 09:12:56 -07:00
autofs4 fs/autofs4: use memdup_user 2010-05-27 09:12:41 -07:00
befs include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
bfs rename the generic fsync implementations 2010-05-27 22:06:06 -04:00
btrfs drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
cachefiles CacheFiles: Fix error handling in cachefiles_determine_cache_security() 2010-05-12 18:23:58 -07:00
ceph drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
cifs drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
coda drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
configfs Fix the regression created by "set S_DEAD on unlink()..." commit 2010-05-15 07:16:33 -04:00
cramfs
debugfs include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
devpts Simplify devpts_get_sb() failure exits 2010-05-21 18:31:12 -04:00
dlm dlm: fix ast ordering for user locks 2010-04-30 14:52:51 -05:00
ecryptfs drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
efs
exofs drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
exportfs
ext2 rename the generic fsync implementations 2010-05-27 22:06:06 -04:00
ext3 drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
ext4 rename the generic fsync implementations 2010-05-27 22:06:06 -04:00
fat rename the generic fsync implementations 2010-05-27 22:06:06 -04:00
freevxfs fs/: do not fallback to default_llseek() when readdir() uses BKL 2010-05-27 09:12:56 -07:00
fscache fs/fscache/object-list.c: fix warning on 32-bit 2010-05-26 08:19:23 -07:00
fuse drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
gfs2 drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
hfs include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
hfsplus hfsplus: Push down BKL into ioctl function 2010-05-17 05:27:03 +02:00
hostfs drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
hpfs drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
hppfs drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
hugetlbfs rename the generic fsync implementations 2010-05-27 22:06:06 -04:00
isofs fs/: do not fallback to default_llseek() when readdir() uses BKL 2010-05-27 09:12:56 -07:00
jbd ext3: Fix waiting on transaction during fsync 2010-05-21 19:30:41 +02:00
jbd2 Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 2010-05-27 10:26:37 -07:00
jffs2 drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
jfs drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
lockd include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
logfs drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
minix fs/minix: bugfix, number of indirect block ptrs per block depends on block size 2010-05-27 22:06:22 -04:00
ncpfs drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
nfs drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
nfs_common include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
nfsd kernel-wide: replace USHORT_MAX, SHORT_MAX and SHORT_MIN with USHRT_MAX, SHRT_MAX and SHRT_MIN 2010-05-25 08:07:02 -07:00
nilfs2 drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
nls
notify Saner locking around deactivate_super() 2010-05-21 18:31:14 -04:00
ntfs drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
ocfs2 drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
omfs rename the generic fsync implementations 2010-05-27 22:06:06 -04:00
openpromfs
partitions fs: ldm: don't use own implementation of hex_to_bin() 2010-05-25 08:07:06 -07:00
proc kcore: add _text to KCORE_TEXT 2010-05-27 09:12:47 -07:00
qnx4 rename the generic fsync implementations 2010-05-27 22:06:06 -04:00
quota Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 2010-05-27 10:26:37 -07:00
ramfs rename the generic fsync implementations 2010-05-27 22:06:06 -04:00
reiserfs drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
romfs fix leak in romfs_fill_super() 2010-01-26 22:22:26 -05:00
smbfs drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
squashfs squashfs: fix name reading in squashfs_xattr_get 2010-05-23 08:27:42 +01:00
sysfs sysfs: add struct file* to bin_attr callbacks 2010-05-21 09:37:31 -07:00
sysv rename the generic fsync implementations 2010-05-27 22:06:06 -04:00
ubifs drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
udf rename the generic fsync implementations 2010-05-27 22:06:06 -04:00
ufs rename the generic fsync implementations 2010-05-27 22:06:06 -04:00
xfs drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
aio.c get rid of the magic around f_count in aio 2010-05-27 22:03:07 -04:00
anon_inodes.c Revert "anon_inode: set S_IFREG on the anon_inode" 2010-05-27 22:03:05 -04:00
attr.c fs: introduce new truncate sequence 2010-05-27 22:15:33 -04:00
bad_inode.c drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
binfmt_aout.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
binfmt_elf_fdpic.c Remove redundant check for CONFIG_MMU 2010-04-27 09:01:26 -07:00
binfmt_elf.c coredump: pass mm->flags as a coredump parameter for consistency 2010-03-06 11:26:46 -08:00
binfmt_em86.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
binfmt_flat.c uclinux: error message when FLAT reloc symbol is invalid, v2 2010-04-21 13:28:49 +10:00
binfmt_misc.c
binfmt_script.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
binfmt_som.c Split 'flush_old_exec' into two functions 2010-01-29 08:22:01 -08:00
bio-integrity.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
bio.c Merge branch 'master' into for-linus 2010-03-19 08:05:10 +01:00
block_dev.c drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
buffer.c fs: introduce new truncate sequence 2010-05-27 22:15:33 -04:00
char_dev.c
compat_binfmt_elf.c elf coredump: replace ELF_CORE_EXTRA_* macros by functions 2010-03-06 11:26:45 -08:00
compat_ioctl.c pktcdvd: improve BKL and compat_ioctl.c usage 2010-04-29 08:44:37 -07:00
compat.c aio: fix the compat vectored operations 2010-05-27 09:12:53 -07:00
dcache.c fix prune_dcache()/umount() race 2010-05-21 18:31:16 -04:00
dcookies.c
direct-io.c fs: introduce new truncate sequence 2010-05-27 22:15:33 -04:00
drop_caches.c new helper: iterate_supers() 2010-05-21 18:31:16 -04:00
eventfd.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
eventpoll.c sched, wait: Use wrapper functions 2010-05-11 17:43:58 +02:00
exec.c exit: avoid sig->count in de_thread/__exit_signal synchronization 2010-05-27 09:12:46 -07:00
fcntl.c Merge branch 'master' into for-2.6.35 2010-05-21 21:27:26 +02:00
fifo.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
file_table.c get rid of the magic around f_count in aio 2010-05-27 22:03:07 -04:00
file.c fs: use rlimit helpers 2010-03-06 11:26:29 -08:00
filesystems.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
fs_struct.c
fs-writeback.c fs-writeback: check sync bit earlier in inode_wait_for_writeback 2010-05-25 08:07:00 -07:00
generic_acl.c fs: xattr_handler table should be const 2010-05-21 18:31:18 -04:00
inode.c vfs: Add inode uid,gid,mode init helper 2010-05-21 18:31:22 -04:00
internal.h Bury __put_super_and_need_restart() 2010-05-21 18:31:16 -04:00
ioctl.c Introduce freeze_super and thaw_super for the fsfreeze ioctl 2010-05-21 18:31:18 -04:00
ioprio.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
Kconfig Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client 2010-03-19 09:43:06 -07:00
Kconfig.binfmt
libfs.c fs: introduce new truncate sequence 2010-05-27 22:15:33 -04:00
locks.c Merge branch 'for-next' into for-linus 2010-03-08 16:55:37 +01:00
Makefile Take statfs variants to fs/statfs.c 2010-05-21 18:31:17 -04:00
mbcache.c
mpage.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
namei.c VFS: fix recent breakage of FS_REVAL_DOT 2010-05-27 22:03:06 -04:00
namespace.c Merge branch 'next' into for-linus 2010-05-18 08:57:00 +10:00
nfsctl.c Switch may_open() and break_lease() to passing O_... 2010-03-03 13:00:21 -05:00
no-block.c
open.c Take statfs variants to fs/statfs.c 2010-05-21 18:31:17 -04:00
pipe.c fs: Add missing mutex_unlock 2010-05-27 22:03:09 -04:00
pnode.c Kill CL_PROPAGATION, sanitize fs/pnode.c:get_source() 2010-03-03 13:00:22 -05:00
pnode.h VFS: Clean up shared mount flag propagation 2010-03-03 14:07:55 -05:00
posix_acl.c
read_write.c vfs: introduce noop_llseek() 2010-05-27 09:12:56 -07:00
read_write.h
readdir.c
select.c Add generic sys_old_select() 2010-03-12 15:52:32 -08:00
seq_file.c seq_file: fix new kernel-doc warnings 2010-03-07 15:48:26 -08:00
signalfd.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
splice.c pipe: add support for shrinking and growing pipes 2010-05-21 21:12:40 +02:00
stack.c
stat.c
statfs.c Take statfs variants to fs/statfs.c 2010-05-21 18:31:17 -04:00
super.c fs/super: fix kernel-doc warning 2010-05-27 22:06:23 -04:00
sync.c drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
timerfd.c fs/timerfd.c: make use of wait_event_interruptible_locked_irq() 2010-05-20 13:21:42 -07:00
utimes.c
xattr_acl.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
xattr.c fs: xattr_handler table should be const 2010-05-21 18:31:18 -04:00