aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/tree-defrag.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-09-10 19:58:16 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-09-10 19:58:16 -0400
commit86479a04eef8f304a13aeb8b64bcc8e506a68268 (patch)
treecda7e66d469bcdc2f41144ea91405aeb96d1f777 /fs/btrfs/tree-defrag.c
parent8e21528f87854314792aaef4d279bc9e5a9be997 (diff)
Add support for defragging files via btrfsctl -d. Avoid OOM on extent tree
defrag. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/tree-defrag.c')
-rw-r--r--fs/btrfs/tree-defrag.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/btrfs/tree-defrag.c b/fs/btrfs/tree-defrag.c
index 35fd20d24645..420597127ed1 100644
--- a/fs/btrfs/tree-defrag.c
+++ b/fs/btrfs/tree-defrag.c
@@ -113,6 +113,8 @@ static int defrag_walk_down(struct btrfs_trans_handle *trans,
113 } 113 }
114 WARN_ON(*level < 0); 114 WARN_ON(*level < 0);
115 WARN_ON(*level >= BTRFS_MAX_LEVEL); 115 WARN_ON(*level >= BTRFS_MAX_LEVEL);
116 clear_buffer_defrag(path->nodes[*level]);
117 clear_buffer_defrag_done(path->nodes[*level]);
116 btrfs_block_release(root, path->nodes[*level]); 118 btrfs_block_release(root, path->nodes[*level]);
117 path->nodes[*level] = NULL; 119 path->nodes[*level] = NULL;
118 *level += 1; 120 *level += 1;
@@ -143,6 +145,7 @@ static int defrag_walk_up(struct btrfs_trans_handle *trans,
143 return 0; 145 return 0;
144 } else { 146 } else {
145 clear_buffer_defrag(path->nodes[*level]); 147 clear_buffer_defrag(path->nodes[*level]);
148 clear_buffer_defrag_done(path->nodes[*level]);
146 btrfs_block_release(root, path->nodes[*level]); 149 btrfs_block_release(root, path->nodes[*level]);
147 path->nodes[*level] = NULL; 150 path->nodes[*level] = NULL;
148 *level = i + 1; 151 *level = i + 1;