Skip to contentSkip to conversation

btrfs: ctree.[ch] cleanups

PATCH In review Josef Bacik 3 participants 17 messages Aug 25, 2023 – Sep 5, 2023 Btrfs file system

lore
Share & tools
lore
#0 lore raw

v2 cover btrfs: ctree.[ch] cleanups

v1->v2:
- added "btrfs: include linux/security.h in super.c" to deal with a compile error after removing it from ctree.h in certain configs.

--- Original email ---
Hello,

While refreshing my ctree sync patches for btrfs-progs I ran into some oddness around our crc32c related helpers that made the sync awkward. This moves those helpers around to other locations to make it easier to sync ctree.c into btrfs-progs.

I also got a little distracted by the massive amount of includes we have in ctree.h, so I moved code around to trim this down to the bare minimum we need currently.

There's no functional change here, just moving things about and renaming things. Thanks,

Josef

Josef Bacik (12):
btrfs: move btrfs_crc32c_final into free-space-cache.c
btrfs: remove btrfs_crc32c wrapper
btrfs: move btrfs_extref_hash into inode-item.h
btrfs: move btrfs_name_hash to dir-item.h
btrfs: include asm/unaligned.h in accessors.h
btrfs: include linux/crc32c in dir-item and inode-item
btrfs: include linux/iomap.h in file.c
btrfs: add fscrypt related dependencies to respective headers
btrfs: add btrfs_delayed_ref_head declaration to extent-tree.h
btrfs: include trace header in where necessary
btrfs: include linux/security.h in super.c
btrfs: remove extraneous includes from ctree.h

 fs/btrfs/accessors.h        |  1 +
 fs/btrfs/async-thread.c     |  1 +
 fs/btrfs/btrfs_inode.h      |  2 ++
 fs/btrfs/ctree.h            | 52 -------------------------------------
 fs/btrfs/dir-item.h         |  9 +++++++
 fs/btrfs/extent-tree.c      |  6 ++---
 fs/btrfs/extent-tree.h      |  1 +
 fs/btrfs/file.c             |  1 +
 fs/btrfs/free-space-cache.c |  9 +++++--
 fs/btrfs/inode-item.h       | 11 ++++++++
 fs/btrfs/locking.c          |  1 +
 fs/btrfs/props.c            |  1 +
 fs/btrfs/root-tree.h        |  2 ++
 fs/btrfs/send.c             |  6 ++---
 fs/btrfs/space-info.h       |  1 +
 fs/btrfs/super.c            |  1 +
 fs/btrfs/tree-checker.c     |  1 +
 17 files changed, 46 insertions(+), 60 deletions(-)
Signature · 1 line
2.41.0
#1 lore raw

PATCH v2 1/12 btrfs: move btrfs_crc32c_final into free-space-cache.c

This is the only place this helper is used, take it out of ctree.h and move it into free-space-cache.c.

---
 fs/btrfs/ctree.h            | 5 -----
 fs/btrfs/free-space-cache.c | 5 +++++
 2 files changed, 5 insertions(+), 5 deletions(-)
fs/btrfs/ctree.h +0 -5
index 9419f4e37a58..c80d9879d931 100644
@@ -475,11 +475,6 @@ static inline u32 btrfs_crc32c(u32 crc, const void *address, unsigned length)
 	return crc32c(crc, address, length);
 }
 
