linux/Documentation/filesystems
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
..
caching CacheFiles: Catch an overly long wait for an old active object 2009-11-19 18:12:05 +00:00
configfs
nfs Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2010-05-20 09:20:59 -07:00
pohmelfs
00-INDEX ceph: some documentations fixes 2010-03-29 09:52:11 -07:00
9p.txt 9p: documentation update 2010-04-05 10:37:36 -05:00
Locking drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
Makefile Documentation/fs/: split txt and source files 2010-03-12 15:52:35 -08:00
adfs.txt
affs.txt
afs.txt
autofs4-mount-control.txt Documentation/: it's -> its where appropriate 2010-04-23 02:09:52 +02:00
automount-support.txt
befs.txt
bfs.txt
btrfs.txt
ceph.txt Documentation/: it's -> its where appropriate 2010-04-23 02:09:52 +02:00
cifs.txt
coda.txt
cramfs.txt
debugfs.txt
dentry-locking.txt rcu: 1Q2010 update for RCU documentation 2010-01-16 10:25:22 +01:00
devpts.txt
directory-locking
dlmfs.txt Documentation/: it's -> its where appropriate 2010-04-23 02:09:52 +02:00
dnotify.txt Documentation/fs/: split txt and source files 2010-03-12 15:52:35 -08:00
dnotify_test.c Documentation/fs/: split txt and source files 2010-03-12 15:52:35 -08:00
ecryptfs.txt
exofs.txt trivial: some small fixes in exofs documentation 2009-12-10 09:59:16 +02:00
ext2.txt
ext3.txt ext3: make barrier options consistent with ext4 2010-05-21 19:30:41 +02:00
ext4.txt ext4: Update documentation to correct the inode_readahead_blks option name 2009-12-24 17:51:42 -05:00
fiemap.txt Documentation/: it's -> its where appropriate 2010-04-23 02:09:52 +02:00
files.txt
fuse.txt Documentation/: it's -> its where appropriate 2010-04-23 02:09:52 +02:00
gfs2-glocks.txt
gfs2-uevents.txt
gfs2.txt GFS2: docs update 2010-03-29 14:28:52 +01:00
hfs.txt
hfsplus.txt
hpfs.txt Documentation/: it's -> its where appropriate 2010-04-23 02:09:52 +02:00
inotify.txt
isofs.txt
jfs.txt
locks.txt
logfs.txt fix "seperate" typos in comments 2010-05-10 11:56:30 +02:00
mandatory-locking.txt
ncpfs.txt
nilfs2.txt nilfs2: change default of 'errors' mount option to 'remount-ro' mode 2010-05-10 11:32:30 +09:00
ntfs.txt
ocfs2.txt ocfs2: Add dir_resv_level mount option 2010-05-05 18:18:07 -07:00
omfs.txt
porting
proc.txt Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2010-05-20 09:20:59 -07:00
quota.txt
ramfs-rootfs-initramfs.txt
relay.txt
romfs.txt
seq_file.txt seq_file: use proc_create() in documentation 2009-12-16 07:20:07 -08:00
sharedsubtree.txt add several pieces to shared subtree documentation 2010-03-03 13:00:23 -05:00
smbfs.txt Documentation/: it's -> its where appropriate 2010-04-23 02:09:52 +02:00
spufs.txt
squashfs.txt squashfs: update documentation to include description of xattr layout 2010-05-26 01:12:26 +01:00
sysfs-pci.txt
sysfs-tagging.txt sysfs-namespaces: add a high-level Documentation file 2010-05-21 09:37:31 -07:00
sysfs.txt Driver core: driver_attribute parameters can often be const* 2009-12-23 11:23:43 -08:00
sysv-fs.txt
tmpfs.txt mempolicy: document cpuset interaction with tmpfs mpol mount option 2010-05-25 08:06:57 -07:00
ubifs.txt
udf.txt
ufs.txt
vfat.txt
vfs.txt fs: introduce new truncate sequence 2010-05-27 22:15:33 -04:00
xfs-delayed-logging-design.txt xfs: Delayed logging design documentation 2010-05-24 10:35:39 -05:00
xfs.txt
xip.txt