Commit 4a2d25cd authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: Remove redundant FLAG_VACANCY

Commit 9036c102 ("Btrfs: update hole handling v2") added the
FLAG_VACANCY to denote holes, however there was already a consistent way
of flagging extents which represent hole - ->block_start =
EXTENT_MAP_HOLE. And also the only place where this flag is checked is
in the fiemap code, but the block_start value is also checked and every
other place in the filesystem detects holes by using block_start
value's. So remove the extra flag. This survived a full xfstest run.
Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 3f2dd7a0
...@@ -4311,10 +4311,8 @@ static struct extent_map *get_extent_skip_holes(struct inode *inode, ...@@ -4311,10 +4311,8 @@ static struct extent_map *get_extent_skip_holes(struct inode *inode,
return em; return em;
/* if this isn't a hole return it */ /* if this isn't a hole return it */
if (!test_bit(EXTENT_FLAG_VACANCY, &em->flags) && if (em->block_start != EXTENT_MAP_HOLE)
em->block_start != EXTENT_MAP_HOLE) {
return em; return em;
}
/* this is a hole, advance to the next extent */ /* this is a hole, advance to the next extent */
offset = extent_map_end(em); offset = extent_map_end(em);
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
/* bits for the flags field */ /* bits for the flags field */
#define EXTENT_FLAG_PINNED 0 /* this entry not yet on disk, don't free it */ #define EXTENT_FLAG_PINNED 0 /* this entry not yet on disk, don't free it */
#define EXTENT_FLAG_COMPRESSED 1 #define EXTENT_FLAG_COMPRESSED 1
#define EXTENT_FLAG_VACANCY 2 /* no file extent item found */
#define EXTENT_FLAG_PREALLOC 3 /* pre-allocated extent */ #define EXTENT_FLAG_PREALLOC 3 /* pre-allocated extent */
#define EXTENT_FLAG_LOGGING 4 /* Logging this extent */ #define EXTENT_FLAG_LOGGING 4 /* Logging this extent */
#define EXTENT_FLAG_FILLING 5 /* Filling in a preallocated extent */ #define EXTENT_FLAG_FILLING 5 /* Filling in a preallocated extent */
......
...@@ -7118,7 +7118,6 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode, ...@@ -7118,7 +7118,6 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
em->len = len; em->len = len;
not_found_em: not_found_em:
em->block_start = EXTENT_MAP_HOLE; em->block_start = EXTENT_MAP_HOLE;
set_bit(EXTENT_FLAG_VACANCY, &em->flags);
insert: insert:
btrfs_release_path(path); btrfs_release_path(path);
if (em->start > start || extent_map_end(em) <= start) { if (em->start > start || extent_map_end(em) <= start) {
......
...@@ -288,10 +288,6 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -288,10 +288,6 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
test_msg("Expected a hole, got %llu\n", em->block_start); test_msg("Expected a hole, got %llu\n", em->block_start);
goto out; goto out;
} }
if (!test_bit(EXTENT_FLAG_VACANCY, &em->flags)) {
test_msg("Vacancy flag wasn't set properly\n");
goto out;
}
free_extent_map(em); free_extent_map(em);
btrfs_drop_extent_cache(BTRFS_I(inode), 0, (u64)-1, 0); btrfs_drop_extent_cache(BTRFS_I(inode), 0, (u64)-1, 0);
...@@ -1130,7 +1126,6 @@ int btrfs_test_inodes(u32 sectorsize, u32 nodesize) ...@@ -1130,7 +1126,6 @@ int btrfs_test_inodes(u32 sectorsize, u32 nodesize)
int ret; int ret;
set_bit(EXTENT_FLAG_COMPRESSED, &compressed_only); set_bit(EXTENT_FLAG_COMPRESSED, &compressed_only);
set_bit(EXTENT_FLAG_VACANCY, &vacancy_only);
set_bit(EXTENT_FLAG_PREALLOC, &prealloc_only); set_bit(EXTENT_FLAG_PREALLOC, &prealloc_only);
test_msg("Running btrfs_get_extent tests\n"); test_msg("Running btrfs_get_extent tests\n");
......
...@@ -193,7 +193,6 @@ DEFINE_EVENT(btrfs__inode, btrfs_inode_evict, ...@@ -193,7 +193,6 @@ DEFINE_EVENT(btrfs__inode, btrfs_inode_evict,
__print_flags(flag, "|", \ __print_flags(flag, "|", \
{ (1 << EXTENT_FLAG_PINNED), "PINNED" },\ { (1 << EXTENT_FLAG_PINNED), "PINNED" },\
{ (1 << EXTENT_FLAG_COMPRESSED), "COMPRESSED" },\ { (1 << EXTENT_FLAG_COMPRESSED), "COMPRESSED" },\
{ (1 << EXTENT_FLAG_VACANCY), "VACANCY" },\
{ (1 << EXTENT_FLAG_PREALLOC), "PREALLOC" },\ { (1 << EXTENT_FLAG_PREALLOC), "PREALLOC" },\
{ (1 << EXTENT_FLAG_LOGGING), "LOGGING" },\ { (1 << EXTENT_FLAG_LOGGING), "LOGGING" },\
{ (1 << EXTENT_FLAG_FILLING), "FILLING" },\ { (1 << EXTENT_FLAG_FILLING), "FILLING" },\
......
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