-static inline void btrfs_crc32c_final(u32 crc, u8 *result)
-{
-	put_unaligned_le32(~crc, result);
-}
-
 static inline u64 btrfs_name_hash(const char *name, int len)
 {
        return crc32c((u32)~1, name, len);
fs/btrfs/free-space-cache.c +5 -0
index 27fad70451aa..759b92db35d7 100644
@@ -57,6 +57,11 @@ static void bitmap_clear_bits(struct btrfs_free_space_ctl *ctl,
 			      struct btrfs_free_space *info, u64 offset,
 			      u64 bytes, bool update_stats);
 
+static inline void btrfs_crc32c_final(u32 crc, u8 *result)
+{
+	put_unaligned_le32(~crc, result);
+}
+
 static void __btrfs_remove_free_space_cache(struct btrfs_free_space_ctl *ctl)
 {
 	struct btrfs_free_space *info;
Signature · 1 line
2.41.0
#3 lore raw

PATCH v2 3/12 btrfs: move btrfs_extref_hash into inode-item.h

In reply to Josef Bacik

Ideally this would be un-inlined, but that is a cleanup for later. For now move this into inode-item.h, which is where the extref code lives.

---
 fs/btrfs/ctree.h      | 9 ---------
 fs/btrfs/inode-item.h | 9 +++++++++
 2 files changed, 9 insertions(+), 9 deletions(-)
fs/btrfs/ctree.h +0 -9
index bffee2ab5783..7b8e52fd6d99 100644
@@ -475,15 +475,6 @@ static inline u64 btrfs_name_hash(const char *name, int len)
        return crc32c((u32)~1, name, len);
 }
 
-/*
- * Figure the key offset of an extended inode ref
- */
-static inline u64 btrfs_extref_hash(u64 parent_objectid, const char *name,
-                                   int len)
-{
-       return (u64) crc32c(parent_objectid, name, len);
-}
-
 static inline gfp_t btrfs_alloc_write_mask(struct address_space *mapping)
 {
 	return mapping_gfp_constraint(mapping, ~__GFP_FS);
fs/btrfs/inode-item.h +9 -0
index ede43b6c6559..2ee425a08e63 100644
@@ -107,4 +107,13 @@ struct btrfs_inode_extref *btrfs_find_name_in_ext_backref(
 		struct extent_buffer *leaf, int slot, u64 ref_objectid,
 		const struct fscrypt_str *name);
 
+/*
+ * Figure the key offset of an extended inode ref
+ */
+static inline u64 btrfs_extref_hash(u64 parent_objectid, const char *name,
+                                   int len)
+{
+       return (u64) crc32c(parent_objectid, name, len);
+}
+
 #endif
Signature · 1 line
2.41.0
#2 lore raw

PATCH v2 2/12 btrfs: remove btrfs_crc32c wrapper

In reply to Josef Bacik

This simply sends the same arguments into crc32c(), and is just used in a few places. Remove this wrapper and directly call crc32c() in these instances.

---
 fs/btrfs/ctree.h            | 5 -----
 fs/btrfs/extent-tree.c      | 6 +++---
 fs/btrfs/free-space-cache.c | 4 ++--
 fs/btrfs/send.c             | 6 +++---
 4 files changed, 8 insertions(+), 13 deletions(-)
fs/btrfs/ctree.h +0 -5
index c80d9879d931..bffee2ab5783 100644
@@ -470,11 +470,6 @@ static inline u32 BTRFS_MAX_XATTR_SIZE(const struct btrfs_fs_info *info)
 #define BTRFS_BYTES_TO_BLKS(fs_info, bytes) \
 				((bytes) >> (fs_info)->sectorsize_bits)
 
-static inline u32 btrfs_crc32c(u32 crc, const void *address, unsigned length)
-{
-	return crc32c(crc, address, length);
-}
-
 static inline u64 btrfs_name_hash(const char *name, int len)
 {
        return crc32c((u32)~1, name, len);
fs/btrfs/extent-tree.c +3 -3
index f356f08b55cb..e4d337b78e76 100644
@@ -399,11 +399,11 @@ u64 hash_extent_data_ref(u64 root_objectid, u64 owner, u64 offset)
 	__le64 lenum;
 
 	lenum = cpu_to_le64(root_objectid);
-	high_crc = btrfs_crc32c(high_crc, &lenum, sizeof(lenum));
+	high_crc = crc32c(high_crc, &lenum, sizeof(lenum));
 	lenum = cpu_to_le64(owner);
-	low_crc = btrfs_crc32c(low_crc, &lenum, sizeof(lenum));
+	low_crc = crc32c(low_crc, &lenum, sizeof(lenum));
 	lenum = cpu_to_le64(offset);
-	low_crc = btrfs_crc32c(low_crc, &lenum, sizeof(lenum));
+	low_crc = crc32c(low_crc, &lenum, sizeof(lenum));
 
 	return ((u64)high_crc << 31) ^ (u64)low_crc;
 }
fs/btrfs/free-space-cache.c +2 -2
index 759b92db35d7..dfeed8256c02 100644
@@ -545,7 +545,7 @@ static void io_ctl_set_crc(struct btrfs_io_ctl *io_ctl, int index)
 	if (index == 0)
 		offset = sizeof(u32) * io_ctl->num_pages;
 
-	crc = btrfs_crc32c(crc, io_ctl->orig + offset, PAGE_SIZE - offset);
+	crc = crc32c(crc, io_ctl->orig + offset, PAGE_SIZE - offset);
 	btrfs_crc32c_final(crc, (u8 *)&crc);
 	io_ctl_unmap_page(io_ctl);
 	tmp = page_address(io_ctl->pages[0]);
@@ -567,7 +567,7 @@ static int io_ctl_check_crc(struct btrfs_io_ctl *io_ctl, int index)
 	val = *tmp;
 
 	io_ctl_map_page(io_ctl, 0);
-	crc = btrfs_crc32c(crc, io_ctl->orig + offset, PAGE_SIZE - offset);
+	crc = crc32c(crc, io_ctl->orig + offset, PAGE_SIZE - offset);
 	btrfs_crc32c_final(crc, (u8 *)&crc);
 	if (val != crc) {
 		btrfs_err_rl(io_ctl->fs_info,
fs/btrfs/send.c +3 -3
index 3a566150c531..3b929f0e8f04 100644
@@ -796,7 +796,7 @@ static int send_cmd(struct send_ctx *sctx)
 	put_unaligned_le32(sctx->send_size - sizeof(*hdr), &hdr->len);
 	put_unaligned_le32(0, &hdr->crc);
 
-	crc = btrfs_crc32c(0, (unsigned char *)sctx->send_buf, sctx->send_size);
+	crc = crc32c(0, (unsigned char *)sctx->send_buf, sctx->send_size);
 	put_unaligned_le32(crc, &hdr->crc);
 
 	ret = write_buf(sctx->send_filp, sctx->send_buf, sctx->send_size,
@@ -5669,8 +5669,8 @@ static int send_encoded_extent(struct send_ctx *sctx, struct btrfs_path *path,
 	hdr = (struct btrfs_cmd_header *)sctx->send_buf;
 	hdr->len = cpu_to_le32(sctx->send_size + disk_num_bytes - sizeof(*hdr));
 	hdr->crc = 0;
-	crc = btrfs_crc32c(0, sctx->send_buf, sctx->send_size);
-	crc = btrfs_crc32c(crc, sctx->send_buf + data_offset, disk_num_bytes);
+	crc = crc32c(0, sctx->send_buf, sctx->send_size);
+	crc = crc32c(crc, sctx->send_buf + data_offset, disk_num_bytes);
 	hdr->crc = cpu_to_le32(crc);
 
 	ret = write_buf(sctx->send_filp, sctx->send_buf, sctx->send_size,
Signature · 1 line
2.41.0
#4 lore raw

PATCH v2 4/12 btrfs: move btrfs_name_hash to dir-item.h

In reply to Josef Bacik

This is related to the name hashing for dir items, move it into dir-item.h.

---
 fs/btrfs/ctree.h        | 5 -----
 fs/btrfs/dir-item.h     | 5 +++++
 fs/btrfs/props.c        | 1 +
 fs/btrfs/tree-checker.c | 1 +
 4 files changed, 7 insertions(+), 5 deletions(-)
fs/btrfs/ctree.h +0 -5
index 7b8e52fd6d99..9c2e96b8711f 100644
@@ -470,11 +470,6 @@ static inline u32 BTRFS_MAX_XATTR_SIZE(const struct btrfs_fs_info *info)
 #define BTRFS_BYTES_TO_BLKS(fs_info, bytes) \
 				((bytes) >> (fs_info)->sectorsize_bits)
 
-static inline u64 btrfs_name_hash(const char *name, int len)
-{
-       return crc32c((u32)~1, name, len);
-}
-
 static inline gfp_t btrfs_alloc_write_mask(struct address_space *mapping)
 {
 	return mapping_gfp_constraint(mapping, ~__GFP_FS);
fs/btrfs/dir-item.h +5 -0
index aab4b7cc7fa0..951b4dda46fe 100644
@@ -39,4 +39,9 @@ struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_fs_info *fs_info,
 						 const char *name,
 						 int name_len);
 
+static inline u64 btrfs_name_hash(const char *name, int len)
+{
+       return crc32c((u32)~1, name, len);
+}
+
 #endif
fs/btrfs/props.c +1 -0
index 0755af0e53e3..f9bf591a0718 100644
@@ -15,6 +15,7 @@
 #include "fs.h"
 #include "accessors.h"
 #include "super.h"
+#include "dir-item.h"
 
 #define BTRFS_PROP_HANDLERS_HT_BITS 8
 static DEFINE_HASHTABLE(prop_handlers_ht, BTRFS_PROP_HANDLERS_HT_BITS);
fs/btrfs/tree-checker.c +1 -0
index ab08a0b01311..8ad92aa43924 100644
@@ -29,6 +29,7 @@
 #include "accessors.h"
 #include "file-item.h"
 #include "inode-item.h"
+#include "dir-item.h"
 
 /*
  * Error message should follow the following format:
Signature · 1 line
2.41.0
#5 lore raw

PATCH v2 5/12 btrfs: include asm/unaligned.h in accessors.h

In reply to Josef Bacik

We use the unaligned helpers directly in accessors.h, add the include here.

---
 fs/btrfs/accessors.h | 1 +
 1 file changed, 1 insertion(+)
fs/btrfs/accessors.h +1 -0
index 8cfc8214109c..f958eccff477 100644
@@ -4,6 +4,7 @@
 #define BTRFS_ACCESSORS_H
 
 #include <linux/stddef.h>
+#include <asm/unaligned.h>
 
 struct btrfs_map_token {
 	struct extent_buffer *eb;
Signature · 1 line
2.41.0
#6 lore raw

PATCH v2 6/12 btrfs: include linux/crc32c in dir-item and inode-item

In reply to Josef Bacik

Now these are holding the crc32c wrappers, add the required include so that we have our necessary dependencies.

---
 fs/btrfs/dir-item.h   | 2 ++
 fs/btrfs/inode-item.h | 1 +
 2 files changed, 3 insertions(+)
fs/btrfs/dir-item.h +2 -0
index 951b4dda46fe..5db2ea0dfd76 100644
@@ -3,6 +3,8 @@
 #ifndef BTRFS_DIR_ITEM_H
 #define BTRFS_DIR_ITEM_H
 
+#include <linux/crc32c.h>
+
 int btrfs_check_dir_item_collision(struct btrfs_root *root, u64 dir,
 			  const struct fscrypt_str *name);
 int btrfs_insert_dir_item(struct btrfs_trans_handle *trans,
fs/btrfs/inode-item.h +1 -0
index 2ee425a08e63..63dfd227e7ce 100644
@@ -4,6 +4,7 @@
 #define BTRFS_INODE_ITEM_H
 
 #include <linux/types.h>
+#include <linux/crc32c.h>
 
 struct btrfs_trans_handle;
 struct btrfs_root;
Signature · 1 line
2.41.0
#9 lore raw

PATCH v2 9/12 btrfs: add btrfs_delayed_ref_head declaration to extent-tree.h

In reply to Josef Bacik

extent-tree.h uses btrfs_delayed_ref_head in a function argument but doesn't pull it's declaration from anywhere, add it to the top of the header.

---
 fs/btrfs/extent-tree.h | 1 +
 1 file changed, 1 insertion(+)
fs/btrfs/extent-tree.h +1 -0
index 88c249c37516..ab2016db17e8 100644
@@ -7,6 +7,7 @@
 #include "block-group.h"
 
 struct btrfs_free_cluster;
+struct btrfs_delayed_ref_head;
 
 enum btrfs_extent_allocation_policy {
 	BTRFS_EXTENT_ALLOC_CLUSTERED,
Signature · 1 line
2.41.0
#11 lore raw

PATCH v2 11/12 btrfs: include linux/security.h in super.c

In reply to Josef Bacik

We use some of the security related code in here, include it in super.c so we can remove the include from ctree.h.

---
 fs/btrfs/super.c | 1 +
 1 file changed, 1 insertion(+)
fs/btrfs/super.c +1 -0
index cffdd6f7f8e8..0c215ca05c8a 100644
@@ -26,6 +26,7 @@
 #include <linux/ratelimit.h>
 #include <linux/crc32c.h>
 #include <linux/btrfs.h>
+#include <linux/security.h>
 #include "messages.h"
 #include "delayed-inode.h"
 #include "ctree.h"
Signature · 1 line
2.41.0
#7 lore raw

PATCH v2 7/12 btrfs: include linux/iomap.h in file.c

In reply to Josef Bacik

We use the iomap code in file.c, include it so we have our dependencies.

---
 fs/btrfs/file.c | 1 +
 1 file changed, 1 insertion(+)
fs/btrfs/file.c +1 -0
index 6edad7b9a5d3..ee9621e622d0 100644
@@ -17,6 +17,7 @@
 #include <linux/uio.h>
 #include <linux/iversion.h>
 #include <linux/fsverity.h>
+#include <linux/iomap.h>
 #include "ctree.h"
 #include "disk-io.h"
 #include "transaction.h"
Signature · 1 line
2.41.0
#8 lore raw

PATCH v2 8/12 btrfs: add fscrypt related dependencies to respective headers

In reply to Josef Bacik

These headers have struct fscrypt_str as function arguments, so add struct fscrypt_str to the theader, and include linux/fscrypt.h in btrfs_inode.h as it also needs the definition of struct fscrypt_name for the new inode args.

---
 fs/btrfs/btrfs_inode.h | 1 +
 fs/btrfs/dir-item.h    | 2 ++
 fs/btrfs/inode-item.h  | 1 +
 fs/btrfs/root-tree.h   | 2 ++
 4 files changed, 6 insertions(+)
fs/btrfs/btrfs_inode.h +1 -0
index bda1fdbba666..bca97a6bb246 100644
@@ -8,6 +8,7 @@
 
 #include <linux/hash.h>
 #include <linux/refcount.h>
+#include <linux/fscrypt.h>
 #include "extent_map.h"
 #include "extent_io.h"
 #include "ordered-data.h"
fs/btrfs/dir-item.h +2 -0
index 5db2ea0dfd76..e40a226373d7 100644
@@ -5,6 +5,8 @@
 
 #include <linux/crc32c.h>
 
+struct fscrypt_str;
+
 int btrfs_check_dir_item_collision(struct btrfs_root *root, u64 dir,
 			  const struct fscrypt_str *name);
 int btrfs_insert_dir_item(struct btrfs_trans_handle *trans,
fs/btrfs/inode-item.h +1 -0
index 63dfd227e7ce..a4a142f1b5e3 100644
@@ -13,6 +13,7 @@ struct btrfs_key;
 struct btrfs_inode_extref;
 struct btrfs_inode;
 struct extent_buffer;
+struct fscrypt_str;
 
 /*
  * Return this if we need to call truncate_block for the last bit of the
fs/btrfs/root-tree.h +2 -0
index cbbaca32126e..eb15768b9170 100644
@@ -3,6 +3,8 @@
 #ifndef BTRFS_ROOT_TREE_H
 #define BTRFS_ROOT_TREE_H
 
+struct fscrypt_str;
+
 int btrfs_subvolume_reserve_metadata(struct btrfs_root *root,
 				     struct btrfs_block_rsv *rsv,
 				     int nitems, bool use_global_rsv);
Signature · 1 line
2.41.0
#10 lore raw

PATCH v2 10/12 btrfs: include trace header in where necessary

In reply to Josef Bacik

If we no longer include the tracepoints from ctree.h we fail to compile because we have the dependency in some of the header files and source files. Add the include where we have these dependencies to allow us to remove the include from ctree.h.

---
 fs/btrfs/async-thread.c | 1 +
 fs/btrfs/btrfs_inode.h  | 1 +
 fs/btrfs/locking.c      | 1 +
 fs/btrfs/space-info.h   | 1 +
 4 files changed, 4 insertions(+)
fs/btrfs/async-thread.c +1 -0
index ce083e99ef68..714ca74b66bf 100644
@@ -9,6 +9,7 @@
 #include <linux/list.h>
 #include <linux/spinlock.h>
 #include <linux/freezer.h>
+#include <trace/events/btrfs.h>
 #include "async-thread.h"
 #include "ctree.h"
 
fs/btrfs/btrfs_inode.h +1 -0
index bca97a6bb246..b675dc09845d 100644
@@ -9,6 +9,7 @@
 #include <linux/hash.h>
 #include <linux/refcount.h>
 #include <linux/fscrypt.h>
+#include <trace/events/btrfs.h>
 #include "extent_map.h"
 #include "extent_io.h"
 #include "ordered-data.h"
fs/btrfs/locking.c +1 -0
index 7979449a58d6..79a125c0f4a2 100644
@@ -8,6 +8,7 @@
 #include <linux/spinlock.h>
 #include <linux/page-flags.h>
 #include <asm/bug.h>
+#include <trace/events/btrfs.h>
 #include "misc.h"
 #include "ctree.h"
 #include "extent_io.h"
fs/btrfs/space-info.h +1 -0
index 0bb9d14e60a8..ac0ce83f1477 100644
@@ -3,6 +3,7 @@
 #ifndef BTRFS_SPACE_INFO_H
 #define BTRFS_SPACE_INFO_H
 
+#include <trace/events/btrfs.h>
 #include "volumes.h"
 
 /*
Signature · 1 line
2.41.0
#12 lore raw

PATCH v2 12/12 btrfs: remove extraneous includes from ctree.h

In reply to Josef Bacik

We don't need any of these includes in the ctree.h header file for the header file itself, remove them to clean up ctree.h a little bit.

---
 fs/btrfs/ctree.h | 28 ----------------------------
 1 file changed, 28 deletions(-)
fs/btrfs/ctree.h +0 -28
index 9c2e96b8711f..da9e07bf76ea 100644
@@ -6,36 +6,8 @@
 #ifndef BTRFS_CTREE_H
 #define BTRFS_CTREE_H
 
-#include <linux/mm.h>
-#include <linux/sched/signal.h>
-#include <linux/highmem.h>
-#include <linux/fs.h>
-#include <linux/rwsem.h>
-#include <linux/semaphore.h>
-#include <linux/completion.h>
-#include <linux/backing-dev.h>
-#include <linux/wait.h>
-#include <linux/slab.h>
-#include <trace/events/btrfs.h>
-#include <asm/unaligned.h>
 #include <linux/pagemap.h>
-#include <linux/btrfs.h>
-#include <linux/btrfs_tree.h>
-#include <linux/workqueue.h>
-#include <linux/security.h>
-#include <linux/sizes.h>
-#include <linux/dynamic_debug.h>
-#include <linux/refcount.h>
-#include <linux/crc32c.h>
-#include <linux/iomap.h>
-#include <linux/fscrypt.h>
-#include "extent-io-tree.h"
-#include "extent_io.h"
-#include "extent_map.h"
-#include "async-thread.h"
-#include "block-rsv.h"
 #include "locking.h"
-#include "misc.h"
 #include "fs.h"
 
 struct btrfs_trans_handle;
Signature · 1 line
2.41.0
Reviewed-by on the v2 series
#14 lore raw
In reply to Josef Bacik
Quoted 12 lines · Josef Bacik

v1->v2:
- added "btrfs: include linux/security.h in super.c" to deal with a compile error after removing it from ctree.h in certain configs.

--- Original email ---
Hello,

While refreshing my ctree sync patches for btrfs-progs I ran into some oddness around our crc32c related helpers that made the sync awkward. This moves those helpers around to other locations to make it easier to sync ctree.c into btrfs-progs.

Quoted 9 lines

I also got a little distracted by the massive amount of includes we have in ctree.h, so I moved code around to trim this down to the bare minimum we need currently.

There's no functional change here, just moving things about and renaming things. Thanks,

Josef

I'd fold 6/12 into the patches moving the hash functions, but otherwise

for the series

#16 lore raw
In reply to Josef Bacik
Quoted 22 lines · Josef Bacik

v1->v2:
- added "btrfs: include linux/security.h in super.c" to deal with a compile error after removing it from ctree.h in certain configs.

--- Original email ---
Hello,

While refreshing my ctree sync patches for btrfs-progs I ran into some oddness around our crc32c related helpers that made the sync awkward. This moves those helpers around to other locations to make it easier to sync ctree.c into btrfs-progs.

I also got a little distracted by the massive amount of includes we have in ctree.h, so I moved code around to trim this down to the bare minimum we need currently.

There's no functional change here, just moving things about and renaming things. Thanks,

Josef

Quoted 13 lines

Josef Bacik (12):
btrfs: move btrfs_crc32c_final into free-space-cache.c
btrfs: remove btrfs_crc32c wrapper
btrfs: move btrfs_extref_hash into inode-item.h
btrfs: move btrfs_name_hash to dir-item.h
btrfs: include asm/unaligned.h in accessors.h
btrfs: include linux/crc32c in dir-item and inode-item
btrfs: include linux/iomap.h in file.c
btrfs: add fscrypt related dependencies to respective headers
btrfs: add btrfs_delayed_ref_head declaration to extent-tree.h
btrfs: include trace header in where necessary
btrfs: include linux/security.h in super.c
btrfs: remove extraneous includes from ctree.h

With patch 6 folded to 3 and 4 added to misc-next, thanks.

#15 lore raw
In reply to Johannes Thumshirn
Quoted 17 lines · Johannes Thumshirn
Quoted 16 lines · Josef Bacik

v1->v2:
- added "btrfs: include linux/security.h in super.c" to deal with a compile error after removing it from ctree.h in certain configs.

--- Original email ---
Hello,

While refreshing my ctree sync patches for btrfs-progs I ran into some oddness around our crc32c related helpers that made the sync awkward. This moves those helpers around to other locations to make it easier to sync ctree.c into btrfs-progs.

I also got a little distracted by the massive amount of includes we have in ctree.h, so I moved code around to trim this down to the bare minimum we need currently.

Quoted 7 lines
Quoted 5 lines

There's no functional change here, just moving things about and renaming things. Thanks,

Josef

I'd fold 6/12 into the patches moving the hash functions, but otherwise

Agreed, updating includes as a collateral change is acceptable, though in this series the point was to get the includes ready before the final change to ctree.h. I'll fold the patch as you suggest, thanks.

#13 lore raw

Re: [PATCH v2 12/12] btrfs: remove extraneous includes from ctree.h

In reply to Josef Bacik
Quoted 2 lines · Josef Bacik

We don't need any of these includes in the ctree.h header file for the header file itself, remove them to clean up ctree.h a little bit.

While the include reduction is nice, we still don't have the includes for everything ctree.h uses, e.g. spinlock_t, mutex, pid_t, rb_tree and maybe more. It's not critical as long as it compiles and we have the includes entangled too much so incremental updates work better. The tool include-what-you-use can print the recommendeations for adding and removing includes but it can get confused by direct includes by command line -include. I did a pass for btrfs-progs, desiable for kernel too.