aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/ctree.c')
-rw-r--r--fs/btrfs/ctree.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 89e282c35ce2..b41f48ade419 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -217,6 +217,9 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans,
217 root->fs_info->generation); 217 root->fs_info->generation);
218 WARN_ON(1); 218 WARN_ON(1);
219 } 219 }
220 if (buffer_defrag_done(parent))
221 return 0;
222
220 parent_node = btrfs_buffer_node(parent); 223 parent_node = btrfs_buffer_node(parent);
221 parent_nritems = btrfs_header_nritems(&parent_node->header); 224 parent_nritems = btrfs_header_nritems(&parent_node->header);
222 parent_level = btrfs_header_level(&parent_node->header); 225 parent_level = btrfs_header_level(&parent_node->header);
@@ -274,6 +277,7 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans,
274 *last_ret = search_start; 277 *last_ret = search_start;
275 if (parent_level == 1) 278 if (parent_level == 1)
276 clear_buffer_defrag(tmp_bh); 279 clear_buffer_defrag(tmp_bh);
280 set_buffer_defrag_done(tmp_bh);
277 brelse(tmp_bh); 281 brelse(tmp_bh);
278 } 282 }
279 return err; 283 return err;