Skip to contentSkip to conversation

Btrfs: btrfs_discard_extent must use WRITE with btrfs_map_block.

PATCH jim owens 1 participant 1 message Dec 18, 2009 Btrfs file system

lore
Share & tools
lore

jim owens

author
#0 lore raw

WRITE is needed on btrfs_map_block() to fetch all raid stripes, READ only returns one device and we want to discard all copies.

---
 fs/btrfs/extent-tree.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/btrfs/extent-tree.c +1 -1
index 86bc625..adc59fa 100644
@@ -1585,7 +1585,7 @@ static int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr,
 		return 0;
 
 	/* 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 · 1 line
1.5.6.3