Skip to contentSkip to conversation

btrfs_read_block_groups: Use enums to index btrfs_space_info->block_groups.

PATCH In review chandan 2 participants 2 messages Jul 16, 2013 – Jul 18, 2013 Btrfs file system

lore
Share & tools
lore

chandan

author
#0 lore raw

PATCH 1/1 btrfs_read_block_groups: Use enums to index btrfs_space_info->block_groups.

Quoted 1 line

From 33e376755b8a928610032a1cef024dcdd980aee3 Mon Sep 17 00:00:00 2001

From: chandan <[email protected]>
Date: Tue, 16 Jul 2013 12:28:56 +0530
Subject: [PATCH] btrfs_read_block_groups: Use enums to index
btrfs_space_info->block_groups.

The current code uses integer literals to index btrfs_space_info->block_groups[] array. Instead use corresponding enums from 'enum btrfs_raid_types'.

---
 fs/btrfs/extent-tree.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
fs/btrfs/extent-tree.c +6 -2
index 0236de7..cb18077 100644
@@ -8394,9 +8394,13 @@ int btrfs_read_block_groups(struct btrfs_root *root)
 		 * avoid allocating from un-mirrored block group if there are
 		 * mirrored block groups.
 		 */
-		list_for_each_entry(cache, &space_info->block_groups[3], list)
+		list_for_each_entry(cache,
+				&space_info->block_groups[BTRFS_RAID_RAID0],
+				list)
 			set_block_group_ro(cache, 1);
-		list_for_each_entry(cache, &space_info->block_groups[4], list)
+		list_for_each_entry(cache,
+				&space_info->block_groups[BTRFS_RAID_SINGLE],
+				list)
 			set_block_group_ro(cache, 1);
 	}
 
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · chandan
Quoted 1 line

From 33e376755b8a928610032a1cef024dcdd980aee3 Mon Sep 17 00:00:00 2001

From: chandan <[email protected]>
Date: Tue, 16 Jul 2013 12:28:56 +0530
Subject: [PATCH] btrfs_read_block_groups: Use enums to index
btrfs_space_info->block_groups.

The current code uses integer literals to index btrfs_space_info->block_groups[] array. Instead use corresponding enums from 'enum btrfs_raid_types'.