Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

btrfs: add forward declarations and headers, part 2

Do a cleanup in more headers:

- add forward declarations for types referenced by pointers
- add includes when types need them

This fixes potential compilation problems if the headers are reordered
or the missing includes are not provided indirectly.

Signed-off-by: David Sterba <dsterba@suse.com>

+206 -19
+2
fs/btrfs/bio.h
··· 7 7 #ifndef BTRFS_BIO_H 8 8 #define BTRFS_BIO_H 9 9 10 + #include <linux/types.h> 10 11 #include <linux/bio.h> 11 12 #include <linux/workqueue.h> 12 13 #include "tree-checker.h" 13 14 14 15 struct btrfs_bio; 15 16 struct btrfs_fs_info; 17 + struct btrfs_inode; 16 18 17 19 #define BTRFS_BIO_INLINE_CSUM_SIZE 64 18 20
+7
fs/btrfs/block-rsv.h
··· 3 3 #ifndef BTRFS_BLOCK_RSV_H 4 4 #define BTRFS_BLOCK_RSV_H 5 5 6 + #include <linux/types.h> 7 + #include <linux/compiler.h> 8 + #include <linux/spinlock.h> 9 + 6 10 struct btrfs_trans_handle; 7 11 struct btrfs_root; 12 + struct btrfs_space_info; 13 + struct btrfs_block_rsv; 14 + struct btrfs_fs_info; 8 15 enum btrfs_reserve_flush_enum; 9 16 10 17 /*
+8 -2
fs/btrfs/compression.h
··· 7 7 #define BTRFS_COMPRESSION_H 8 8 9 9 #include <linux/sizes.h> 10 + #include <linux/mm.h> 11 + #include <linux/list.h> 12 + #include <linux/workqueue.h> 13 + #include <linux/wait.h> 10 14 #include "bio.h" 11 15 16 + struct address_space; 17 + struct page; 18 + struct inode; 12 19 struct btrfs_inode; 13 20 struct btrfs_ordered_extent; 21 + struct btrfs_bio; 14 22 15 23 /* 16 24 * We want to make sure that amount of RAM required to uncompress an extent is ··· 39 31 #define BTRFS_MAX_UNCOMPRESSED (SZ_128K) 40 32 41 33 #define BTRFS_ZLIB_DEFAULT_LEVEL 3 42 - 43 - struct page; 44 34 45 35 struct compressed_bio { 46 36 /* Number of compressed pages in the array */
+8
fs/btrfs/delayed-inode.h
··· 7 7 #ifndef BTRFS_DELAYED_INODE_H 8 8 #define BTRFS_DELAYED_INODE_H 9 9 10 + #include <linux/types.h> 10 11 #include <linux/rbtree.h> 11 12 #include <linux/spinlock.h> 12 13 #include <linux/mutex.h> 13 14 #include <linux/list.h> 14 15 #include <linux/wait.h> 16 + #include <linux/fs.h> 15 17 #include <linux/atomic.h> 16 18 #include <linux/refcount.h> 17 19 #include "ctree.h" 20 + 21 + struct btrfs_disk_key; 22 + struct btrfs_fs_info; 23 + struct btrfs_inode; 24 + struct btrfs_root; 25 + struct btrfs_trans_handle; 18 26 19 27 enum btrfs_delayed_item_type { 20 28 BTRFS_DELAYED_INSERTION_ITEM,
+12 -4
fs/btrfs/disk-io.h
··· 7 7 #define BTRFS_DISK_IO_H 8 8 9 9 #include <linux/sizes.h> 10 + #include <linux/compiler_types.h> 10 11 #include "ctree.h" 11 12 #include "fs.h" 13 + 14 + struct block_device; 15 + struct super_block; 16 + struct extent_buffer; 17 + struct btrfs_device; 18 + struct btrfs_fs_devices; 19 + struct btrfs_fs_info; 20 + struct btrfs_super_block; 21 + struct btrfs_trans_handle; 22 + struct btrfs_tree_parent_check; 23 + struct btrfs_transaction; 12 24 13 25 #define BTRFS_SUPER_MIRROR_MAX 3 14 26 #define BTRFS_SUPER_MIRROR_SHIFT 12 ··· 40 28 return start << (BTRFS_SUPER_MIRROR_SHIFT * mirror); 41 29 return BTRFS_SUPER_INFO_OFFSET; 42 30 } 43 - 44 - struct btrfs_device; 45 - struct btrfs_fs_devices; 46 - struct btrfs_tree_parent_check; 47 31 48 32 void btrfs_check_leaked_roots(struct btrfs_fs_info *fs_info); 49 33 void btrfs_init_fs_info(struct btrfs_fs_info *fs_info);
+7
fs/btrfs/extent-io-tree.h
··· 3 3 #ifndef BTRFS_EXTENT_IO_TREE_H 4 4 #define BTRFS_EXTENT_IO_TREE_H 5 5 6 + #include <linux/rbtree.h> 7 + #include <linux/spinlock.h> 8 + #include <linux/refcount.h> 9 + #include <linux/list.h> 10 + #include <linux/wait.h> 6 11 #include "misc.h" 7 12 8 13 struct extent_changeset; 14 + struct btrfs_fs_info; 15 + struct btrfs_inode; 9 16 10 17 /* Bits for the extent state */ 11 18 enum {
+9
fs/btrfs/extent-tree.h
··· 3 3 #ifndef BTRFS_EXTENT_TREE_H 4 4 #define BTRFS_EXTENT_TREE_H 5 5 6 + #include <linux/types.h> 6 7 #include "misc.h" 7 8 #include "block-group.h" 9 + #include "locking.h" 8 10 11 + struct extent_buffer; 9 12 struct btrfs_free_cluster; 13 + struct btrfs_fs_info; 14 + struct btrfs_root; 15 + struct btrfs_path; 16 + struct btrfs_disk_key; 10 17 struct btrfs_delayed_ref_head; 18 + struct btrfs_delayed_ref_root; 19 + struct btrfs_extent_inline_ref; 11 20 12 21 enum btrfs_extent_allocation_policy { 13 22 BTRFS_EXTENT_ALLOC_CLUSTERED,
+20 -5
fs/btrfs/extent_io.h
··· 7 7 #include <linux/refcount.h> 8 8 #include <linux/fiemap.h> 9 9 #include <linux/btrfs_tree.h> 10 + #include <linux/spinlock.h> 11 + #include <linux/atomic.h> 12 + #include <linux/rwsem.h> 13 + #include <linux/list.h> 14 + #include <linux/slab.h> 10 15 #include "compression.h" 11 16 #include "messages.h" 12 17 #include "ulist.h" 13 18 #include "misc.h" 14 19 20 + struct page; 21 + struct file; 22 + struct folio; 23 + struct inode; 24 + struct fiemap_extent_info; 25 + struct readahead_control; 26 + struct address_space; 27 + struct writeback_control; 28 + struct extent_io_tree; 29 + struct extent_map_tree; 30 + struct btrfs_block_group; 31 + struct btrfs_fs_info; 32 + struct btrfs_inode; 33 + struct btrfs_root; 15 34 struct btrfs_trans_handle; 35 + struct btrfs_tree_parent_check; 16 36 17 37 enum { 18 38 EXTENT_BUFFER_UPTODATE, ··· 84 64 #define BITMAP_LAST_BYTE_MASK(nbits) \ 85 65 (BYTE_MASK >> (-(nbits) & (BITS_PER_BYTE - 1))) 86 66 87 - struct btrfs_root; 88 - struct btrfs_inode; 89 - struct btrfs_fs_info; 90 - struct extent_io_tree; 91 - struct btrfs_tree_parent_check; 92 67 93 68 int __init extent_buffer_init_cachep(void); 94 69 void __cold extent_buffer_free_cachep(void);
+7
fs/btrfs/extent_map.h
··· 3 3 #ifndef BTRFS_EXTENT_MAP_H 4 4 #define BTRFS_EXTENT_MAP_H 5 5 6 + #include <linux/compiler_types.h> 7 + #include <linux/rwlock_types.h> 6 8 #include <linux/rbtree.h> 9 + #include <linux/list.h> 7 10 #include <linux/refcount.h> 8 11 #include "misc.h" 12 + #include "extent_map.h" 9 13 #include "compression.h" 14 + 15 + struct btrfs_inode; 16 + struct btrfs_fs_info; 10 17 11 18 #define EXTENT_MAP_LAST_BYTE ((u64)-4) 12 19 #define EXTENT_MAP_HOLE ((u64)-3)
+11
fs/btrfs/file-item.h
··· 3 3 #ifndef BTRFS_FILE_ITEM_H 4 4 #define BTRFS_FILE_ITEM_H 5 5 6 + #include <linux/list.h> 7 + #include <uapi/linux/btrfs_tree.h> 6 8 #include "accessors.h" 7 9 8 10 struct extent_map; 11 + struct btrfs_file_extent_item; 12 + struct btrfs_fs_info; 13 + struct btrfs_path; 14 + struct btrfs_bio; 15 + struct btrfs_trans_handle; 16 + struct btrfs_root; 17 + struct btrfs_ordered_sum; 18 + struct btrfs_path; 19 + struct btrfs_inode; 9 20 10 21 #define BTRFS_FILE_EXTENT_INLINE_DATA_START \ 11 22 (offsetof(struct btrfs_file_extent_item, disk_bytenr))
+13
fs/btrfs/free-space-cache.h
··· 6 6 #ifndef BTRFS_FREE_SPACE_CACHE_H 7 7 #define BTRFS_FREE_SPACE_CACHE_H 8 8 9 + #include <linux/rbtree.h> 10 + #include <linux/list.h> 11 + #include <linux/spinlock.h> 12 + #include <linux/mutex.h> 13 + #include "fs.h" 14 + 15 + struct inode; 16 + struct page; 17 + struct btrfs_fs_info; 18 + struct btrfs_path; 19 + struct btrfs_trans_handle; 20 + struct btrfs_trim_block_group; 21 + 9 22 /* 10 23 * This is the trim state of an extent or bitmap. 11 24 *
+6
fs/btrfs/free-space-tree.h
··· 6 6 #ifndef BTRFS_FREE_SPACE_TREE_H 7 7 #define BTRFS_FREE_SPACE_TREE_H 8 8 9 + #include <linux/bits.h> 10 + 9 11 struct btrfs_caching_control; 12 + struct btrfs_fs_info; 13 + struct btrfs_path; 14 + struct btrfs_block_group; 15 + struct btrfs_trans_handle; 10 16 11 17 /* 12 18 * The default size for new free space bitmap items. The last bitmap in a block
+3 -2
fs/btrfs/inode-item.h
··· 6 6 #include <linux/types.h> 7 7 #include <linux/crc32c.h> 8 8 9 + struct fscrypt_str; 10 + struct extent_buffer; 9 11 struct btrfs_trans_handle; 10 12 struct btrfs_root; 11 13 struct btrfs_path; 12 14 struct btrfs_key; 13 15 struct btrfs_inode_extref; 14 16 struct btrfs_inode; 15 - struct extent_buffer; 16 - struct fscrypt_str; 17 + struct btrfs_truncate_control; 17 18 18 19 /* 19 20 * Return this if we need to call truncate_block for the last bit of the
+6 -2
fs/btrfs/locking.h
··· 8 8 9 9 #include <linux/atomic.h> 10 10 #include <linux/wait.h> 11 + #include <linux/lockdep.h> 11 12 #include <linux/percpu_counter.h> 12 13 #include "extent_io.h" 14 + #include "locking.h" 15 + 16 + struct extent_buffer; 17 + struct btrfs_path; 18 + struct btrfs_root; 13 19 14 20 #define BTRFS_WRITE_LOCK 1 15 21 #define BTRFS_READ_LOCK 2 ··· 162 156 163 157 static_assert(BTRFS_NESTING_MAX <= MAX_LOCKDEP_SUBCLASSES, 164 158 "too many lock subclasses defined"); 165 - 166 - struct btrfs_path; 167 159 168 160 void __btrfs_tree_lock(struct extent_buffer *eb, enum btrfs_lock_nesting nest); 169 161 void btrfs_tree_lock(struct extent_buffer *eb);
+2
fs/btrfs/lru_cache.h
··· 3 3 #ifndef BTRFS_LRU_CACHE_H 4 4 #define BTRFS_LRU_CACHE_H 5 5 6 + #include <linux/types.h> 6 7 #include <linux/maple_tree.h> 7 8 #include <linux/list.h> 9 + #include "lru_cache.h" 8 10 9 11 /* 10 12 * A cache entry. This is meant to be embedded in a structure of a user of
+2
fs/btrfs/misc.h
··· 3 3 #ifndef BTRFS_MISC_H 4 4 #define BTRFS_MISC_H 5 5 6 + #include <linux/types.h> 7 + #include <linux/bitmap.h> 6 8 #include <linux/sched.h> 7 9 #include <linux/wait.h> 8 10 #include <linux/math64.h>
+13
fs/btrfs/ordered-data.h
··· 6 6 #ifndef BTRFS_ORDERED_DATA_H 7 7 #define BTRFS_ORDERED_DATA_H 8 8 9 + #include <linux/types.h> 10 + #include <linux/list.h> 11 + #include <linux/refcount.h> 12 + #include <linux/completion.h> 13 + #include <linux/rbtree.h> 14 + #include <linux/wait.h> 9 15 #include "async-thread.h" 16 + 17 + struct inode; 18 + struct page; 19 + struct extent_state; 20 + struct btrfs_inode; 21 + struct btrfs_root; 22 + struct btrfs_fs_info; 10 23 11 24 struct btrfs_ordered_sum { 12 25 /*
+9
fs/btrfs/raid56.h
··· 7 7 #ifndef BTRFS_RAID56_H 8 8 #define BTRFS_RAID56_H 9 9 10 + #include <linux/types.h> 11 + #include <linux/list.h> 12 + #include <linux/spinlock.h> 13 + #include <linux/bio.h> 14 + #include <linux/refcount.h> 10 15 #include <linux/workqueue.h> 11 16 #include "volumes.h" 17 + 18 + struct page; 19 + struct sector_ptr; 20 + struct btrfs_fs_info; 12 21 13 22 enum btrfs_rbio_ops { 14 23 BTRFS_RBIO_WRITE,
+5 -3
fs/btrfs/send.h
··· 8 8 #define BTRFS_SEND_H 9 9 10 10 #include <linux/types.h> 11 + #include <linux/sizes.h> 12 + #include <linux/align.h> 13 + 14 + struct inode; 15 + struct btrfs_ioctl_send_args; 11 16 12 17 #define BTRFS_SEND_STREAM_MAGIC "btrfs-stream" 13 18 /* Conditional support for the upcoming protocol version. */ ··· 29 24 */ 30 25 #define BTRFS_SEND_BUF_SIZE_V1 SZ_64K 31 26 #define BTRFS_SEND_BUF_SIZE_V2 ALIGN(SZ_16K + BTRFS_MAX_COMPRESSED, PAGE_SIZE) 32 - 33 - struct inode; 34 - struct btrfs_ioctl_send_args; 35 27 36 28 enum btrfs_tlv_type { 37 29 BTRFS_TLV_U8,
+9
fs/btrfs/space-info.h
··· 4 4 #define BTRFS_SPACE_INFO_H 5 5 6 6 #include <trace/events/btrfs.h> 7 + #include <linux/spinlock.h> 8 + #include <linux/list.h> 9 + #include <linux/kobject.h> 10 + #include <linux/lockdep.h> 11 + #include <linux/wait.h> 12 + #include <linux/rwsem.h> 7 13 #include "volumes.h" 14 + 15 + struct btrfs_fs_info; 16 + struct btrfs_block_group; 8 17 9 18 /* 10 19 * Different levels for to flush space when doing space reservations.
+5
fs/btrfs/subpage.h
··· 4 4 #define BTRFS_SUBPAGE_H 5 5 6 6 #include <linux/spinlock.h> 7 + #include <linux/atomic.h> 8 + 9 + struct address_space; 10 + struct folio; 11 + struct btrfs_fs_info; 7 12 8 13 /* 9 14 * Extra info for subpapge bitmap.
+16 -1
fs/btrfs/transaction.h
··· 6 6 #ifndef BTRFS_TRANSACTION_H 7 7 #define BTRFS_TRANSACTION_H 8 8 9 + #include <linux/atomic.h> 9 10 #include <linux/refcount.h> 11 + #include <linux/list.h> 12 + #include <linux/time64.h> 13 + #include <linux/mutex.h> 14 + #include <linux/wait.h> 10 15 #include "btrfs_inode.h" 11 16 #include "delayed-ref.h" 12 - #include "ctree.h" 17 + #include "extent-io-tree.h" 18 + #include "block-rsv.h" 19 + #include "messages.h" 13 20 #include "misc.h" 21 + 22 + struct dentry; 23 + struct inode; 24 + struct btrfs_pending_snapshot; 25 + struct btrfs_fs_info; 26 + struct btrfs_root_item; 27 + struct btrfs_root; 28 + struct btrfs_path; 14 29 15 30 /* Radix-tree tag for roots that are part of the trasaction. */ 16 31 #define BTRFS_ROOT_TRANS_TAG 0
+2
fs/btrfs/tree-checker.h
··· 6 6 #ifndef BTRFS_TREE_CHECKER_H 7 7 #define BTRFS_TREE_CHECKER_H 8 8 9 + #include <linux/types.h> 9 10 #include <uapi/linux/btrfs_tree.h> 10 11 11 12 struct extent_buffer; 12 13 struct btrfs_chunk; 14 + struct btrfs_key; 13 15 14 16 /* All the extra info needed to verify the parentness of a tree block. */ 15 17 struct btrfs_tree_parent_check {
+8
fs/btrfs/tree-log.h
··· 6 6 #ifndef BTRFS_TREE_LOG_H 7 7 #define BTRFS_TREE_LOG_H 8 8 9 + #include <linux/list.h> 10 + #include <linux/fs.h> 9 11 #include "messages.h" 10 12 #include "ctree.h" 11 13 #include "transaction.h" 14 + 15 + struct inode; 16 + struct dentry; 17 + struct btrfs_ordered_extent; 18 + struct btrfs_root; 19 + struct btrfs_trans_handle; 12 20 13 21 /* return value for btrfs_log_dentry_safe that means we don't need to log it at all */ 14 22 #define BTRFS_NO_LOG_SYNC 256
+1
fs/btrfs/ulist.h
··· 7 7 #ifndef BTRFS_ULIST_H 8 8 #define BTRFS_ULIST_H 9 9 10 + #include <linux/types.h> 10 11 #include <linux/list.h> 11 12 #include <linux/rbtree.h> 12 13
+15
fs/btrfs/zoned.h
··· 4 4 #define BTRFS_ZONED_H 5 5 6 6 #include <linux/types.h> 7 + #include <linux/atomic.h> 7 8 #include <linux/blkdev.h> 9 + #include <linux/blkzoned.h> 10 + #include <linux/errno.h> 11 + #include <linux/spinlock.h> 12 + #include <linux/mutex.h> 8 13 #include "messages.h" 9 14 #include "volumes.h" 10 15 #include "disk-io.h" 11 16 #include "block-group.h" 12 17 #include "btrfs_inode.h" 18 + #include "fs.h" 19 + 20 + struct block_device; 21 + struct extent_buffer; 22 + struct btrfs_bio; 23 + struct btrfs_ordered_extent; 24 + struct btrfs_fs_info; 25 + struct btrfs_space_info; 26 + struct btrfs_eb_write_context; 27 + struct btrfs_fs_devices; 13 28 14 29 #define BTRFS_DEFAULT_RECLAIM_THRESH (75) 15 30