Btrfs: Disable tree defrag in SSD mode
authorChris Mason <chris.mason@oracle.com>
Fri, 15 Feb 2008 18:19:35 +0000 (13:19 -0500)
committerChris Mason <chris.mason@oracle.com>
Thu, 25 Sep 2008 15:04:00 +0000 (11:04 -0400)
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/extent-tree.c
fs/btrfs/tree-defrag.c

index 220e9be9ad82475a380e9c0e4b144ff9666c30b4..af5d4a085280ba4a67bfd863a348bf40a409feff 100644 (file)
@@ -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;
 }
index 5c58630dce03e12800e2c3cf52575d65e8d8c96a..5935cbd8f2b83c7646c17f2823d36746b3151be1 100644 (file)
@@ -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;