Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 95617d69 authored by Jeff Mahoney's avatar Jeff Mahoney Committed by David Sterba
Browse files

btrfs: cleanup, stop casting for extent_map->lookup everywhere



Overloading extent_map->bdev to struct map_lookup * might have started out
as a means to an end, but it's a pattern that's used all over the place
now. Let's get rid of the casting and just add a union instead.

Signed-off-by: default avatarJeff Mahoney <jeffm@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent a7ca4225
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -614,7 +614,7 @@ static void btrfs_dev_replace_update_device_in_mapping_tree(
		em = lookup_extent_mapping(em_tree, start, (u64)-1);
		if (!em)
			break;
		map = (struct map_lookup *)em->bdev;
		map = em->map_lookup;
		for (i = 0; i < map->num_stripes; i++)
			if (srcdev == map->stripes[i].dev)
				map->stripes[i].dev = tgtdev;
+1 −1
Original line number Diff line number Diff line
@@ -10322,7 +10322,7 @@ btrfs_start_trans_remove_block_group(struct btrfs_fs_info *fs_info,
	 * more device items and remove one chunk item), but this is done at
	 * btrfs_remove_chunk() through a call to check_system_chunk().
	 */
	map = (struct map_lookup *)em->bdev;
	map = em->map_lookup;
	num_items = 3 + map->num_stripes;
	free_extent_map(em);

+1 −1
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ void free_extent_map(struct extent_map *em)
		WARN_ON(extent_map_in_tree(em));
		WARN_ON(!list_empty(&em->list));
		if (test_bit(EXTENT_FLAG_FS_MAPPING, &em->flags))
			kfree(em->bdev);
			kfree(em->map_lookup);
		kmem_cache_free(extent_map_cache, em);
	}
}
+9 −1
Original line number Diff line number Diff line
@@ -32,7 +32,15 @@ struct extent_map {
	u64 block_len;
	u64 generation;
	unsigned long flags;
	union {
		struct block_device *bdev;

		/*
		 * used for chunk mappings
		 * flags & EXTENT_FLAG_FS_MAPPING must be set
		 */
		struct map_lookup *map_lookup;
	};
	atomic_t refs;
	unsigned int compress_type;
	struct list_head list;
+1 −1
Original line number Diff line number Diff line
@@ -3458,7 +3458,7 @@ static noinline_for_stack int scrub_chunk(struct scrub_ctx *sctx,
		return ret;
	}

	map = (struct map_lookup *)em->bdev;
	map = em->map_lookup;
	if (em->start != chunk_offset)
		goto out;

Loading