From 73501ab82c44b1249916ded8dcb883f7705b1549 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Fri, 4 Oct 2019 15:58:43 -0400 Subject: bcachefs: Don't use sha256 for siphash str hash key With the refactoring that's coming to add fuse support, we want bch2_hash_info_init() to be cheaper so we don't have to rely on anything cached besides the inode in the btree. Signed-off-by: Kent Overstreet --- fs/bcachefs/inode.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'fs/bcachefs/inode.c') diff --git a/fs/bcachefs/inode.c b/fs/bcachefs/inode.c index fc38cfb9e939..3dc46faaebbc 100644 --- a/fs/bcachefs/inode.c +++ b/fs/bcachefs/inode.c @@ -6,8 +6,7 @@ #include "error.h" #include "extents.h" #include "inode.h" -#include "io.h" -#include "keylist.h" +#include "str_hash.h" #include @@ -303,11 +302,13 @@ void bch2_inode_init(struct bch_fs *c, struct bch_inode_unpacked *inode_u, struct bch_inode_unpacked *parent) { s64 now = bch2_current_time(c); + enum bch_str_hash_type str_hash = + bch2_str_hash_opt_to_type(c, c->opts.str_hash); memset(inode_u, 0, sizeof(*inode_u)); /* ick */ - inode_u->bi_flags |= c->opts.str_hash << INODE_STR_HASH_OFFSET; + inode_u->bi_flags |= str_hash << INODE_STR_HASH_OFFSET; get_random_bytes(&inode_u->bi_hash_seed, sizeof(inode_u->bi_hash_seed)); -- cgit