Btrfs: convert to the new truncate sequence

->truncate() is going away, instead all of the work needs to be done in
->setattr().  So this converts us over to do this.  It's fairly straightforward,
just get rid of our .truncate inode operation and call btrfs_truncate() directly
from btrfs_setsize.  This works out better for us since truncate can technically
return ENOSPC, and before we had no way of letting anybody know.  Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
This commit is contained in:
Josef Bacik
2011-01-31 15:30:16 -05:00
parent dc89e98244
commit a41ad394a0
3 changed files with 41 additions and 48 deletions

View File

@ -817,7 +817,7 @@ static noinline int prepare_pages(struct btrfs_root *root, struct file *file,
last_pos = ((u64)index + num_pages) << PAGE_CACHE_SHIFT;
if (start_pos > inode->i_size) {
err = btrfs_cont_expand(inode, start_pos);
err = btrfs_cont_expand(inode, i_size_read(inode), start_pos);
if (err)
return err;
}
@ -1330,7 +1330,8 @@ static long btrfs_fallocate(struct file *file, int mode,
goto out;
if (alloc_start > inode->i_size) {
ret = btrfs_cont_expand(inode, alloc_start);
ret = btrfs_cont_expand(inode, i_size_read(inode),
alloc_start);
if (ret)
goto out;
}