diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-10-15 18:06:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-10-15 18:06:37 -0400 |
commit | dcbeb0bec5f2695c3ff53f174efb8e03c209f3f3 (patch) | |
tree | 30d223a3a3c7470c657284ef030657bd1753d4d3 /fs/btrfs/extent-tree.c | |
parent | 2b650df2cea96e487f2fd9ecaa68e533ea9b5ed7 (diff) | |
parent | 444528b3e614f7f2391488d9bca8e0b872db909b (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable:
Btrfs: always pin metadata in discard mode
Btrfs: enable discard support
Btrfs: add -o discard option
Btrfs: properly wait log writers during log sync
Btrfs: fix possible ENOSPC problems with truncate
Btrfs: fix btrfs acl #ifdef checks
Btrfs: streamline tree-log btree block writeout
Btrfs: avoid tree log commit when there are no changes
Btrfs: only write one super copy during fsync
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index d0c4d584efa..e238a0cdac6 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -1568,23 +1568,23 @@ static int remove_extent_backref(struct btrfs_trans_handle *trans, | |||
1568 | return ret; | 1568 | return ret; |
1569 | } | 1569 | } |
1570 | 1570 | ||
1571 | #ifdef BIO_RW_DISCARD | ||
1572 | static void btrfs_issue_discard(struct block_device *bdev, | 1571 | static void btrfs_issue_discard(struct block_device *bdev, |
1573 | u64 start, u64 len) | 1572 | u64 start, u64 len) |
1574 | { | 1573 | { |
1575 | blkdev_issue_discard(bdev, start >> 9, len >> 9, GFP_KERNEL, | 1574 | blkdev_issue_discard(bdev, start >> 9, len >> 9, GFP_KERNEL, |
1576 | DISCARD_FL_BARRIER); | 1575 | DISCARD_FL_BARRIER); |
1577 | } | 1576 | } |
1578 | #endif | ||
1579 | 1577 | ||
1580 | static int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr, | 1578 | static int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr, |
1581 | u64 num_bytes) | 1579 | u64 num_bytes) |
1582 | { | 1580 | { |
1583 | #ifdef BIO_RW_DISCARD | ||
1584 | int ret; | 1581 | int ret; |
1585 | u64 map_length = num_bytes; | 1582 | u64 map_length = num_bytes; |
1586 | struct btrfs_multi_bio *multi = NULL; | 1583 | struct btrfs_multi_bio *multi = NULL; |
1587 | 1584 | ||
1585 | if (!btrfs_test_opt(root, DISCARD)) | ||
1586 | return 0; | ||
1587 | |||
1588 | /* Tell the block device(s) that the sectors can be discarded */ | 1588 | /* Tell the block device(s) that the sectors can be discarded */ |
1589 | ret = btrfs_map_block(&root->fs_info->mapping_tree, READ, | 1589 | ret = btrfs_map_block(&root->fs_info->mapping_tree, READ, |
1590 | bytenr, &map_length, &multi, 0); | 1590 | bytenr, &map_length, &multi, 0); |
@@ -1604,9 +1604,6 @@ static int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr, | |||
1604 | } | 1604 | } |
1605 | 1605 | ||
1606 | return ret; | 1606 | return ret; |
1607 | #else | ||
1608 | return 0; | ||
1609 | #endif | ||
1610 | } | 1607 | } |
1611 | 1608 | ||
1612 | int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, | 1609 | int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, |
@@ -3690,6 +3687,14 @@ static int pin_down_bytes(struct btrfs_trans_handle *trans, | |||
3690 | if (is_data) | 3687 | if (is_data) |
3691 | goto pinit; | 3688 | goto pinit; |
3692 | 3689 | ||
3690 | /* | ||
3691 | * discard is sloooow, and so triggering discards on | ||
3692 | * individual btree blocks isn't a good plan. Just | ||
3693 | * pin everything in discard mode. | ||
3694 | */ | ||
3695 | if (btrfs_test_opt(root, DISCARD)) | ||
3696 | goto pinit; | ||
3697 | |||
3693 | buf = btrfs_find_tree_block(root, bytenr, num_bytes); | 3698 | buf = btrfs_find_tree_block(root, bytenr, num_bytes); |
3694 | if (!buf) | 3699 | if (!buf) |
3695 | goto pinit; | 3700 | goto pinit; |