summaryrefslogtreecommitdiff
path: root/ctree.h
diff options
context:
space:
mode:
authorQu Wenruo <wqu@suse.com>2018-06-06 15:27:13 +0800
committerDavid Sterba <dsterba@suse.com>2018-08-06 15:00:34 +0200
commit3c042605db2238c09f56c197a58624d4e10c5d2e (patch)
tree16d840e1e8f861cb26e369a0e76b78e2ba599a53 /ctree.h
parent90b677a2d7e6b14e3047b5ac8625269378c1198f (diff)
btrfs-progs: Get rid of the confusing btrfs_file_extent_inline_len()
[BUG] If one uncompressed inline extent has incorrect ram_bytes, neither btrfs check nor dump-tree could detect such corruption. [CAUSE] Every caller tries to read inline extent ram_bytes is using btrfs_file_extent_inline_len(), other than directly calling btrfs_file_extent_ram_bytes(). For compressed extent, it's just calling btrfs_file_extent_ram_bytes(). However for uncompressed extent, it falls back to btrfs_file_extent_inline_item_len(), makes us unable to detect anything wrong in ram_bytes. [FIX] Just get rid of such confusing btrfs_file_extent_inline_len() function. Reported-by: Steve Leung <sjleung@shaw.ca> Tested-by: Steve Leung <sjleung@shaw.ca> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'ctree.h')
-rw-r--r--ctree.h22
1 files changed, 0 insertions, 22 deletions
diff --git a/ctree.h b/ctree.h
index de4b1b7e..04a77550 100644
--- a/ctree.h
+++ b/ctree.h
@@ -2443,28 +2443,6 @@ static inline u32 btrfs_search_header_len(struct btrfs_ioctl_search_header *sh)
return get_unaligned_32(&sh->len);
}
-/* this returns the number of file bytes represented by the inline item.
- * If an item is compressed, this is the uncompressed size
- */
-static inline u32 btrfs_file_extent_inline_len(struct extent_buffer *eb,
- int slot,
- struct btrfs_file_extent_item *fi)
-{
- /*
- * return the space used on disk if this item isn't
- * compressed or encoded
- */
- if (btrfs_file_extent_compression(eb, fi) == 0 &&
- btrfs_file_extent_encryption(eb, fi) == 0 &&
- btrfs_file_extent_other_encoding(eb, fi) == 0) {
- return btrfs_file_extent_inline_item_len(eb,
- btrfs_item_nr(slot));
- }
-
- /* otherwise use the ram bytes field */
- return btrfs_file_extent_ram_bytes(eb, fi);
-}
-
#define btrfs_fs_incompat(fs_info, opt) \
__btrfs_fs_incompat((fs_info), BTRFS_FEATURE_INCOMPAT_##opt)