Skip to content

Commit

Permalink
Btrfs: Disable tree defrag in SSD mode
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Chris Mason committed Sep 25, 2008
1 parent df68b8a commit 9afbb0b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -1835,7 +1835,8 @@ struct extent_buffer *__btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
buf->start, buf->start + buf->len - 1,
EXTENT_CSUM, GFP_NOFS);
buf->flags |= EXTENT_CSUM;
btrfs_set_buffer_defrag(buf);
if (!btrfs_test_opt(root, SSD))
btrfs_set_buffer_defrag(buf);
trans->blocks_used++;
return buf;
}
Expand Down
3 changes: 3 additions & 0 deletions fs/btrfs/tree-defrag.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
if (root->ref_cows == 0 && !is_extent)
goto out;

if (btrfs_test_opt(root, SSD))
goto out;

path = btrfs_alloc_path();
if (!path)
return -ENOMEM;
Expand Down

0 comments on commit 9afbb0b

Please sign in to comment.