Commit acc30855 authored by Chris Mason's avatar Chris Mason

Merge branch 'misc-cleanups-4.5' of...

Merge branch 'misc-cleanups-4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux into for-linus-4.5
parents 988f1f57 fb75d857
...@@ -560,13 +560,13 @@ static int __add_missing_keys(struct btrfs_fs_info *fs_info, ...@@ -560,13 +560,13 @@ static int __add_missing_keys(struct btrfs_fs_info *fs_info,
*/ */
static void __merge_refs(struct list_head *head, int mode) static void __merge_refs(struct list_head *head, int mode)
{ {
struct __prelim_ref *ref1; struct __prelim_ref *pos1;
list_for_each_entry(ref1, head, list) { list_for_each_entry(pos1, head, list) {
struct __prelim_ref *ref2 = ref1, *tmp; struct __prelim_ref *pos2 = pos1, *tmp;
list_for_each_entry_safe_continue(ref2, tmp, head, list) { list_for_each_entry_safe_continue(pos2, tmp, head, list) {
struct __prelim_ref *xchg; struct __prelim_ref *xchg, *ref1 = pos1, *ref2 = pos2;
struct extent_inode_elem *eie; struct extent_inode_elem *eie;
if (!ref_for_same_block(ref1, ref2)) if (!ref_for_same_block(ref1, ref2))
......
...@@ -614,7 +614,7 @@ static void btrfs_dev_replace_update_device_in_mapping_tree( ...@@ -614,7 +614,7 @@ static void btrfs_dev_replace_update_device_in_mapping_tree(
em = lookup_extent_mapping(em_tree, start, (u64)-1); em = lookup_extent_mapping(em_tree, start, (u64)-1);
if (!em) if (!em)
break; break;
map = (struct map_lookup *)em->bdev; map = em->map_lookup;
for (i = 0; i < map->num_stripes; i++) for (i = 0; i < map->num_stripes; i++)
if (srcdev == map->stripes[i].dev) if (srcdev == map->stripes[i].dev)
map->stripes[i].dev = tgtdev; map->stripes[i].dev = tgtdev;
......
...@@ -10399,7 +10399,7 @@ btrfs_start_trans_remove_block_group(struct btrfs_fs_info *fs_info, ...@@ -10399,7 +10399,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 * more device items and remove one chunk item), but this is done at
* btrfs_remove_chunk() through a call to check_system_chunk(). * 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; num_items = 3 + map->num_stripes;
free_extent_map(em); free_extent_map(em);
...@@ -10586,7 +10586,7 @@ int btrfs_init_space_info(struct btrfs_fs_info *fs_info) ...@@ -10586,7 +10586,7 @@ int btrfs_init_space_info(struct btrfs_fs_info *fs_info)
disk_super = fs_info->super_copy; disk_super = fs_info->super_copy;
if (!btrfs_super_root(disk_super)) if (!btrfs_super_root(disk_super))
return 1; return -EINVAL;
features = btrfs_super_incompat_flags(disk_super); features = btrfs_super_incompat_flags(disk_super);
if (features & BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS) if (features & BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS)
......
...@@ -76,7 +76,7 @@ void free_extent_map(struct extent_map *em) ...@@ -76,7 +76,7 @@ void free_extent_map(struct extent_map *em)
WARN_ON(extent_map_in_tree(em)); WARN_ON(extent_map_in_tree(em));
WARN_ON(!list_empty(&em->list)); WARN_ON(!list_empty(&em->list));
if (test_bit(EXTENT_FLAG_FS_MAPPING, &em->flags)) if (test_bit(EXTENT_FLAG_FS_MAPPING, &em->flags))
kfree(em->bdev); kfree(em->map_lookup);
kmem_cache_free(extent_map_cache, em); kmem_cache_free(extent_map_cache, em);
} }
} }
......
...@@ -32,7 +32,15 @@ struct extent_map { ...@@ -32,7 +32,15 @@ struct extent_map {
u64 block_len; u64 block_len;
u64 generation; u64 generation;
unsigned long flags; unsigned long flags;
struct block_device *bdev; 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; atomic_t refs;
unsigned int compress_type; unsigned int compress_type;
struct list_head list; struct list_head list;
......
...@@ -3458,7 +3458,7 @@ static noinline_for_stack int scrub_chunk(struct scrub_ctx *sctx, ...@@ -3458,7 +3458,7 @@ static noinline_for_stack int scrub_chunk(struct scrub_ctx *sctx,
return ret; return ret;
} }
map = (struct map_lookup *)em->bdev; map = em->map_lookup;
if (em->start != chunk_offset) if (em->start != chunk_offset)
goto out; goto out;
......
...@@ -108,7 +108,7 @@ const struct btrfs_raid_attr btrfs_raid_array[BTRFS_NR_RAID_TYPES] = { ...@@ -108,7 +108,7 @@ const struct btrfs_raid_attr btrfs_raid_array[BTRFS_NR_RAID_TYPES] = {
}, },
}; };
const u64 const btrfs_raid_group[BTRFS_NR_RAID_TYPES] = { const u64 btrfs_raid_group[BTRFS_NR_RAID_TYPES] = {
[BTRFS_RAID_RAID10] = BTRFS_BLOCK_GROUP_RAID10, [BTRFS_RAID_RAID10] = BTRFS_BLOCK_GROUP_RAID10,
[BTRFS_RAID_RAID1] = BTRFS_BLOCK_GROUP_RAID1, [BTRFS_RAID_RAID1] = BTRFS_BLOCK_GROUP_RAID1,
[BTRFS_RAID_DUP] = BTRFS_BLOCK_GROUP_DUP, [BTRFS_RAID_DUP] = BTRFS_BLOCK_GROUP_DUP,
...@@ -1183,7 +1183,7 @@ static int contains_pending_extent(struct btrfs_transaction *transaction, ...@@ -1183,7 +1183,7 @@ static int contains_pending_extent(struct btrfs_transaction *transaction,
struct map_lookup *map; struct map_lookup *map;
int i; int i;
map = (struct map_lookup *)em->bdev; map = em->map_lookup;
for (i = 0; i < map->num_stripes; i++) { for (i = 0; i < map->num_stripes; i++) {
u64 end; u64 end;
...@@ -2755,7 +2755,7 @@ int btrfs_remove_chunk(struct btrfs_trans_handle *trans, ...@@ -2755,7 +2755,7 @@ int btrfs_remove_chunk(struct btrfs_trans_handle *trans,
free_extent_map(em); free_extent_map(em);
return -EINVAL; return -EINVAL;
} }
map = (struct map_lookup *)em->bdev; map = em->map_lookup;
lock_chunks(root->fs_info->chunk_root); lock_chunks(root->fs_info->chunk_root);
check_system_chunk(trans, extent_root, map->type); check_system_chunk(trans, extent_root, map->type);
unlock_chunks(root->fs_info->chunk_root); unlock_chunks(root->fs_info->chunk_root);
...@@ -4718,7 +4718,7 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, ...@@ -4718,7 +4718,7 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
goto error; goto error;
} }
set_bit(EXTENT_FLAG_FS_MAPPING, &em->flags); set_bit(EXTENT_FLAG_FS_MAPPING, &em->flags);
em->bdev = (struct block_device *)map; em->map_lookup = map;
em->start = start; em->start = start;
em->len = num_bytes; em->len = num_bytes;
em->block_start = 0; em->block_start = 0;
...@@ -4813,7 +4813,7 @@ int btrfs_finish_chunk_alloc(struct btrfs_trans_handle *trans, ...@@ -4813,7 +4813,7 @@ int btrfs_finish_chunk_alloc(struct btrfs_trans_handle *trans,
return -EINVAL; return -EINVAL;
} }
map = (struct map_lookup *)em->bdev; map = em->map_lookup;
item_size = btrfs_chunk_item_size(map->num_stripes); item_size = btrfs_chunk_item_size(map->num_stripes);
stripe_size = em->orig_block_len; stripe_size = em->orig_block_len;
...@@ -4968,7 +4968,7 @@ int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset) ...@@ -4968,7 +4968,7 @@ int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset)
if (!em) if (!em)
return 1; return 1;
map = (struct map_lookup *)em->bdev; map = em->map_lookup;
for (i = 0; i < map->num_stripes; i++) { for (i = 0; i < map->num_stripes; i++) {
if (map->stripes[i].dev->missing) { if (map->stripes[i].dev->missing) {
miss_ndevs++; miss_ndevs++;
...@@ -5048,7 +5048,7 @@ int btrfs_num_copies(struct btrfs_fs_info *fs_info, u64 logical, u64 len) ...@@ -5048,7 +5048,7 @@ int btrfs_num_copies(struct btrfs_fs_info *fs_info, u64 logical, u64 len)
return 1; return 1;
} }
map = (struct map_lookup *)em->bdev; map = em->map_lookup;
if (map->type & (BTRFS_BLOCK_GROUP_DUP | BTRFS_BLOCK_GROUP_RAID1)) if (map->type & (BTRFS_BLOCK_GROUP_DUP | BTRFS_BLOCK_GROUP_RAID1))
ret = map->num_stripes; ret = map->num_stripes;
else if (map->type & BTRFS_BLOCK_GROUP_RAID10) else if (map->type & BTRFS_BLOCK_GROUP_RAID10)
...@@ -5084,7 +5084,7 @@ unsigned long btrfs_full_stripe_len(struct btrfs_root *root, ...@@ -5084,7 +5084,7 @@ unsigned long btrfs_full_stripe_len(struct btrfs_root *root,
BUG_ON(!em); BUG_ON(!em);
BUG_ON(em->start > logical || em->start + em->len < logical); BUG_ON(em->start > logical || em->start + em->len < logical);
map = (struct map_lookup *)em->bdev; map = em->map_lookup;
if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK)
len = map->stripe_len * nr_data_stripes(map); len = map->stripe_len * nr_data_stripes(map);
free_extent_map(em); free_extent_map(em);
...@@ -5105,7 +5105,7 @@ int btrfs_is_parity_mirror(struct btrfs_mapping_tree *map_tree, ...@@ -5105,7 +5105,7 @@ int btrfs_is_parity_mirror(struct btrfs_mapping_tree *map_tree,
BUG_ON(!em); BUG_ON(!em);
BUG_ON(em->start > logical || em->start + em->len < logical); BUG_ON(em->start > logical || em->start + em->len < logical);
map = (struct map_lookup *)em->bdev; map = em->map_lookup;
if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK)
ret = 1; ret = 1;
free_extent_map(em); free_extent_map(em);
...@@ -5264,7 +5264,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw, ...@@ -5264,7 +5264,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
return -EINVAL; return -EINVAL;
} }
map = (struct map_lookup *)em->bdev; map = em->map_lookup;
offset = logical - em->start; offset = logical - em->start;
stripe_len = map->stripe_len; stripe_len = map->stripe_len;
...@@ -5806,7 +5806,7 @@ int btrfs_rmap_block(struct btrfs_mapping_tree *map_tree, ...@@ -5806,7 +5806,7 @@ int btrfs_rmap_block(struct btrfs_mapping_tree *map_tree,
free_extent_map(em); free_extent_map(em);
return -EIO; return -EIO;
} }
map = (struct map_lookup *)em->bdev; map = em->map_lookup;
length = em->len; length = em->len;
rmap_len = map->stripe_len; rmap_len = map->stripe_len;
...@@ -6242,7 +6242,7 @@ static int read_one_chunk(struct btrfs_root *root, struct btrfs_key *key, ...@@ -6242,7 +6242,7 @@ static int read_one_chunk(struct btrfs_root *root, struct btrfs_key *key,
} }
set_bit(EXTENT_FLAG_FS_MAPPING, &em->flags); set_bit(EXTENT_FLAG_FS_MAPPING, &em->flags);
em->bdev = (struct block_device *)map; em->map_lookup = map;
em->start = logical; em->start = logical;
em->len = length; em->len = length;
em->orig_start = 0; em->orig_start = 0;
...@@ -6944,7 +6944,7 @@ void btrfs_update_commit_device_bytes_used(struct btrfs_root *root, ...@@ -6944,7 +6944,7 @@ void btrfs_update_commit_device_bytes_used(struct btrfs_root *root,
/* In order to kick the device replace finish process */ /* In order to kick the device replace finish process */
lock_chunks(root); lock_chunks(root);
list_for_each_entry(em, &transaction->pending_chunks, list) { list_for_each_entry(em, &transaction->pending_chunks, list) {
map = (struct map_lookup *)em->bdev; map = em->map_lookup;
for (i = 0; i < map->num_stripes; i++) { for (i = 0; i < map->num_stripes; i++) {
dev = map->stripes[i].dev; dev = map->stripes[i].dev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment