btrfs: move btrfs_name_hash to dir-item.h
authorJosef Bacik <josef@toxicpanda.com>
Fri, 25 Aug 2023 20:19:22 +0000 (16:19 -0400)
committerDavid Sterba <dsterba@suse.com>
Thu, 12 Oct 2023 14:44:02 +0000 (16:44 +0200)
This is related to the name hashing for dir items, move it into
dir-item.h.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.h
fs/btrfs/dir-item.h
fs/btrfs/props.c
fs/btrfs/tree-checker.c

index 7b8e52fd6d991649ab251e351149f035c725d3bf..9c2e96b8711fe2165d42db0c20b75c9028049cef 100644 (file)
@@ -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);
index aab4b7cc7fa03f9fb522b481f7078e995b401f30..5db2ea0dfd76680a3b32b414eb2b78cbf7aa136a 100644 (file)
@@ -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,
@@ -39,4 +41,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
index 0755af0e53e394f68a74bab6e830e79ae40d2348..f9bf591a07187af024a2259bf5e0dadf1b1ee16a 100644 (file)
@@ -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);
index ab08a0b013112b28ba10bf55a35ef327df196b8a..8ad92aa439248656c7b6fc9931cb63c4702f4817 100644 (file)
@@ -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: