diff options
author | Josef Bacik <jbacik@fusionio.com> | 2012-10-22 15:43:12 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2012-10-25 15:50:18 -0400 |
commit | be6aef604920406b348acf3be6e6e8db55696386 (patch) | |
tree | 2d458852fafacb2bad7788311b10b879ba920f40 /fs | |
parent | e2d044fe77f8e845333bb1bd29587dc08a4346a0 (diff) |
Btrfs: Use btrfs_update_inode_fallback when creating a snapshot
On a really full file system I was getting ENOSPC back from
btrfs_update_inode when trying to update the parent inode when creating a
snapshot. Just use the fallback method so we can update the inode and not
have to worry about having a delayed ref. Thanks,
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/ctree.h | 2 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 7 | ||||
-rw-r--r-- | fs/btrfs/transaction.c | 2 |
3 files changed, 6 insertions, 5 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 1630be831210..8a92ab1632a2 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -3338,6 +3338,8 @@ struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page, | |||
3338 | int btrfs_update_inode(struct btrfs_trans_handle *trans, | 3338 | int btrfs_update_inode(struct btrfs_trans_handle *trans, |
3339 | struct btrfs_root *root, | 3339 | struct btrfs_root *root, |
3340 | struct inode *inode); | 3340 | struct inode *inode); |
3341 | int btrfs_update_inode_fallback(struct btrfs_trans_handle *trans, | ||
3342 | struct btrfs_root *root, struct inode *inode); | ||
3341 | int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct inode *inode); | 3343 | int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct inode *inode); |
3342 | int btrfs_orphan_del(struct btrfs_trans_handle *trans, struct inode *inode); | 3344 | int btrfs_orphan_del(struct btrfs_trans_handle *trans, struct inode *inode); |
3343 | int btrfs_orphan_cleanup(struct btrfs_root *root); | 3345 | int btrfs_orphan_cleanup(struct btrfs_root *root); |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index f92def2467a6..5fc09908f20f 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -94,8 +94,6 @@ static noinline int cow_file_range(struct inode *inode, | |||
94 | struct page *locked_page, | 94 | struct page *locked_page, |
95 | u64 start, u64 end, int *page_started, | 95 | u64 start, u64 end, int *page_started, |
96 | unsigned long *nr_written, int unlock); | 96 | unsigned long *nr_written, int unlock); |
97 | static noinline int btrfs_update_inode_fallback(struct btrfs_trans_handle *trans, | ||
98 | struct btrfs_root *root, struct inode *inode); | ||
99 | 97 | ||
100 | static int btrfs_init_inode_security(struct btrfs_trans_handle *trans, | 98 | static int btrfs_init_inode_security(struct btrfs_trans_handle *trans, |
101 | struct inode *inode, struct inode *dir, | 99 | struct inode *inode, struct inode *dir, |
@@ -2746,8 +2744,9 @@ noinline int btrfs_update_inode(struct btrfs_trans_handle *trans, | |||
2746 | return btrfs_update_inode_item(trans, root, inode); | 2744 | return btrfs_update_inode_item(trans, root, inode); |
2747 | } | 2745 | } |
2748 | 2746 | ||
2749 | static noinline int btrfs_update_inode_fallback(struct btrfs_trans_handle *trans, | 2747 | noinline int btrfs_update_inode_fallback(struct btrfs_trans_handle *trans, |
2750 | struct btrfs_root *root, struct inode *inode) | 2748 | struct btrfs_root *root, |
2749 | struct inode *inode) | ||
2751 | { | 2750 | { |
2752 | int ret; | 2751 | int ret; |
2753 | 2752 | ||
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 77db875b5116..04bbfb1052eb 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -1200,7 +1200,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, | |||
1200 | btrfs_i_size_write(parent_inode, parent_inode->i_size + | 1200 | btrfs_i_size_write(parent_inode, parent_inode->i_size + |
1201 | dentry->d_name.len * 2); | 1201 | dentry->d_name.len * 2); |
1202 | parent_inode->i_mtime = parent_inode->i_ctime = CURRENT_TIME; | 1202 | parent_inode->i_mtime = parent_inode->i_ctime = CURRENT_TIME; |
1203 | ret = btrfs_update_inode(trans, parent_root, parent_inode); | 1203 | ret = btrfs_update_inode_fallback(trans, parent_root, parent_inode); |
1204 | if (ret) | 1204 | if (ret) |
1205 | btrfs_abort_transaction(trans, root, ret); | 1205 | btrfs_abort_transaction(trans, root, ret); |
1206 | fail: | 1206 | fail: |