aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2009-10-14 09:24:59 -0400
committerChris Mason <chris.mason@oracle.com>2009-10-14 10:32:49 -0400
commite244a0aeb6a599c19a7c802cda6e2d67c847b154 (patch)
tree392d8d48c4e6676a552230135ad448d522007ece /fs/btrfs/extent-tree.c
parent86df7eb921a009515285e7171363fa57dd2d7d31 (diff)
Btrfs: add -o discard option
Enable discard by default is not a good idea given the the trim speed of SSD prototypes we've seen, and the carecteristics for many high-end arrays. Turn of discards by default and require the -o discard option to enable them on. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 4aedbff36b8f..bf7782fc5939 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -1584,6 +1584,9 @@ static int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr,
1584 u64 map_length = num_bytes; 1584 u64 map_length = num_bytes;
1585 struct btrfs_multi_bio *multi = NULL; 1585 struct btrfs_multi_bio *multi = NULL;
1586 1586
1587 if (!btrfs_test_opt(root, DISCARD))
1588 return 0;
1589
1587 /* Tell the block device(s) that the sectors can be discarded */ 1590 /* Tell the block device(s) that the sectors can be discarded */
1588 ret = btrfs_map_block(&root->fs_info->mapping_tree, READ, 1591 ret = btrfs_map_block(&root->fs_info->mapping_tree, READ,
1589 bytenr, &map_length, &multi, 0); 1592 bytenr, &map_length, &multi, 0);