aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2011-03-04 14:41:41 -0500
committerJosef Bacik <josef@redhat.com>2011-03-17 14:21:32 -0400
commit930f028abe39dfd0849b53131d19c4b67aacbe67 (patch)
treea7dc6cd1c09e351a88f43bd353000310745045d7 /fs/btrfs/inode.c
parentf0cd846e9221811d87047f1428cf5226e7236efe (diff)
Btrfs: use mark_inode_dirty when expanding the file
Mark_inode_dirty will call btrfs_dirty_inode which will take care of updating the inode. This makes setsize a little cleaner since we don't have to start a transaction and update the inode in there, we can just call mark_inode_dirty. Thanks, Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c16
1 files changed, 1 insertions, 15 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 206b60362cec..64d57e032b4e 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3640,10 +3640,7 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size)
3640 3640
3641static int btrfs_setsize(struct inode *inode, loff_t newsize) 3641static int btrfs_setsize(struct inode *inode, loff_t newsize)
3642{ 3642{
3643 struct btrfs_root *root = BTRFS_I(inode)->root;
3644 struct btrfs_trans_handle *trans;
3645 loff_t oldsize = i_size_read(inode); 3643 loff_t oldsize = i_size_read(inode);
3646 unsigned long nr;
3647 int ret; 3644 int ret;
3648 3645
3649 if (newsize == oldsize) 3646 if (newsize == oldsize)
@@ -3659,18 +3656,7 @@ static int btrfs_setsize(struct inode *inode, loff_t newsize)
3659 return ret; 3656 return ret;
3660 } 3657 }
3661 3658
3662 trans = btrfs_start_transaction(root, 1); 3659 mark_inode_dirty(inode);
3663 if (IS_ERR(trans))
3664 return PTR_ERR(trans);
3665
3666 ret = btrfs_update_inode(trans, root, inode);
3667 if (ret) {
3668 btrfs_end_transaction(trans, root);
3669 return ret;
3670 }
3671 nr = trans->blocks_used;
3672 btrfs_end_transaction(trans, root);
3673 btrfs_btree_balance_dirty(root, nr);
3674 } else { 3660 } else {
3675 3661
3676 /* 3662 /*