diff options
author | Josef Bacik <josef@redhat.com> | 2011-01-31 15:30:16 -0500 |
---|---|---|
committer | Josef Bacik <josef@redhat.com> | 2011-03-17 14:21:22 -0400 |
commit | a41ad394a03b802497958d7c98a9dcf607266645 (patch) | |
tree | f18d97b7feb5c3dcf0d3c1a670d4eaf6b94e8b79 /fs/btrfs/file.c | |
parent | dc89e9824464e91fa0b06267864ceabe3186fd8b (diff) |
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>
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r-- | fs/btrfs/file.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 24a19c2743ca..3786eca2a905 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -817,7 +817,7 @@ static noinline int prepare_pages(struct btrfs_root *root, struct file *file, | |||
817 | last_pos = ((u64)index + num_pages) << PAGE_CACHE_SHIFT; | 817 | last_pos = ((u64)index + num_pages) << PAGE_CACHE_SHIFT; |
818 | 818 | ||
819 | if (start_pos > inode->i_size) { | 819 | if (start_pos > inode->i_size) { |
820 | err = btrfs_cont_expand(inode, start_pos); | 820 | err = btrfs_cont_expand(inode, i_size_read(inode), start_pos); |
821 | if (err) | 821 | if (err) |
822 | return err; | 822 | return err; |
823 | } | 823 | } |
@@ -1330,7 +1330,8 @@ static long btrfs_fallocate(struct file *file, int mode, | |||
1330 | goto out; | 1330 | goto out; |
1331 | 1331 | ||
1332 | if (alloc_start > inode->i_size) { | 1332 | if (alloc_start > inode->i_size) { |
1333 | ret = btrfs_cont_expand(inode, alloc_start); | 1333 | ret = btrfs_cont_expand(inode, i_size_read(inode), |
1334 | alloc_start); | ||
1334 | if (ret) | 1335 | if (ret) |
1335 | goto out; | 1336 | goto out; |
1336 | } | 1337 | } |