@@ -1006,9 +1006,9 @@ int btrfs_run_delayed_items(struct btrfs_trans_handle *trans,
return ret;
}
-int btrfs_commit_inode_delayed_items(struct btrfs_trans_handle *trans,
- struct btrfs_root *root,
- struct inode *inode)
+int __btrfs_commit_inode_delayed_items(struct btrfs_trans_handle *trans,
+ struct btrfs_root *root,
+ struct inode *inode, int delayed_update)
{
struct btrfs_delayed_node *delayed_node = btrfs_get_delayed_node(inode);
struct btrfs_path *path;
@@ -1036,7 +1036,7 @@ int btrfs_commit_inode_delayed_items(struct btrfs_trans_handle *trans,
if (!ret)
ret = btrfs_delete_delayed_items(trans, path, root,
delayed_node);
- if (!ret)
+ if (!ret && delayed_update)
ret = btrfs_update_delayed_inode(trans, root, path,
delayed_node);
btrfs_free_path(path);
@@ -1044,13 +1044,27 @@ int btrfs_commit_inode_delayed_items(struct btrfs_trans_handle *trans,
return ret;
}
+int btrfs_commit_inode_delayed_items(struct btrfs_trans_handle *trans,
+ struct btrfs_root *root,
+ struct inode *inode)
+{
+ return __btrfs_commit_inode_delayed_items(trans, root, inode, 1);
+}
+
+int btrfs_commit_inode_delayed_items_no_delayed_update(struct btrfs_trans_handle *trans,
+ struct btrfs_root *root,
+ struct inode *inode)
+{
+ return __btrfs_commit_inode_delayed_items(trans, root, inode, 0);
+}
+
int btrfs_remove_delayed_node(struct inode *inode)
{
struct btrfs_trans_handle *trans;
struct btrfs_root *root = BTRFS_I(inode)->root;
struct btrfs_delayed_node *delayed_node = BTRFS_I(inode)->delayed_node;
int ret;
-
+
if (!delayed_node)
return 0;
@@ -114,6 +114,11 @@ void btrfs_balance_delayed_items(struct btrfs_root *root);
int btrfs_commit_inode_delayed_items(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct inode *inode);
+int btrfs_commit_inode_delayed_items_no_delayed_update(
+ struct btrfs_trans_handle *trans,
+ struct btrfs_root *root,
+ struct inode *inode);
+
/* Used for evicting the inode. */
int btrfs_remove_delayed_node(struct inode *inode);
int btrfs_kill_delayed_inode_items(struct btrfs_trans_handle *trans,
@@ -2611,8 +2611,12 @@ noinline int btrfs_update_inode_nodelayed(struct btrfs_trans_handle *trans,
struct btrfs_inode_item *inode_item;
struct btrfs_path *path;
struct extent_buffer *leaf;
+ struct btrfs_delayed_node *delayed_node;
int ret;
+ btrfs_commit_inode_delayed_items_no_delayed_update(trans, root, inode);
+ delayed_node = NULL;
+
path = btrfs_alloc_path();
if (!path)
return -ENOMEM;