]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
Btrfs: use mark_inode_dirty when expanding the file
authorJosef Bacik <josef@redhat.com>
Fri, 4 Mar 2011 19:41:41 +0000 (14:41 -0500)
committerJosef Bacik <josef@redhat.com>
Thu, 17 Mar 2011 18:21:32 +0000 (14:21 -0400)
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>
fs/btrfs/inode.c

index 206b60362cece74752ea330dd7bf9bc74585768a..64d57e032b4e520978ceb2f6716a3e6f16f30fe0 100644 (file)
@@ -3640,10 +3640,7 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size)
 
 static int btrfs_setsize(struct inode *inode, loff_t newsize)
 {
-       struct btrfs_root *root = BTRFS_I(inode)->root;
-       struct btrfs_trans_handle *trans;
        loff_t oldsize = i_size_read(inode);
-       unsigned long nr;
        int ret;
 
        if (newsize == oldsize)
@@ -3659,18 +3656,7 @@ static int btrfs_setsize(struct inode *inode, loff_t newsize)
                        return ret;
                }
 
-               trans = btrfs_start_transaction(root, 1);
-               if (IS_ERR(trans))
-                       return PTR_ERR(trans);
-
-               ret = btrfs_update_inode(trans, root, inode);
-               if (ret) {
-                       btrfs_end_transaction(trans, root);
-                       return ret;
-               }
-               nr = trans->blocks_used;
-               btrfs_end_transaction(trans, root);
-               btrfs_btree_balance_dirty(root, nr);
+               mark_inode_dirty(inode);
        } else {
 
                /*