The ntfs code isa a bit weird in it's truncate code, so just convert it to use simple_setsize and leave the rest to someone who knows it better. Signed-off-by: Christoph Hellwig <hch@xxxxxx> Index: vfs-2.6.git/fs/ntfs/aops.c =================================================================== --- vfs-2.6.git.orig/fs/ntfs/aops.c 2009-09-22 15:42:33.666298178 -0300 +++ vfs-2.6.git/fs/ntfs/aops.c 2009-09-22 15:42:44.701761705 -0300 @@ -642,7 +642,7 @@ static int ntfs_write_block(struct page * FIXME: What about the small race window where * ntfs_writepage() has not done any clearing because * the page was within i_size but before we get here, - * vmtruncate() modifies i_size? + * truncate modifies i_size? */ clear_buffer_dirty(bh); set_buffer_uptodate(bh); Index: vfs-2.6.git/fs/ntfs/file.c =================================================================== --- vfs-2.6.git.orig/fs/ntfs/file.c 2009-09-22 15:41:58.526264375 -0300 +++ vfs-2.6.git/fs/ntfs/file.c 2009-09-22 15:46:05.890266938 -0300 @@ -2039,7 +2039,7 @@ static ssize_t ntfs_file_buffered_write( */ i_size = i_size_read(vi); if (pos + bytes > i_size) - vmtruncate(vi, i_size); + ntfs_truncate(inode); break; } } @@ -2278,7 +2278,7 @@ const struct file_operations ntfs_file_o const struct inode_operations ntfs_file_inode_ops = { #ifdef NTFS_RW - .truncate = ntfs_truncate_vfs, + .truncate_kludge_to_be_killed = 1, .setattr = ntfs_setattr, #endif /* NTFS_RW */ }; Index: vfs-2.6.git/fs/ntfs/inode.c =================================================================== --- vfs-2.6.git.orig/fs/ntfs/inode.c 2009-09-22 15:39:44.429764137 -0300 +++ vfs-2.6.git/fs/ntfs/inode.c 2009-09-22 15:47:54.481767325 -0300 @@ -2348,11 +2348,7 @@ static const char *es = " Leaving incon * Returns 0 on success or -errno on error. * * Called with ->i_mutex held. In all but one case ->i_alloc_sem is held for - * writing. The only case in the kernel where ->i_alloc_sem is not held is - * mm/filemap.c::generic_file_buffered_write() where vmtruncate() is called - * with the current i_size as the offset. The analogous place in NTFS is in - * fs/ntfs/file.c::ntfs_file_buffered_write() where we call vmtruncate() again - * without holding ->i_alloc_sem. + * writing. That case is in fs/ntfs/file.c::ntfs_file_buffered_write(). */ int ntfs_truncate(struct inode *vi) { @@ -2506,7 +2502,7 @@ retry_truncate: /* * Note ntfs_resident_attr_value_resize() has already done any * necessary data clearing in the attribute record. When the - * file is being shrunk vmtruncate() will already have cleared + * file is being shrunk truncate will already have cleared * the top part of the last partial page, i.e. since this is * the resident case this is the page with index 0. However, * when the file is being expanded, the page cache page data @@ -2854,18 +2850,6 @@ conv_err_out: } /** - * ntfs_truncate_vfs - wrapper for ntfs_truncate() that has no return value - * @vi: inode for which the i_size was changed - * - * Wrapper for ntfs_truncate() that has no return value. - * - * See ntfs_truncate() description above for details. - */ -void ntfs_truncate_vfs(struct inode *vi) { - ntfs_truncate(vi); -} - -/** * ntfs_setattr - called from notify_change() when an attribute is being changed * @dentry: dentry whose attributes to change * @attr: structure describing the attributes and the changes @@ -2913,8 +2897,13 @@ int ntfs_setattr(struct dentry *dentry, NInoCompressed(ni) ? "compressed" : "encrypted"); err = -EOPNOTSUPP; - } else - err = vmtruncate(vi, attr->ia_size); + goto out; + } + + err = simple_setsize(inode, attr->ia_size); + if (err) + goto out; + err = ntfs_truncate(inode); if (err || ia_valid == ATTR_SIZE) goto out; } else { Index: vfs-2.6.git/fs/ntfs/inode.h =================================================================== --- vfs-2.6.git.orig/fs/ntfs/inode.h 2009-09-22 15:43:39.293762634 -0300 +++ vfs-2.6.git/fs/ntfs/inode.h 2009-09-22 15:43:48.061766513 -0300 @@ -303,7 +303,6 @@ extern int ntfs_show_options(struct seq_ #ifdef NTFS_RW extern int ntfs_truncate(struct inode *vi); -extern void ntfs_truncate_vfs(struct inode *vi); extern int ntfs_setattr(struct dentry *dentry, struct iattr *attr); -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html