Commit 9afbb0b7 authored by Chris Mason's avatar Chris Mason

Btrfs: Disable tree defrag in SSD mode

Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent df68b8a7
...@@ -1835,7 +1835,8 @@ struct extent_buffer *__btrfs_alloc_free_block(struct btrfs_trans_handle *trans, ...@@ -1835,7 +1835,8 @@ struct extent_buffer *__btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
buf->start, buf->start + buf->len - 1, buf->start, buf->start + buf->len - 1,
EXTENT_CSUM, GFP_NOFS); EXTENT_CSUM, GFP_NOFS);
buf->flags |= EXTENT_CSUM; buf->flags |= EXTENT_CSUM;
btrfs_set_buffer_defrag(buf); if (!btrfs_test_opt(root, SSD))
btrfs_set_buffer_defrag(buf);
trans->blocks_used++; trans->blocks_used++;
return buf; return buf;
} }
......
...@@ -179,6 +179,9 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans, ...@@ -179,6 +179,9 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
if (root->ref_cows == 0 && !is_extent) if (root->ref_cows == 0 && !is_extent)
goto out; goto out;
if (btrfs_test_opt(root, SSD))
goto out;
path = btrfs_alloc_path(); path = btrfs_alloc_path();
if (!path) if (!path)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment