summaryrefslogtreecommitdiffstats
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)
downloadlinux-e244a0aeb6a599c19a7c802cda6e2d67c847b154.tar.gz
linux-e244a0aeb6a599c19a7c802cda6e2d67c847b154.tar.bz2
linux-e244a0aeb6a599c19a7c802cda6e2d67c847b154.zip
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,
u64 map_length = num_bytes;
struct btrfs_multi_bio *multi = NULL;
+ if (!btrfs_test_opt(root, DISCARD))
+ return 0;
+
/* Tell the block device(s) that the sectors can be discarded */
ret = btrfs_map_block(&root->fs_info->mapping_tree, READ,
bytenr, &map_length, &multi, 0);