Include updates and cleanups
David Sterba
maintainercover Include updates and cleanups
Another step to do the header files properly so we can possibly remove dependencies, not pull headers unless needed.
The changes are grouped to be roughly the same size, I went through the files from smallest to largest and did a full build test at some point.
David Sterba (3):
btrfs: add forward declarations and headers, part 1
btrfs: add forward declarations and headers, part 2
btrfs: add forward declarations and headers, part 3
fs/btrfs/accessors.h | 11 +++++++++- fs/btrfs/acl.h | 11 ++++++++++ fs/btrfs/async-thread.h | 3 +++ fs/btrfs/backref.h | 16 ++++++++++++-- fs/btrfs/bio.h | 2 ++ fs/btrfs/block-group.h | 13 ++++++++++++ fs/btrfs/block-rsv.h | 7 +++++++ fs/btrfs/btrfs_inode.h | 19 +++++++++++++++++ fs/btrfs/compression.h | 10 +++++++-- fs/btrfs/ctree.h | 25 +++++++++++----------- fs/btrfs/defrag.h | 10 +++++++++ fs/btrfs/delalloc-space.h | 4 ++++ fs/btrfs/delayed-inode.h | 8 +++++++ fs/btrfs/delayed-ref.h | 10 +++++++++ fs/btrfs/dev-replace.h | 4 ++++ fs/btrfs/dir-item.h | 6 ++++++ fs/btrfs/disk-io.h | 20 ++++++++++++++---- fs/btrfs/export.h | 4 ++++ fs/btrfs/extent-io-tree.h | 7 +++++++ fs/btrfs/extent-tree.h | 10 +++++++++ fs/btrfs/extent_io.h | 25 +++++++++++++++++----- fs/btrfs/extent_map.h | 8 +++++++ fs/btrfs/file-item.h | 11 ++++++++++ fs/btrfs/file.h | 15 +++++++++++++ fs/btrfs/free-space-cache.h | 13 ++++++++++++ fs/btrfs/free-space-tree.h | 6 ++++++ fs/btrfs/fs.h | 42 +++++++++++++++++++++++++++++++++++-- fs/btrfs/inode-item.h | 5 +++-- fs/btrfs/ioctl.h | 9 ++++++++ fs/btrfs/locking.h | 8 +++++-- fs/btrfs/lru_cache.h | 2 ++ fs/btrfs/misc.h | 2 ++ fs/btrfs/ordered-data.h | 15 +++++++++++++ fs/btrfs/orphan.h | 5 +++++ fs/btrfs/print-tree.h | 3 +++ fs/btrfs/props.c | 1 + fs/btrfs/props.h | 7 ++++++- fs/btrfs/qgroup.h | 17 +++++++++++---- fs/btrfs/raid-stripe-tree.h | 5 +++++ fs/btrfs/raid56.h | 9 ++++++++ fs/btrfs/rcu-string.h | 6 ++++++ fs/btrfs/ref-verify.h | 9 ++++++++ fs/btrfs/reflink.h | 4 +++- fs/btrfs/relocation.h | 9 ++++++++ fs/btrfs/root-tree.h | 10 +++++++++ fs/btrfs/scrub.h | 6 ++++++ fs/btrfs/send.h | 8 ++++--- fs/btrfs/space-info.h | 9 ++++++++ fs/btrfs/subpage.h | 5 +++++ fs/btrfs/super.h | 7 +++++++ fs/btrfs/sysfs.h | 9 ++++++++ fs/btrfs/transaction.h | 17 ++++++++++++++- fs/btrfs/tree-checker.h | 2 ++ fs/btrfs/tree-log.h | 8 +++++++ fs/btrfs/tree-mod-log.h | 8 ++++++- fs/btrfs/ulist.h | 1 + fs/btrfs/uuid-tree.h | 5 +++++ fs/btrfs/verity.h | 7 +++++++ fs/btrfs/volumes.h | 25 ++++++++++++++++------ fs/btrfs/xattr.h | 6 +++++- fs/btrfs/zoned.h | 15 +++++++++++++ 61 files changed, 533 insertions(+), 51 deletions(-)
Signature · 1 line
2.42.1
David Sterba
maintainerPATCH 1/3 btrfs: add forward declarations and headers, part 1
Do a cleanup in the short 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.
--- fs/btrfs/acl.h | 11 +++++++++++ fs/btrfs/async-thread.h | 3 +++ fs/btrfs/defrag.h | 10 ++++++++++ fs/btrfs/delalloc-space.h | 4 ++++ fs/btrfs/dev-replace.h | 4 ++++ fs/btrfs/dir-item.h | 6 ++++++ fs/btrfs/disk-io.h | 4 ++++ fs/btrfs/export.h | 4 ++++ fs/btrfs/extent_map.h | 1 + fs/btrfs/file.h | 15 +++++++++++++++ fs/btrfs/ioctl.h | 9 +++++++++ fs/btrfs/ordered-data.h | 2 ++ fs/btrfs/orphan.h | 5 +++++ fs/btrfs/print-tree.h | 3 +++ fs/btrfs/props.c | 1 + fs/btrfs/props.h | 7 ++++++- fs/btrfs/raid-stripe-tree.h | 5 +++++ fs/btrfs/rcu-string.h | 6 ++++++ fs/btrfs/ref-verify.h | 9 +++++++++ fs/btrfs/reflink.h | 4 +++- fs/btrfs/relocation.h | 9 +++++++++ fs/btrfs/root-tree.h | 10 ++++++++++ fs/btrfs/scrub.h | 6 ++++++ fs/btrfs/super.h | 7 +++++++ fs/btrfs/sysfs.h | 9 +++++++++ fs/btrfs/tree-mod-log.h | 8 +++++++- fs/btrfs/uuid-tree.h | 5 +++++ fs/btrfs/verity.h | 7 +++++++ fs/btrfs/xattr.h | 6 +++++- 29 files changed, 176 insertions(+), 4 deletions(-)
fs/btrfs/acl.h +11 -0
@@ -3,8 +3,15 @@#ifndef BTRFS_ACL_H #define BTRFS_ACL_H +struct posix_acl ; +struct inode ; +struct btrfs_trans_handle ; +#ifdef CONFIG_BTRFS_FS_POSIX_ACL +struct mnt_idmap ; +struct dentry ; +struct posix_acl *btrfs_get_acl (struct inode *inode,int type,bool rcu);int btrfs_set_acl (struct mnt_idmap *idmap,struct dentry *dentry,struct posix_acl *acl,int type);
@@ -13,6 +20,10 @@ int __btrfs_set_acl(struct btrfs_trans_handle *trans, struct inode *inode,#else +#include <linux/errno.h> + +struct btrfs_trans_handle ; +#define btrfs_get_acl NULL#define btrfs_set_acl NULL static inline int __btrfs_set_acl(struct btrfs_trans_handle *trans,
fs/btrfs/async-thread.h +3 -0
@@ -7,11 +7,14 @@#ifndef BTRFS_ASYNC_THREAD_H #define BTRFS_ASYNC_THREAD_H +#include <linux/compiler_types.h> #include <linux/workqueue.h> +#include <linux/list.h> struct btrfs_fs_info ;struct btrfs_workqueue ;struct btrfs_work ; +typedef void (*btrfs_func_t )(struct btrfs_work *arg);typedef void (*btrfs_ordered_func_t )(struct btrfs_work *arg,bool );
fs/btrfs/defrag.h +10 -0
@@ -3,6 +3,16 @@#ifndef BTRFS_DEFRAG_H #define BTRFS_DEFRAG_H +#include <linux/types.h> +#include <linux/compiler_types.h> + +struct inode ; +struct file_ra_state ; +struct btrfs_fs_info ; +struct btrfs_root ; +struct btrfs_trans_handle ; +struct btrfs_ioctl_defrag_range_args ; +int btrfs_defrag_file (struct inode *inode,struct file_ra_state *ra,struct btrfs_ioctl_defrag_range_args *range,u64 newer_than,unsigned long max_to_defrag);
fs/btrfs/delalloc-space.h +4 -0
@@ -3,7 +3,11 @@#ifndef BTRFS_DELALLOC_SPACE_H #define BTRFS_DELALLOC_SPACE_H +#include <linux/types.h> +struct extent_changeset ; +struct btrfs_inode ; +struct btrfs_fs_info ;int btrfs_alloc_data_chunk_ondemand (struct btrfs_inode *inode,u64 bytes); int btrfs_check_data_free_space(struct btrfs_inode *inode,
fs/btrfs/dev-replace.h +4 -0
@@ -6,11 +6,15 @@#ifndef BTRFS_DEV_REPLACE_H #define BTRFS_DEV_REPLACE_H +#include <linux/types.h> +#include <linux/compiler_types.h> +struct btrfs_ioctl_dev_replace_args ;struct btrfs_fs_info ;struct btrfs_trans_handle ;struct btrfs_dev_replace ;struct btrfs_block_group ; +struct btrfs_device ;int btrfs_init_dev_replace (struct btrfs_fs_info *fs_info);int btrfs_run_dev_replace (struct btrfs_trans_handle *trans);
fs/btrfs/dir-item.h +6 -0
@@ -3,9 +3,15 @@#ifndef BTRFS_DIR_ITEM_H #define BTRFS_DIR_ITEM_H +#include <linux/types.h> #include <linux/crc32c.h> struct fscrypt_str ; +struct btrfs_fs_info ; +struct btrfs_key ; +struct btrfs_path ; +struct btrfs_root ; +struct btrfs_trans_handle ;int btrfs_check_dir_item_collision (struct btrfs_root *root,u64 dir,const struct fscrypt_str *name);
fs/btrfs/disk-io.h +4 -0
@@ -6,6 +6,10 @@#ifndef BTRFS_DISK_IO_H #define BTRFS_DISK_IO_H +#include <linux/sizes.h> +#include "ctree.h" +#include "fs.h" +#define BTRFS_SUPER_MIRROR_MAX 3#define BTRFS_SUPER_MIRROR_SHIFT 12
fs/btrfs/export.h +4 -0
@@ -4,6 +4,10 @@#define BTRFS_EXPORT_H #include <linux/exportfs.h> +#include <linux/types.h> + +struct dentry ; +struct super_block ;extern const struct export_operations btrfs_export_ops;
fs/btrfs/extent_map.h +1 -0
@@ -5,6 +5,7 @@#include <linux/rbtree.h> #include <linux/refcount.h> +#include "misc.h" #include "compression.h" #define EXTENT_MAP_LAST_BYTE ((u64)-4)
fs/btrfs/file.h +15 -0
@@ -3,6 +3,21 @@#ifndef BTRFS_FILE_H #define BTRFS_FILE_H +#include <linux/types.h> + +struct file ; +struct extent_state ; +struct kiocb ; +struct iov_iter ; +struct page ; +struct btrfs_ioctl_encoded_io_args ; +struct btrfs_drop_extents_args ; +struct btrfs_inode ; +struct btrfs_root ; +struct btrfs_path ; +struct btrfs_replace_extent_info ; +struct btrfs_trans_handle ; +extern const struct file_operations btrfs_file_operations;int btrfs_sync_file (struct file *file,loff_t start,loff_t end,int datasync);
fs/btrfs/ioctl.h +9 -0
@@ -3,6 +3,15 @@#ifndef BTRFS_IOCTL_H #define BTRFS_IOCTL_H +#include <linux/types.h> + +struct file ; +struct dentry ; +struct mnt_idmap ; +struct fileattr ; +struct btrfs_fs_info ; +struct btrfs_ioctl_balance_args ; +long btrfs_ioctl (struct file *file,unsigned int cmd,unsigned long arg);long btrfs_compat_ioctl (struct file *file,unsigned int cmd,unsigned long arg);int btrfs_fileattr_get (struct dentry *dentry,struct fileattr *fa);
fs/btrfs/ordered-data.h +2 -0
@@ -6,6 +6,8 @@#ifndef BTRFS_ORDERED_DATA_H #define BTRFS_ORDERED_DATA_H +#include "async-thread.h" + struct btrfs_ordered_sum {/* * Logical start address and length for of the blocks covered by
fs/btrfs/orphan.h +5 -0
@@ -3,6 +3,11 @@#ifndef BTRFS_ORPHAN_H #define BTRFS_ORPHAN_H +#include <linux/types.h> + +struct btrfs_trans_handle ; +struct btrfs_root ; +int btrfs_insert_orphan_item (struct btrfs_trans_handle *trans,struct btrfs_root *root,u64 offset); int btrfs_del_orphan_item(struct btrfs_trans_handle *trans,
fs/btrfs/print-tree.h +3 -0
@@ -9,6 +9,9 @@/* Buffer size to contain tree name and possibly additional data (offset) */ #define BTRFS_ROOT_NAME_BUF_LEN 48 +struct extent_buffer ; +struct btrfs_key ; +void btrfs_print_leaf (const struct extent_buffer *l);void btrfs_print_tree (const struct extent_buffer *c,bool follow);const char *btrfs_root_name (const struct btrfs_key *key,char *buf);
fs/btrfs/props.c +1 -0
@@ -4,6 +4,7 @@*/ #include <linux/hashtable.h> +#include <linux/xattr.h> #include "messages.h" #include "props.h" #include "btrfs_inode.h"
fs/btrfs/props.h +6 -1
@@ -6,7 +6,12 @@#ifndef BTRFS_PROPS_H #define BTRFS_PROPS_H -#include "ctree.h" +#include <linux/compiler_types.h> + +struct inode ; +struct btrfs_inode ; +struct btrfs_path ; +struct btrfs_trans_handle ;int __init btrfs_props_init (void );
fs/btrfs/raid-stripe-tree.h +5 -0
@@ -6,6 +6,10 @@#ifndef BTRFS_RAID_STRIPE_TREE_H #define BTRFS_RAID_STRIPE_TREE_H +#include <linux/types.h> +#include <uapi/linux/btrfs_tree.h> +#include "fs.h" +#define BTRFS_RST_SUPP_BLOCK_GROUP_MASK (BTRFS_BLOCK_GROUP_DUP | \ BTRFS_BLOCK_GROUP_RAID1_MASK | \ BTRFS_BLOCK_GROUP_RAID0 | \
@@ -13,6 +17,7 @@struct btrfs_io_context ;struct btrfs_io_stripe ; +struct btrfs_fs_info ;struct btrfs_ordered_extent ;struct btrfs_trans_handle ;
fs/btrfs/rcu-string.h +6 -0
@@ -6,6 +6,12 @@ #ifndef BTRFS_RCU_STRING_H #define BTRFS_RCU_STRING_H +#include <linux/types.h> +#include <linux/string.h> +#include <linux/slab.h> +#include <linux/rcupdate.h> +#include <linux/printk.h> + struct rcu_string { struct rcu_head rcu; char str[];
fs/btrfs/ref-verify.h +9 -0
@@ -6,7 +6,16 @@#ifndef BTRFS_REF_VERIFY_H #define BTRFS_REF_VERIFY_H +#include <linux/types.h> +#include <linux/rbtree_types.h> + +struct btrfs_fs_info ; +struct btrfs_ref ; +#ifdef CONFIG_BTRFS_FS_REF_VERIFY + +#include <linux/spinlock.h> +int btrfs_build_ref_tree (struct btrfs_fs_info *fs_info);void btrfs_free_ref_cache (struct btrfs_fs_info *fs_info); int btrfs_ref_tree_mod(struct btrfs_fs_info *fs_info,
fs/btrfs/reflink.h +3 -1
@@ -3,7 +3,9 @@#ifndef BTRFS_REFLINK_H #define BTRFS_REFLINK_H -#include <linux/fs.h> +#include <linux/types.h> + +struct file ; loff_t btrfs_remap_file_range(struct file *file_in, loff_t pos_in, struct file *file_out, loff_t pos_out,
fs/btrfs/relocation.h +9 -0
@@ -3,6 +3,15 @@#ifndef BTRFS_RELOCATION_H #define BTRFS_RELOCATION_H +#include <linux/types.h> + +struct extent_buffer ; +struct btrfs_fs_info ; +struct btrfs_root ; +struct btrfs_trans_handle ; +struct btrfs_ordered_extent ; +struct btrfs_pending_snapshot ; +int btrfs_relocate_block_group (struct btrfs_fs_info *fs_info,u64 group_start);int btrfs_init_reloc_root (struct btrfs_trans_handle *trans,struct btrfs_root *root); int btrfs_update_reloc_root(struct btrfs_trans_handle *trans,
fs/btrfs/root-tree.h +10 -0
@@ -3,7 +3,17 @@#ifndef BTRFS_ROOT_TREE_H #define BTRFS_ROOT_TREE_H +#include <linux/types.h> +struct fscrypt_str ; +struct extent_buffer ; +struct btrfs_key ; +struct btrfs_root ; +struct btrfs_root_item ; +struct btrfs_path ; +struct btrfs_fs_info ; +struct btrfs_block_rsv ; +struct btrfs_trans_handle ; int btrfs_subvolume_reserve_metadata(struct btrfs_root *root, struct btrfs_block_rsv *rsv,
fs/btrfs/scrub.h +6 -0
@@ -3,6 +3,12 @@#ifndef BTRFS_SCRUB_H #define BTRFS_SCRUB_H +#include <linux/types.h> + +struct btrfs_fs_info ; +struct btrfs_device ; +struct btrfs_scrub_progress ; +int btrfs_scrub_dev (struct btrfs_fs_info *fs_info,u64 devid,u64 start,u64 end,struct btrfs_scrub_progress *progress,int readonly,int is_dev_replace);
fs/btrfs/super.h +7 -0
@@ -3,6 +3,13 @@#ifndef BTRFS_SUPER_H #define BTRFS_SUPER_H +#include <linux/types.h> +#include <linux/fs.h> +#include "fs.h" + +struct super_block ; +struct btrfs_fs_info ; +bool btrfs_check_options (struct btrfs_fs_info *info,unsigned long *mount_opt,unsigned long flags);int btrfs_sync_fs (struct super_block *sb,int wait);
fs/btrfs/sysfs.h +9 -0
@@ -3,8 +3,17 @@#ifndef BTRFS_SYSFS_H #define BTRFS_SYSFS_H +#include <linux/types.h> +#include <linux/compiler_types.h> #include <linux/kobject.h> +struct btrfs_fs_info ; +struct btrfs_device ; +struct btrfs_fs_devices ; +struct btrfs_block_group ; +struct btrfs_space_info ; +struct btrfs_qgroup ; +enum btrfs_feature_set {FEAT_COMPAT , FEAT_COMPAT_RO,
fs/btrfs/tree-mod-log.h +7 -1
@@ -3,7 +3,13 @@#ifndef BTRFS_TREE_MOD_LOG_H #define BTRFS_TREE_MOD_LOG_H -#include "ctree.h" +#include <linux/list.h> + +struct extent_buffer ; +struct btrfs_fs_info ; +struct btrfs_path ; +struct btrfs_root ; +struct btrfs_seq_list ;/* Represents a tree mod log user. */ struct btrfs_seq_list {
fs/btrfs/uuid-tree.h +5 -0
@@ -3,6 +3,11 @@#ifndef BTRFS_UUID_TREE_H #define BTRFS_UUID_TREE_H +#include <linux/types.h> + +struct btrfs_trans_handle ; +struct btrfs_fs_info ; +int btrfs_uuid_tree_add (struct btrfs_trans_handle *trans,u8 *uuid,u8 type,u64 subid); int btrfs_uuid_tree_remove(struct btrfs_trans_handle *trans, u8 *uuid, u8 type,
fs/btrfs/verity.h +7 -0
@@ -3,8 +3,13 @@#ifndef BTRFS_VERITY_H #define BTRFS_VERITY_H +struct inode ; +struct btrfs_inode ; +#ifdef CONFIG_FS_VERITY +#include <linux/fsverity.h> +extern const struct fsverity_operations btrfs_verityops;int btrfs_drop_verity_items (struct btrfs_inode *inode);
@@ -12,6 +17,8 @@ int btrfs_get_verity_descriptor(struct inode *inode, void *buf, size_t buf_size)#else +#include <linux/errno.h> +static inline int btrfs_drop_verity_items (struct btrfs_inode *inode) {return 0 ;
fs/btrfs/xattr.h +5 -1
@@ -6,7 +6,11 @@#ifndef BTRFS_XATTR_H #define BTRFS_XATTR_H -#include <linux/xattr.h> +struct dentry ; +struct inode ; +struct qstr ; +struct xattr_handler ; +struct btrfs_trans_handle ;extern const struct xattr_handler *const btrfs_xattr_handlers[];
Signature · 1 line
2.42.1
David Sterba
maintainerPATCH 2/3 btrfs: add forward declarations and headers, part 2
In reply to David SterbaDo 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.
--- fs/btrfs/bio.h | 2 ++ fs/btrfs/block-rsv.h | 7 +++++++ fs/btrfs/compression.h | 10 ++++++++-- fs/btrfs/delayed-inode.h | 8 ++++++++ fs/btrfs/disk-io.h | 16 ++++++++++++---- fs/btrfs/extent-io-tree.h | 7 +++++++ fs/btrfs/extent-tree.h | 9 +++++++++ fs/btrfs/extent_io.h | 25 ++++++++++++++++++++----- fs/btrfs/extent_map.h | 7 +++++++ fs/btrfs/file-item.h | 11 +++++++++++ fs/btrfs/free-space-cache.h | 13 +++++++++++++ fs/btrfs/free-space-tree.h | 6 ++++++ fs/btrfs/inode-item.h | 5 +++-- fs/btrfs/locking.h | 8 ++++++-- fs/btrfs/lru_cache.h | 2 ++ fs/btrfs/misc.h | 2 ++ fs/btrfs/ordered-data.h | 13 +++++++++++++ fs/btrfs/raid56.h | 9 +++++++++ fs/btrfs/send.h | 8 +++++--- fs/btrfs/space-info.h | 9 +++++++++ fs/btrfs/subpage.h | 5 +++++ fs/btrfs/transaction.h | 17 ++++++++++++++++- fs/btrfs/tree-checker.h | 2 ++ fs/btrfs/tree-log.h | 8 ++++++++ fs/btrfs/ulist.h | 1 + fs/btrfs/zoned.h | 15 +++++++++++++++ 26 files changed, 206 insertions(+), 19 deletions(-)
fs/btrfs/bio.h +2 -0
@@ -7,12 +7,14 @@#ifndef BTRFS_BIO_H #define BTRFS_BIO_H +#include <linux/types.h> #include <linux/bio.h> #include <linux/workqueue.h> #include "tree-checker.h" struct btrfs_bio ;struct btrfs_fs_info ; +struct btrfs_inode ;#define BTRFS_BIO_INLINE_CSUM_SIZE 64
fs/btrfs/block-rsv.h +7 -0
@@ -3,8 +3,15 @@#ifndef BTRFS_BLOCK_RSV_H #define BTRFS_BLOCK_RSV_H +#include <linux/types.h> +#include <linux/compiler.h> +#include <linux/spinlock.h> +struct btrfs_trans_handle ;struct btrfs_root ; +struct btrfs_space_info ; +struct btrfs_block_rsv ; +struct btrfs_fs_info ;enum btrfs_reserve_flush_enum ;/*
fs/btrfs/compression.h +8 -2
@@ -7,10 +7,18 @@#define BTRFS_COMPRESSION_H #include <linux/sizes.h> +#include <linux/mm.h> +#include <linux/list.h> +#include <linux/workqueue.h> +#include <linux/wait.h> #include "bio.h" +struct address_space ; +struct page ; +struct inode ;struct btrfs_inode ;struct btrfs_ordered_extent ; +struct btrfs_bio ;/* * We want to make sure that amount of RAM required to uncompress an extent is
@@ -32,8 +40,6 @@ static_assert((BTRFS_MAX_COMPRESSED % PAGE_SIZE) == 0);#define BTRFS_ZLIB_DEFAULT_LEVEL 3 -struct page ; -struct compressed_bio {/* Number of compressed folios in the array */ unsigned int nr_folios;
fs/btrfs/delayed-inode.h +8 -0
@@ -7,15 +7,23 @@#ifndef BTRFS_DELAYED_INODE_H #define BTRFS_DELAYED_INODE_H +#include <linux/types.h> #include <linux/rbtree.h> #include <linux/spinlock.h> #include <linux/mutex.h> #include <linux/list.h> #include <linux/wait.h> +#include <linux/fs.h> #include <linux/atomic.h> #include <linux/refcount.h> #include "ctree.h" +struct btrfs_disk_key ; +struct btrfs_fs_info ; +struct btrfs_inode ; +struct btrfs_root ; +struct btrfs_trans_handle ; +enum btrfs_delayed_item_type {BTRFS_DELAYED_INSERTION_ITEM , BTRFS_DELAYED_DELETION_ITEM
fs/btrfs/disk-io.h +12 -4
@@ -7,9 +7,21 @@#define BTRFS_DISK_IO_H #include <linux/sizes.h> +#include <linux/compiler_types.h> #include "ctree.h" #include "fs.h" +struct block_device ; +struct super_block ; +struct extent_buffer ; +struct btrfs_device ; +struct btrfs_fs_devices ; +struct btrfs_fs_info ; +struct btrfs_super_block ; +struct btrfs_trans_handle ; +struct btrfs_tree_parent_check ; +struct btrfs_transaction ; +#define BTRFS_SUPER_MIRROR_MAX 3#define BTRFS_SUPER_MIRROR_SHIFT 12
@@ -29,10 +41,6 @@ static inline u64 btrfs_sb_offset(int mirror)return BTRFS_SUPER_INFO_OFFSET ; } -struct btrfs_device ; -struct btrfs_fs_devices ; -struct btrfs_tree_parent_check ; -void btrfs_check_leaked_roots (struct btrfs_fs_info *fs_info);void btrfs_init_fs_info (struct btrfs_fs_info *fs_info); struct extent_buffer *read_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr,
fs/btrfs/extent-io-tree.h +7 -0
@@ -3,9 +3,16 @@#ifndef BTRFS_EXTENT_IO_TREE_H #define BTRFS_EXTENT_IO_TREE_H +#include <linux/rbtree.h> +#include <linux/spinlock.h> +#include <linux/refcount.h> +#include <linux/list.h> +#include <linux/wait.h> #include "misc.h" struct extent_changeset ; +struct btrfs_fs_info ; +struct btrfs_inode ;/* Bits for the extent state */ enum {
fs/btrfs/extent-tree.h +9 -0
@@ -3,11 +3,20 @@#ifndef BTRFS_EXTENT_TREE_H #define BTRFS_EXTENT_TREE_H +#include <linux/types.h> #include "misc.h" #include "block-group.h" +#include "locking.h" +struct extent_buffer ;struct btrfs_free_cluster ; +struct btrfs_fs_info ; +struct btrfs_root ; +struct btrfs_path ; +struct btrfs_disk_key ;struct btrfs_delayed_ref_head ; +struct btrfs_delayed_ref_root ; +struct btrfs_extent_inline_ref ;enum btrfs_extent_allocation_policy { BTRFS_EXTENT_ALLOC_CLUSTERED,
fs/btrfs/extent_io.h +20 -5
@@ -7,12 +7,32 @@#include <linux/refcount.h> #include <linux/fiemap.h> #include <linux/btrfs_tree.h> +#include <linux/spinlock.h> +#include <linux/atomic.h> +#include <linux/rwsem.h> +#include <linux/list.h> +#include <linux/slab.h> #include "compression.h" #include "messages.h" #include "ulist.h" #include "misc.h" +struct page ; +struct file ; +struct folio ; +struct inode ; +struct fiemap_extent_info ; +struct readahead_control ; +struct address_space ; +struct writeback_control ; +struct extent_io_tree ; +struct extent_map_tree ; +struct btrfs_block_group ; +struct btrfs_fs_info ; +struct btrfs_inode ; +struct btrfs_root ;struct btrfs_trans_handle ; +struct btrfs_tree_parent_check ;enum {EXTENT_BUFFER_UPTODATE ,
@@ -64,11 +84,6 @@ enum {#define BITMAP_LAST_BYTE_MASK (nbits) \ (BYTE_MASK >> (-(nbits) & (BITS_PER_BYTE - 1))) -struct btrfs_root ; -struct btrfs_inode ; -struct btrfs_fs_info ; -struct extent_io_tree ; -struct btrfs_tree_parent_check ;int __init extent_buffer_init_cachep (void );void __cold extent_buffer_free_cachep (void );
fs/btrfs/extent_map.h +7 -0
@@ -3,11 +3,18 @@#ifndef BTRFS_EXTENT_MAP_H #define BTRFS_EXTENT_MAP_H +#include <linux/compiler_types.h> +#include <linux/rwlock_types.h> #include <linux/rbtree.h> +#include <linux/list.h> #include <linux/refcount.h> #include "misc.h" +#include "extent_map.h" #include "compression.h" +struct btrfs_inode ; +struct btrfs_fs_info ; +#define EXTENT_MAP_LAST_BYTE ((u64)-4)#define EXTENT_MAP_HOLE ((u64)-3)#define EXTENT_MAP_INLINE ((u64)-2)
fs/btrfs/file-item.h +11 -0
@@ -3,9 +3,20 @@#ifndef BTRFS_FILE_ITEM_H #define BTRFS_FILE_ITEM_H +#include <linux/list.h> +#include <uapi/linux/btrfs_tree.h> #include "accessors.h" struct extent_map ; +struct btrfs_file_extent_item ; +struct btrfs_fs_info ; +struct btrfs_path ; +struct btrfs_bio ; +struct btrfs_trans_handle ; +struct btrfs_root ; +struct btrfs_ordered_sum ; +struct btrfs_path ; +struct btrfs_inode ;#define BTRFS_FILE_EXTENT_INLINE_DATA_START \ (offsetof(struct btrfs_file_extent_item, disk_bytenr))
fs/btrfs/free-space-cache.h +13 -0
@@ -6,6 +6,19 @@#ifndef BTRFS_FREE_SPACE_CACHE_H #define BTRFS_FREE_SPACE_CACHE_H +#include <linux/rbtree.h> +#include <linux/list.h> +#include <linux/spinlock.h> +#include <linux/mutex.h> +#include "fs.h" + +struct inode ; +struct page ; +struct btrfs_fs_info ; +struct btrfs_path ; +struct btrfs_trans_handle ; +struct btrfs_trim_block_group ; +/* * This is the trim state of an extent or bitmap. *
fs/btrfs/free-space-tree.h +6 -0
@@ -6,7 +6,13 @@#ifndef BTRFS_FREE_SPACE_TREE_H #define BTRFS_FREE_SPACE_TREE_H +#include <linux/bits.h> +struct btrfs_caching_control ; +struct btrfs_fs_info ; +struct btrfs_path ; +struct btrfs_block_group ; +struct btrfs_trans_handle ;/* * The default size for new free space bitmap items. The last bitmap in a block
fs/btrfs/inode-item.h +3 -2
@@ -6,14 +6,15 @@#include <linux/types.h> #include <linux/crc32c.h> +struct fscrypt_str ; +struct extent_buffer ;struct btrfs_trans_handle ;struct btrfs_root ;struct btrfs_path ;struct btrfs_key ;struct btrfs_inode_extref ;struct btrfs_inode ; -struct extent_buffer ; -struct fscrypt_str ; +struct btrfs_truncate_control ;/* * Return this if we need to call truncate_block for the last bit of the
fs/btrfs/locking.h +6 -2
@@ -8,8 +8,14 @@#include <linux/atomic.h> #include <linux/wait.h> +#include <linux/lockdep.h> #include <linux/percpu_counter.h> #include "extent_io.h" +#include "locking.h" + +struct extent_buffer ; +struct btrfs_path ; +struct btrfs_root ;#define BTRFS_WRITE_LOCK 1#define BTRFS_READ_LOCK 2
@@ -157,8 +163,6 @@ enum btrfs_lockdep_trans_states {static_assert (BTRFS_NESTING_MAX <=MAX_LOCKDEP_SUBCLASSES ,"too many lock subclasses defined" ); -struct btrfs_path ; -void __btrfs_tree_lock (struct extent_buffer *eb,enum btrfs_lock_nesting nest);void btrfs_tree_lock (struct extent_buffer *eb);void btrfs_tree_unlock (struct extent_buffer *eb);
fs/btrfs/lru_cache.h +2 -0
@@ -3,8 +3,10 @@#ifndef BTRFS_LRU_CACHE_H #define BTRFS_LRU_CACHE_H +#include <linux/types.h> #include <linux/maple_tree.h> #include <linux/list.h> +#include "lru_cache.h" /* * A cache entry. This is meant to be embedded in a structure of a user of
fs/btrfs/misc.h +2 -0
@@ -3,6 +3,8 @@#ifndef BTRFS_MISC_H #define BTRFS_MISC_H +#include <linux/types.h> +#include <linux/bitmap.h> #include <linux/sched.h> #include <linux/wait.h> #include <linux/math64.h>
fs/btrfs/ordered-data.h +13 -0
@@ -6,8 +6,21 @@#ifndef BTRFS_ORDERED_DATA_H #define BTRFS_ORDERED_DATA_H +#include <linux/types.h> +#include <linux/list.h> +#include <linux/refcount.h> +#include <linux/completion.h> +#include <linux/rbtree.h> +#include <linux/wait.h> #include "async-thread.h" +struct inode ; +struct page ; +struct extent_state ; +struct btrfs_inode ; +struct btrfs_root ; +struct btrfs_fs_info ; + struct btrfs_ordered_sum {/* * Logical start address and length for of the blocks covered by
fs/btrfs/raid56.h +9 -0
@@ -7,9 +7,18 @@#ifndef BTRFS_RAID56_H #define BTRFS_RAID56_H +#include <linux/types.h> +#include <linux/list.h> +#include <linux/spinlock.h> +#include <linux/bio.h> +#include <linux/refcount.h> #include <linux/workqueue.h> #include "volumes.h" +struct page ; +struct sector_ptr ; +struct btrfs_fs_info ; +enum btrfs_rbio_ops {BTRFS_RBIO_WRITE , BTRFS_RBIO_READ_REBUILD,
fs/btrfs/send.h +5 -3
@@ -8,6 +8,11 @@#define BTRFS_SEND_H #include <linux/types.h> +#include <linux/sizes.h> +#include <linux/align.h> + +struct inode ; +struct btrfs_ioctl_send_args ;#define BTRFS_SEND_STREAM_MAGIC "btrfs-stream"/* Conditional support for the upcoming protocol version. */
@@ -25,9 +30,6 @@#define BTRFS_SEND_BUF_SIZE_V1 SZ_64K#define BTRFS_SEND_BUF_SIZE_V2 ALIGN(SZ_16K + BTRFS_MAX_COMPRESSED, PAGE_SIZE) -struct inode ; -struct btrfs_ioctl_send_args ; -enum btrfs_tlv_type {BTRFS_TLV_U8 ,BTRFS_TLV_U16 ,
fs/btrfs/space-info.h +9 -0
@@ -4,8 +4,17 @@#define BTRFS_SPACE_INFO_H #include <trace/events/btrfs.h> +#include <linux/spinlock.h> +#include <linux/list.h> +#include <linux/kobject.h> +#include <linux/lockdep.h> +#include <linux/wait.h> +#include <linux/rwsem.h> #include "volumes.h" +struct btrfs_fs_info ; +struct btrfs_block_group ; +/* * Different levels for to flush space when doing space reservations. *
fs/btrfs/subpage.h +5 -0
@@ -4,6 +4,11 @@#define BTRFS_SUBPAGE_H #include <linux/spinlock.h> +#include <linux/atomic.h> + +struct address_space ; +struct folio ; +struct btrfs_fs_info ;/* * Extra info for subpapge bitmap.
fs/btrfs/transaction.h +16 -1
@@ -6,12 +6,27 @@#ifndef BTRFS_TRANSACTION_H #define BTRFS_TRANSACTION_H +#include <linux/atomic.h> #include <linux/refcount.h> +#include <linux/list.h> +#include <linux/time64.h> +#include <linux/mutex.h> +#include <linux/wait.h> #include "btrfs_inode.h" #include "delayed-ref.h" -#include "ctree.h" +#include "extent-io-tree.h" +#include "block-rsv.h" +#include "messages.h" #include "misc.h" +struct dentry ; +struct inode ; +struct btrfs_pending_snapshot ; +struct btrfs_fs_info ; +struct btrfs_root_item ; +struct btrfs_root ; +struct btrfs_path ; +/* Radix-tree tag for roots that are part of the trasaction. */ #define BTRFS_ROOT_TRANS_TAG 0
fs/btrfs/tree-checker.h +2 -0
@@ -6,10 +6,12 @@#ifndef BTRFS_TREE_CHECKER_H #define BTRFS_TREE_CHECKER_H +#include <linux/types.h> #include <uapi/linux/btrfs_tree.h> struct extent_buffer ;struct btrfs_chunk ; +struct btrfs_key ;/* All the extra info needed to verify the parentness of a tree block. */ struct btrfs_tree_parent_check {
fs/btrfs/tree-log.h +8 -0
@@ -6,10 +6,18 @@#ifndef BTRFS_TREE_LOG_H #define BTRFS_TREE_LOG_H +#include <linux/list.h> +#include <linux/fs.h> #include "messages.h" #include "ctree.h" #include "transaction.h" +struct inode ; +struct dentry ; +struct btrfs_ordered_extent ; +struct btrfs_root ; +struct btrfs_trans_handle ; +/* return value for btrfs_log_dentry_safe that means we don't need to log it at all */ #define BTRFS_NO_LOG_SYNC 256
fs/btrfs/ulist.h +1 -0
@@ -7,6 +7,7 @@#ifndef BTRFS_ULIST_H #define BTRFS_ULIST_H +#include <linux/types.h> #include <linux/list.h> #include <linux/rbtree.h>
fs/btrfs/zoned.h +15 -0
@@ -4,12 +4,27 @@#define BTRFS_ZONED_H #include <linux/types.h> +#include <linux/atomic.h> #include <linux/blkdev.h> +#include <linux/blkzoned.h> +#include <linux/errno.h> +#include <linux/spinlock.h> +#include <linux/mutex.h> #include "messages.h" #include "volumes.h" #include "disk-io.h" #include "block-group.h" #include "btrfs_inode.h" +#include "fs.h" + +struct block_device ; +struct extent_buffer ; +struct btrfs_bio ; +struct btrfs_ordered_extent ; +struct btrfs_fs_info ; +struct btrfs_space_info ; +struct btrfs_eb_write_context ; +struct btrfs_fs_devices ;#define BTRFS_DEFAULT_RECLAIM_THRESH (75)
Signature · 1 line
2.42.1
David Sterba
maintainerPATCH 3/3 btrfs: add forward declarations and headers, part 3
In reply to David SterbaDo a cleanup in the rest of the 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.
--- fs/btrfs/accessors.h | 11 ++++++++++- fs/btrfs/backref.h | 16 ++++++++++++++-- fs/btrfs/block-group.h | 13 +++++++++++++ fs/btrfs/btrfs_inode.h | 19 +++++++++++++++++++ fs/btrfs/ctree.h | 25 ++++++++++++------------- fs/btrfs/delayed-ref.h | 10 ++++++++++ fs/btrfs/extent-tree.h | 1 + fs/btrfs/fs.h | 42 ++++++++++++++++++++++++++++++++++++++++-- fs/btrfs/qgroup.h | 17 +++++++++++++---- fs/btrfs/volumes.h | 25 +++++++++++++++++++------ 10 files changed, 151 insertions(+), 28 deletions(-)
fs/btrfs/accessors.h +10 -1
@@ -3,8 +3,17 @@ #ifndef BTRFS_ACCESSORS_H #define BTRFS_ACCESSORS_H -#include <linux/stddef.h> #include <asm/unaligned.h> +#include <linux/stddef.h> +#include <linux/types.h> +#include <linux/align.h> +#include <linux/build_bug.h> +#include <linux/compiler.h> +#include <linux/string.h> +#include <linux/mm.h> +#include <uapi/linux/btrfs_tree.h> + +struct extent_buffer; struct btrfs_map_token { struct extent_buffer *eb;
fs/btrfs/backref.h +14 -2
@@ -6,11 +6,23 @@#ifndef BTRFS_BACKREF_H #define BTRFS_BACKREF_H -#include <linux/btrfs.h> +#include <linux/types.h> +#include <linux/rbtree.h> +#include <linux/list.h> +#include <linux/slab.h> +#include <uapi/linux/btrfs.h> +#include <uapi/linux/btrfs_tree.h> #include "messages.h" -#include "ulist.h" +#include "locking.h" #include "disk-io.h" #include "extent_io.h" +#include "ctree.h" + +struct extent_inode_elem ; +struct ulist ; +struct btrfs_extent_item ; +struct btrfs_trans_handle ; +struct btrfs_fs_info ;/* * Used by implementations of iterate_extent_inodes_t (see definition below) to
fs/btrfs/block-group.h +13 -0
@@ -3,9 +3,22 @@#ifndef BTRFS_BLOCK_GROUP_H #define BTRFS_BLOCK_GROUP_H +#include <linux/atomic.h> +#include <linux/mutex.h> +#include <linux/list.h> +#include <linux/spinlock.h> +#include <linux/refcount.h> +#include <linux/wait.h> +#include <linux/sizes.h> +#include <linux/rwsem.h> +#include <linux/rbtree.h> +#include <uapi/linux/btrfs_tree.h> #include "free-space-cache.h" struct btrfs_chunk_map ; +struct btrfs_fs_info ; +struct btrfs_inode ; +struct btrfs_trans_handle ;enum btrfs_disk_cache_state { BTRFS_DC_WRITTEN,
fs/btrfs/btrfs_inode.h +19 -0
@@ -8,13 +8,32 @@#include <linux/hash.h> #include <linux/refcount.h> +#include <linux/spinlock.h> +#include <linux/mutex.h> +#include <linux/rwsem.h> +#include <linux/fs.h> +#include <linux/mm.h> +#include <linux/compiler.h> #include <linux/fscrypt.h> +#include <linux/lockdep.h> +#include <uapi/linux/btrfs_tree.h> #include <trace/events/btrfs.h> +#include "block-rsv.h" +#include "btrfs_inode.h" #include "extent_map.h" #include "extent_io.h" +#include "extent-io-tree.h" #include "ordered-data.h" #include "delayed-inode.h" +struct extent_state ; +struct posix_acl ; +struct iov_iter ; +struct writeback_control ; +struct btrfs_root ; +struct btrfs_fs_info ; +struct btrfs_trans_handle ; +/* * Since we search a directory based on f_pos (struct dir_context::pos) we have * to start at 2 since '.' and '..' have f_pos of 0 and 1 respectively, so
fs/btrfs/ctree.h +12 -13
@@ -7,25 +7,24 @@#define BTRFS_CTREE_H #include <linux/pagemap.h> +#include <linux/spinlock.h> +#include <linux/rbtree.h> +#include <linux/mutex.h> +#include <linux/wait.h> +#include <linux/list.h> +#include <linux/atomic.h> +#include <linux/xarray.h> +#include <linux/refcount.h> +#include <uapi/linux/btrfs_tree.h> #include "locking.h" #include "fs.h" #include "accessors.h" +#include "extent-io-tree.h" +struct extent_buffer ; +struct btrfs_block_rsv ;struct btrfs_trans_handle ; -struct btrfs_transaction ; -struct btrfs_pending_snapshot ; -struct btrfs_delayed_ref_root ; -struct btrfs_space_info ;struct btrfs_block_group ; -struct btrfs_ordered_sum ; -struct btrfs_ref ; -struct btrfs_bio ; -struct btrfs_ioctl_encoded_io_args ; -struct btrfs_device ; -struct btrfs_fs_devices ; -struct btrfs_balance_control ; -struct btrfs_delayed_root ; -struct reloc_control ;/* Read ahead values for struct btrfs_path.reada */ enum {
fs/btrfs/delayed-ref.h +10 -0
@@ -6,7 +6,17 @@#ifndef BTRFS_DELAYED_REF_H #define BTRFS_DELAYED_REF_H +#include <linux/types.h> #include <linux/refcount.h> +#include <linux/list.h> +#include <linux/rbtree.h> +#include <linux/mutex.h> +#include <linux/spinlock.h> +#include <linux/slab.h> +#include <uapi/linux/btrfs_tree.h> + +struct btrfs_trans_handle ; +struct btrfs_fs_info ;/* these are the possible values of struct btrfs_delayed_ref_node->action */ enum btrfs_delayed_ref_action {
fs/btrfs/extent-tree.h +1 -0
@@ -13,6 +13,7 @@ struct btrfs_free_cluster;struct btrfs_fs_info ;struct btrfs_root ;struct btrfs_path ; +struct btrfs_ref ;struct btrfs_disk_key ;struct btrfs_delayed_ref_head ;struct btrfs_delayed_ref_root ;
fs/btrfs/fs.h +40 -2
52 lines not on this page · raw message
fs/btrfs/qgroup.h +13 -4
@@ -6,12 +6,22 @@#ifndef BTRFS_QGROUP_H #define BTRFS_QGROUP_H +#include <linux/types.h> #include <linux/spinlock.h> #include <linux/rbtree.h> #include <linux/kobject.h> -#include "ulist.h" -#include "delayed-ref.h" -#include "misc.h" +#include <linux/list.h> +#include <uapi/linux/btrfs_tree.h> + +struct extent_buffer ; +struct extent_changeset ; +struct btrfs_delayed_extent_op ; +struct btrfs_fs_info ; +struct btrfs_root ; +struct btrfs_ioctl_quota_ctl_args ; +struct btrfs_trans_handle ; +struct btrfs_delayed_ref_root ; +struct btrfs_inode ;/* * Btrfs qgroup overview
@@ -321,7 +331,6 @@ int btrfs_limit_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid, struct btrfs_qgroup_limit *limit);int btrfs_read_qgroup_config (struct btrfs_fs_info *fs_info);void btrfs_free_qgroup_config (struct btrfs_fs_info *fs_info); -struct btrfs_delayed_extent_op ; int btrfs_qgroup_trace_extent_nolock( struct btrfs_fs_info *fs_info,
fs/btrfs/volumes.h +19 -6
@@ -6,13 +6,28 @@#ifndef BTRFS_VOLUMES_H #define BTRFS_VOLUMES_H +#include <linux/blk_types.h> +#include <linux/sizes.h> +#include <linux/atomic.h> #include <linux/sort.h> -#include <linux/btrfs.h> -#include "async-thread.h" +#include <linux/list.h> +#include <linux/mutex.h> +#include <linux/log2.h> +#include <linux/kobject.h> +#include <linux/refcount.h> +#include <linux/completion.h> +#include <linux/rbtree.h> +#include <uapi/linux/btrfs.h> #include "messages.h" -#include "tree-checker.h" #include "rcu-string.h" +struct block_device ; +struct bdev_handle ; +struct btrfs_fs_info ; +struct btrfs_block_group ; +struct btrfs_trans_handle ; +struct btrfs_zoned_device_info ; +#define BTRFS_MAX_DATA_CHUNK_SIZE (10ULL * SZ_1G)extern struct mutex uuid_mutex;
@@ -77,7 +92,7 @@ enum btrfs_raid_types {#define BTRFS_DEV_STATE_FLUSH_SENT (4)#define BTRFS_DEV_STATE_NO_READA (5) -struct btrfs_zoned_device_info ; +struct btrfs_fs_devices ;struct btrfs_device {struct list_head dev_list;/* device_list_mutex */
@@ -557,8 +572,6 @@ static inline void btrfs_free_chunk_map(struct btrfs_chunk_map *map) } } -struct btrfs_balance_args ; -struct btrfs_balance_progress ;struct btrfs_balance_control {struct btrfs_balance_args data;struct btrfs_balance_args meta;
Signature · 1 line
2.42.1