Skip to contentSkip to conversation

Btrfs: Fix partial discard on RAID1

PATCH In review David Woodhouse 1 participant 1 message Jul 13, 2009 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 2/4 Btrfs: Fix partial discard on RAID1

In btrfs_discard_extent() we were only discarding half of a RAID1 or RAID10 extent.

We should be telling btrfs_map_block() that we want to write, so it tells us about _all_ mirrors. If we tell it we're going to read, it'll only tell us about a single mirror at a time.

---
 fs/btrfs/extent-tree.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/btrfs/extent-tree.c +1 -1
index a5aca39..1496925 100644
@@ -1421,7 +1421,7 @@ static int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr,
 	struct btrfs_multi_bio *multi = NULL;
 
 	/* Tell the block device(s) that the sectors can be discarded */
-	ret = btrfs_map_block(&root->fs_info->mapping_tree, READ,
+	ret = btrfs_map_block(&root->fs_info->mapping_tree, WRITE,
 			      bytenr, &map_length, &multi, 0);
 	if (!ret) {
 		struct btrfs_bio_stripe *stripe = multi->stripes;
Signature · 5 lines
1.6.2.5

-- 
David Woodhouse                            Open Source Technology Centre
[email protected]                              Intel Corporation