summaryrefslogtreecommitdiff
path: root/libbcachefs/nocow_locking.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-11-26 17:09:59 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2022-11-26 17:09:59 -0500
commit934a84dfaf719af82dadbbe0e2480baff03c905b (patch)
tree22deb77e752f90c842ac2f8dce91f5a602afd49d /libbcachefs/nocow_locking.h
parent48eefee7495c6e145f3fcfe6ab83f9e8bc27a1ec (diff)
Update bcachefs sources to 5963d1b1a4 bcacehfs: Fix bch2_get_alloc_in_memory_pos()
Diffstat (limited to 'libbcachefs/nocow_locking.h')
-rw-r--r--libbcachefs/nocow_locking.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/libbcachefs/nocow_locking.h b/libbcachefs/nocow_locking.h
index 09ab85ac..2a7a9f44 100644
--- a/libbcachefs/nocow_locking.h
+++ b/libbcachefs/nocow_locking.h
@@ -5,12 +5,12 @@
#include "bcachefs_format.h"
#include "two_state_shared_lock.h"
-#include <linux/siphash.h>
+#include <linux/hash.h>
-#define BUCKET_NOCOW_LOCKS (1U << 10)
+#define BUCKET_NOCOW_LOCKS_BITS 10
+#define BUCKET_NOCOW_LOCKS (1U << BUCKET_NOCOW_LOCKS_BITS)
struct bucket_nocow_lock_table {
- siphash_key_t key;
two_state_lock_t l[BUCKET_NOCOW_LOCKS];
};
@@ -20,7 +20,7 @@ static inline two_state_lock_t *bucket_nocow_lock(struct bucket_nocow_lock_table
struct bpos bucket)
{
u64 dev_bucket = bucket.inode << 56 | bucket.offset;
- unsigned h = siphash_1u64(dev_bucket, &t->key);
+ unsigned h = hash_64(dev_bucket, BUCKET_NOCOW_LOCKS_BITS);
return t->l + (h & (BUCKET_NOCOW_LOCKS - 1));
}
@@ -41,7 +41,7 @@ static inline void bch2_bucket_nocow_unlock(struct bucket_nocow_lock_table *t,
bch2_two_state_unlock(l, flags & BUCKET_NOCOW_LOCK_UPDATE);
}
-void __bch2_bucket_nocow_lock(struct bucket_nocow_lock_table *, struct bpos, int);
+void __bch2_bucket_nocow_lock(struct bucket_nocow_lock_table *, two_state_lock_t *, int);
static inline void bch2_bucket_nocow_lock(struct bucket_nocow_lock_table *t,
struct bpos bucket, int flags)
@@ -49,7 +49,7 @@ static inline void bch2_bucket_nocow_lock(struct bucket_nocow_lock_table *t,
two_state_lock_t *l = bucket_nocow_lock(t, bucket);
if (!bch2_two_state_trylock(l, flags & BUCKET_NOCOW_LOCK_UPDATE))
- __bch2_bucket_nocow_lock(t, bucket, flags);
+ __bch2_bucket_nocow_lock(t, l, flags);
}
#endif /* _BCACHEFS_NOCOW_LOCKING_H */