mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
btrfs: zoned: add asserts on splitting extent_map
We call split_zoned_em() on an extent_map on submitting a bio for it. Thus, we can assume the extent_map is PINNED, not LOGGING, and in the modified list. Add ASSERT()s to ensure the extent_maps after the split also has the proper flags set and are in the modified list. Suggested-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
0ae79c6fe7
commit
63fb5879db
1 changed files with 6 additions and 6 deletions
|
@ -2303,7 +2303,6 @@ static int split_zoned_em(struct btrfs_inode *inode, u64 start, u64 len,
|
||||||
struct extent_map *split_mid = NULL;
|
struct extent_map *split_mid = NULL;
|
||||||
struct extent_map *split_post = NULL;
|
struct extent_map *split_post = NULL;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int modified;
|
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
|
@ -2333,11 +2332,12 @@ static int split_zoned_em(struct btrfs_inode *inode, u64 start, u64 len,
|
||||||
ASSERT(em->len == len);
|
ASSERT(em->len == len);
|
||||||
ASSERT(!test_bit(EXTENT_FLAG_COMPRESSED, &em->flags));
|
ASSERT(!test_bit(EXTENT_FLAG_COMPRESSED, &em->flags));
|
||||||
ASSERT(em->block_start < EXTENT_MAP_LAST_BYTE);
|
ASSERT(em->block_start < EXTENT_MAP_LAST_BYTE);
|
||||||
|
ASSERT(test_bit(EXTENT_FLAG_PINNED, &em->flags));
|
||||||
|
ASSERT(!test_bit(EXTENT_FLAG_LOGGING, &em->flags));
|
||||||
|
ASSERT(!list_empty(&em->list));
|
||||||
|
|
||||||
flags = em->flags;
|
flags = em->flags;
|
||||||
clear_bit(EXTENT_FLAG_PINNED, &em->flags);
|
clear_bit(EXTENT_FLAG_PINNED, &em->flags);
|
||||||
clear_bit(EXTENT_FLAG_LOGGING, &flags);
|
|
||||||
modified = !list_empty(&em->list);
|
|
||||||
|
|
||||||
/* First, replace the em with a new extent_map starting from * em->start */
|
/* First, replace the em with a new extent_map starting from * em->start */
|
||||||
split_pre->start = em->start;
|
split_pre->start = em->start;
|
||||||
|
@ -2351,7 +2351,7 @@ static int split_zoned_em(struct btrfs_inode *inode, u64 start, u64 len,
|
||||||
split_pre->compress_type = em->compress_type;
|
split_pre->compress_type = em->compress_type;
|
||||||
split_pre->generation = em->generation;
|
split_pre->generation = em->generation;
|
||||||
|
|
||||||
replace_extent_mapping(em_tree, em, split_pre, modified);
|
replace_extent_mapping(em_tree, em, split_pre, 1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now we only have an extent_map at:
|
* Now we only have an extent_map at:
|
||||||
|
@ -2371,7 +2371,7 @@ static int split_zoned_em(struct btrfs_inode *inode, u64 start, u64 len,
|
||||||
split_mid->flags = flags;
|
split_mid->flags = flags;
|
||||||
split_mid->compress_type = em->compress_type;
|
split_mid->compress_type = em->compress_type;
|
||||||
split_mid->generation = em->generation;
|
split_mid->generation = em->generation;
|
||||||
add_extent_mapping(em_tree, split_mid, modified);
|
add_extent_mapping(em_tree, split_mid, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (post) {
|
if (post) {
|
||||||
|
@ -2385,7 +2385,7 @@ static int split_zoned_em(struct btrfs_inode *inode, u64 start, u64 len,
|
||||||
split_post->flags = flags;
|
split_post->flags = flags;
|
||||||
split_post->compress_type = em->compress_type;
|
split_post->compress_type = em->compress_type;
|
||||||
split_post->generation = em->generation;
|
split_post->generation = em->generation;
|
||||||
add_extent_mapping(em_tree, split_post, modified);
|
add_extent_mapping(em_tree, split_post, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Once for us */
|
/* Once for us */
|
||||||
|
|
Loading…
Add table
Reference in a new issue