diff options
author | Chris Mason <clm@fb.com> | 2016-01-19 21:21:00 -0500 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2016-01-19 21:21:00 -0500 |
commit | acc308556c812485462b6b43843c3f64530dd843 (patch) | |
tree | fa26745572077d32d446e5fc444eb253812577d1 /fs/btrfs | |
parent | 988f1f576d4f7531cb2175ee1b7cb7afd6d95d22 (diff) | |
parent | fb75d857a31d600cc0c37b8c7d914014f7fa3f9a (diff) |
Merge branch 'misc-cleanups-4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux into for-linus-4.5
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/backref.c | 10 | ||||
-rw-r--r-- | fs/btrfs/dev-replace.c | 2 | ||||
-rw-r--r-- | fs/btrfs/extent-tree.c | 4 | ||||
-rw-r--r-- | fs/btrfs/extent_map.c | 2 | ||||
-rw-r--r-- | fs/btrfs/extent_map.h | 10 | ||||
-rw-r--r-- | fs/btrfs/scrub.c | 2 | ||||
-rw-r--r-- | fs/btrfs/volumes.c | 26 |
7 files changed, 32 insertions, 24 deletions
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 08405a3da6b1..b90cd3776f8e 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c | |||
@@ -560,13 +560,13 @@ static int __add_missing_keys(struct btrfs_fs_info *fs_info, | |||
560 | */ | 560 | */ |
561 | static void __merge_refs(struct list_head *head, int mode) | 561 | static void __merge_refs(struct list_head *head, int mode) |
562 | { | 562 | { |
563 | struct __prelim_ref *ref1; | 563 | struct __prelim_ref *pos1; |
564 | 564 | ||
565 | list_for_each_entry(ref1, head, list) { | 565 | list_for_each_entry(pos1, head, list) { |
566 | struct __prelim_ref *ref2 = ref1, *tmp; | 566 | struct __prelim_ref *pos2 = pos1, *tmp; |
567 | 567 | ||
568 | list_for_each_entry_safe_continue(ref2, tmp, head, list) { | 568 | list_for_each_entry_safe_continue(pos2, tmp, head, list) { |
569 | struct __prelim_ref *xchg; | 569 | struct __prelim_ref *xchg, *ref1 = pos1, *ref2 = pos2; |
570 | struct extent_inode_elem *eie; | 570 | struct extent_inode_elem *eie; |
571 | 571 | ||
572 | if (!ref_for_same_block(ref1, ref2)) | 572 | if (!ref_for_same_block(ref1, ref2)) |
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index 1e668fb7dd4c..cbb7dbfb3fff 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c | |||
@@ -614,7 +614,7 @@ static void btrfs_dev_replace_update_device_in_mapping_tree( | |||
614 | em = lookup_extent_mapping(em_tree, start, (u64)-1); | 614 | em = lookup_extent_mapping(em_tree, start, (u64)-1); |
615 | if (!em) | 615 | if (!em) |
616 | break; | 616 | break; |
617 | map = (struct map_lookup *)em->bdev; | 617 | map = em->map_lookup; |
618 | for (i = 0; i < map->num_stripes; i++) | 618 | for (i = 0; i < map->num_stripes; i++) |
619 | if (srcdev == map->stripes[i].dev) | 619 | if (srcdev == map->stripes[i].dev) |
620 | map->stripes[i].dev = tgtdev; | 620 | map->stripes[i].dev = tgtdev; |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 60cc1399c64f..92843ab772a5 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -10399,7 +10399,7 @@ btrfs_start_trans_remove_block_group(struct btrfs_fs_info *fs_info, | |||
10399 | * more device items and remove one chunk item), but this is done at | 10399 | * more device items and remove one chunk item), but this is done at |
10400 | * btrfs_remove_chunk() through a call to check_system_chunk(). | 10400 | * btrfs_remove_chunk() through a call to check_system_chunk(). |
10401 | */ | 10401 | */ |
10402 | map = (struct map_lookup *)em->bdev; | 10402 | map = em->map_lookup; |
10403 | num_items = 3 + map->num_stripes; | 10403 | num_items = 3 + map->num_stripes; |
10404 | free_extent_map(em); | 10404 | free_extent_map(em); |
10405 | 10405 | ||
@@ -10586,7 +10586,7 @@ int btrfs_init_space_info(struct btrfs_fs_info *fs_info) | |||
10586 | 10586 | ||
10587 | disk_super = fs_info->super_copy; | 10587 | disk_super = fs_info->super_copy; |
10588 | if (!btrfs_super_root(disk_super)) | 10588 | if (!btrfs_super_root(disk_super)) |
10589 | return 1; | 10589 | return -EINVAL; |
10590 | 10590 | ||
10591 | features = btrfs_super_incompat_flags(disk_super); | 10591 | features = btrfs_super_incompat_flags(disk_super); |
10592 | if (features & BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS) | 10592 | if (features & BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS) |
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c index 6a98bddd8f33..84fb56d5c018 100644 --- a/fs/btrfs/extent_map.c +++ b/fs/btrfs/extent_map.c | |||
@@ -76,7 +76,7 @@ void free_extent_map(struct extent_map *em) | |||
76 | WARN_ON(extent_map_in_tree(em)); | 76 | WARN_ON(extent_map_in_tree(em)); |
77 | WARN_ON(!list_empty(&em->list)); | 77 | WARN_ON(!list_empty(&em->list)); |
78 | if (test_bit(EXTENT_FLAG_FS_MAPPING, &em->flags)) | 78 | if (test_bit(EXTENT_FLAG_FS_MAPPING, &em->flags)) |
79 | kfree(em->bdev); | 79 | kfree(em->map_lookup); |
80 | kmem_cache_free(extent_map_cache, em); | 80 | kmem_cache_free(extent_map_cache, em); |
81 | } | 81 | } |
82 | } | 82 | } |
diff --git a/fs/btrfs/extent_map.h b/fs/btrfs/extent_map.h index b2991fd8583e..eb8b8fae036b 100644 --- a/fs/btrfs/extent_map.h +++ b/fs/btrfs/extent_map.h | |||
@@ -32,7 +32,15 @@ struct extent_map { | |||
32 | u64 block_len; | 32 | u64 block_len; |
33 | u64 generation; | 33 | u64 generation; |
34 | unsigned long flags; | 34 | unsigned long flags; |
35 | struct block_device *bdev; | 35 | union { |
36 | struct block_device *bdev; | ||
37 | |||
38 | /* | ||
39 | * used for chunk mappings | ||
40 | * flags & EXTENT_FLAG_FS_MAPPING must be set | ||
41 | */ | ||
42 | struct map_lookup *map_lookup; | ||
43 | }; | ||
36 | atomic_t refs; | 44 | atomic_t refs; |
37 | unsigned int compress_type; | 45 | unsigned int compress_type; |
38 | struct list_head list; | 46 | struct list_head list; |
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 0c981ebe2acb..681db07f25ea 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c | |||
@@ -3458,7 +3458,7 @@ static noinline_for_stack int scrub_chunk(struct scrub_ctx *sctx, | |||
3458 | return ret; | 3458 | return ret; |
3459 | } | 3459 | } |
3460 | 3460 | ||
3461 | map = (struct map_lookup *)em->bdev; | 3461 | map = em->map_lookup; |
3462 | if (em->start != chunk_offset) | 3462 | if (em->start != chunk_offset) |
3463 | goto out; | 3463 | goto out; |
3464 | 3464 | ||
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index c32abbca9d77..ad972fcbc0af 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -108,7 +108,7 @@ const struct btrfs_raid_attr btrfs_raid_array[BTRFS_NR_RAID_TYPES] = { | |||
108 | }, | 108 | }, |
109 | }; | 109 | }; |
110 | 110 | ||
111 | const u64 const btrfs_raid_group[BTRFS_NR_RAID_TYPES] = { | 111 | const u64 btrfs_raid_group[BTRFS_NR_RAID_TYPES] = { |
112 | [BTRFS_RAID_RAID10] = BTRFS_BLOCK_GROUP_RAID10, | 112 | [BTRFS_RAID_RAID10] = BTRFS_BLOCK_GROUP_RAID10, |
113 | [BTRFS_RAID_RAID1] = BTRFS_BLOCK_GROUP_RAID1, | 113 | [BTRFS_RAID_RAID1] = BTRFS_BLOCK_GROUP_RAID1, |
114 | [BTRFS_RAID_DUP] = BTRFS_BLOCK_GROUP_DUP, | 114 | [BTRFS_RAID_DUP] = BTRFS_BLOCK_GROUP_DUP, |
@@ -1183,7 +1183,7 @@ again: | |||
1183 | struct map_lookup *map; | 1183 | struct map_lookup *map; |
1184 | int i; | 1184 | int i; |
1185 | 1185 | ||
1186 | map = (struct map_lookup *)em->bdev; | 1186 | map = em->map_lookup; |
1187 | for (i = 0; i < map->num_stripes; i++) { | 1187 | for (i = 0; i < map->num_stripes; i++) { |
1188 | u64 end; | 1188 | u64 end; |
1189 | 1189 | ||
@@ -2755,7 +2755,7 @@ int btrfs_remove_chunk(struct btrfs_trans_handle *trans, | |||
2755 | free_extent_map(em); | 2755 | free_extent_map(em); |
2756 | return -EINVAL; | 2756 | return -EINVAL; |
2757 | } | 2757 | } |
2758 | map = (struct map_lookup *)em->bdev; | 2758 | map = em->map_lookup; |
2759 | lock_chunks(root->fs_info->chunk_root); | 2759 | lock_chunks(root->fs_info->chunk_root); |
2760 | check_system_chunk(trans, extent_root, map->type); | 2760 | check_system_chunk(trans, extent_root, map->type); |
2761 | unlock_chunks(root->fs_info->chunk_root); | 2761 | unlock_chunks(root->fs_info->chunk_root); |
@@ -4718,7 +4718,7 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, | |||
4718 | goto error; | 4718 | goto error; |
4719 | } | 4719 | } |
4720 | set_bit(EXTENT_FLAG_FS_MAPPING, &em->flags); | 4720 | set_bit(EXTENT_FLAG_FS_MAPPING, &em->flags); |
4721 | em->bdev = (struct block_device *)map; | 4721 | em->map_lookup = map; |
4722 | em->start = start; | 4722 | em->start = start; |
4723 | em->len = num_bytes; | 4723 | em->len = num_bytes; |
4724 | em->block_start = 0; | 4724 | em->block_start = 0; |
@@ -4813,7 +4813,7 @@ int btrfs_finish_chunk_alloc(struct btrfs_trans_handle *trans, | |||
4813 | return -EINVAL; | 4813 | return -EINVAL; |
4814 | } | 4814 | } |
4815 | 4815 | ||
4816 | map = (struct map_lookup *)em->bdev; | 4816 | map = em->map_lookup; |
4817 | item_size = btrfs_chunk_item_size(map->num_stripes); | 4817 | item_size = btrfs_chunk_item_size(map->num_stripes); |
4818 | stripe_size = em->orig_block_len; | 4818 | stripe_size = em->orig_block_len; |
4819 | 4819 | ||
@@ -4968,7 +4968,7 @@ int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset) | |||
4968 | if (!em) | 4968 | if (!em) |
4969 | return 1; | 4969 | return 1; |
4970 | 4970 | ||
4971 | map = (struct map_lookup *)em->bdev; | 4971 | map = em->map_lookup; |
4972 | for (i = 0; i < map->num_stripes; i++) { | 4972 | for (i = 0; i < map->num_stripes; i++) { |
4973 | if (map->stripes[i].dev->missing) { | 4973 | if (map->stripes[i].dev->missing) { |
4974 | miss_ndevs++; | 4974 | miss_ndevs++; |
@@ -5048,7 +5048,7 @@ int btrfs_num_copies(struct btrfs_fs_info *fs_info, u64 logical, u64 len) | |||
5048 | return 1; | 5048 | return 1; |
5049 | } | 5049 | } |
5050 | 5050 | ||
5051 | map = (struct map_lookup *)em->bdev; | 5051 | map = em->map_lookup; |
5052 | if (map->type & (BTRFS_BLOCK_GROUP_DUP | BTRFS_BLOCK_GROUP_RAID1)) | 5052 | if (map->type & (BTRFS_BLOCK_GROUP_DUP | BTRFS_BLOCK_GROUP_RAID1)) |
5053 | ret = map->num_stripes; | 5053 | ret = map->num_stripes; |
5054 | else if (map->type & BTRFS_BLOCK_GROUP_RAID10) | 5054 | else if (map->type & BTRFS_BLOCK_GROUP_RAID10) |
@@ -5084,7 +5084,7 @@ unsigned long btrfs_full_stripe_len(struct btrfs_root *root, | |||
5084 | BUG_ON(!em); | 5084 | BUG_ON(!em); |
5085 | 5085 | ||
5086 | BUG_ON(em->start > logical || em->start + em->len < logical); | 5086 | BUG_ON(em->start > logical || em->start + em->len < logical); |
5087 | map = (struct map_lookup *)em->bdev; | 5087 | map = em->map_lookup; |
5088 | if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) | 5088 | if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) |
5089 | len = map->stripe_len * nr_data_stripes(map); | 5089 | len = map->stripe_len * nr_data_stripes(map); |
5090 | free_extent_map(em); | 5090 | free_extent_map(em); |
@@ -5105,7 +5105,7 @@ int btrfs_is_parity_mirror(struct btrfs_mapping_tree *map_tree, | |||
5105 | BUG_ON(!em); | 5105 | BUG_ON(!em); |
5106 | 5106 | ||
5107 | BUG_ON(em->start > logical || em->start + em->len < logical); | 5107 | BUG_ON(em->start > logical || em->start + em->len < logical); |
5108 | map = (struct map_lookup *)em->bdev; | 5108 | map = em->map_lookup; |
5109 | if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) | 5109 | if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) |
5110 | ret = 1; | 5110 | ret = 1; |
5111 | free_extent_map(em); | 5111 | free_extent_map(em); |
@@ -5264,7 +5264,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw, | |||
5264 | return -EINVAL; | 5264 | return -EINVAL; |
5265 | } | 5265 | } |
5266 | 5266 | ||
5267 | map = (struct map_lookup *)em->bdev; | 5267 | map = em->map_lookup; |
5268 | offset = logical - em->start; | 5268 | offset = logical - em->start; |
5269 | 5269 | ||
5270 | stripe_len = map->stripe_len; | 5270 | stripe_len = map->stripe_len; |
@@ -5806,7 +5806,7 @@ int btrfs_rmap_block(struct btrfs_mapping_tree *map_tree, | |||
5806 | free_extent_map(em); | 5806 | free_extent_map(em); |
5807 | return -EIO; | 5807 | return -EIO; |
5808 | } | 5808 | } |
5809 | map = (struct map_lookup *)em->bdev; | 5809 | map = em->map_lookup; |
5810 | 5810 | ||
5811 | length = em->len; | 5811 | length = em->len; |
5812 | rmap_len = map->stripe_len; | 5812 | rmap_len = map->stripe_len; |
@@ -6242,7 +6242,7 @@ static int read_one_chunk(struct btrfs_root *root, struct btrfs_key *key, | |||
6242 | } | 6242 | } |
6243 | 6243 | ||
6244 | set_bit(EXTENT_FLAG_FS_MAPPING, &em->flags); | 6244 | set_bit(EXTENT_FLAG_FS_MAPPING, &em->flags); |
6245 | em->bdev = (struct block_device *)map; | 6245 | em->map_lookup = map; |
6246 | em->start = logical; | 6246 | em->start = logical; |
6247 | em->len = length; | 6247 | em->len = length; |
6248 | em->orig_start = 0; | 6248 | em->orig_start = 0; |
@@ -6944,7 +6944,7 @@ void btrfs_update_commit_device_bytes_used(struct btrfs_root *root, | |||
6944 | /* In order to kick the device replace finish process */ | 6944 | /* In order to kick the device replace finish process */ |
6945 | lock_chunks(root); | 6945 | lock_chunks(root); |
6946 | list_for_each_entry(em, &transaction->pending_chunks, list) { | 6946 | list_for_each_entry(em, &transaction->pending_chunks, list) { |
6947 | map = (struct map_lookup *)em->bdev; | 6947 | map = em->map_lookup; |
6948 | 6948 | ||
6949 | for (i = 0; i < map->num_stripes; i++) { | 6949 | for (i = 0; i < map->num_stripes; i++) { |
6950 | dev = map->stripes[i].dev; | 6950 | dev = map->stripes[i].dev; |