diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-09-10 19:58:16 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-09-10 19:58:16 -0400 |
commit | 86479a04eef8f304a13aeb8b64bcc8e506a68268 (patch) | |
tree | cda7e66d469bcdc2f41144ea91405aeb96d1f777 /fs/btrfs/ctree.c | |
parent | 8e21528f87854314792aaef4d279bc9e5a9be997 (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/ctree.c')
-rw-r--r-- | fs/btrfs/ctree.c | 4 |
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; |