temp
diff --git a/drivers/md/bcache/bset.c b/drivers/md/bcache/bset.c index 4385303..f541d3e 100644 --- a/drivers/md/bcache/bset.c +++ b/drivers/md/bcache/bset.c
@@ -545,7 +545,6 @@ static struct bkey *tree_to_bkey(struct bset_tree *t, unsigned int j) { return cacheline_to_bkey(t, to_inorder(j, t), t->tree[j].m); } - static struct bkey *tree_to_prev_bkey(struct bset_tree *t, unsigned int j) { return (void *) (((uint64_t *) tree_to_bkey(t, j)) - t->prev[j]); @@ -584,9 +583,12 @@ static inline uint64_t shrd128(uint64_t high, uint64_t low, uint8_t shift) static inline unsigned int bfloat_mantissa(const struct bkey *k, struct bkey_float *f) { - const uint64_t *p = &k->low - (f->exponent >> 6); - - return shrd128(p[-1], p[0], f->exponent & 63) & BKEY_MANTISSA_MASK; + if (!(f->exponent >> 6)) + return shrd128(0, KEY_INODE(k), f->exponent & 63) & + BKEY_MANTISSA_MASK; + else + return shrd128(KEY_INODE(k), k->low, f->exponent & 63) & + BKEY_MANTISSA_MASK; } static void make_bfloat(struct bset_tree *t, unsigned int j) @@ -621,7 +623,10 @@ static void make_bfloat(struct bset_tree *t, unsigned int j) else f->exponent = fls64(r->low ^ l->low); - f->exponent = max_t(int, f->exponent - BKEY_MANTISSA_BITS, 0); + if (f->exponent > BKEY_MANTISSA_BITS) + f->exponent -= BKEY_MANTISSA_BITS; + else + f->exponent = 0; /* * Setting f->exponent = 127 flags this node as failed, and causes the
diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index ac8a99e..db431c2 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c
@@ -99,7 +99,7 @@ #define PTR_HASH(c, k) \ (((k)->ptr[0] >> c->bucket_bits) | PTR_GEN(k, 0)) -#define insert_lock(s, b) ((b)->level <= (s)->lock) +#define insert_lock(s, b) ((s)->level >= (b)->lock) /* * These macros are for recursing down the btree - they handle the details of
diff --git a/drivers/md/bcache/btree.h b/drivers/md/bcache/btree.h index 3b1a423..b7d285d 100644 --- a/drivers/md/bcache/btree.h +++ b/drivers/md/bcache/btree.h
@@ -228,17 +228,20 @@ static inline void bch_btree_op_init(struct btree_op *op, int write_lock_level) static inline void rw_lock(bool w, struct btree *b, int level) { - w ? down_write_nested(&b->lock, level + 1) - : down_read_nested(&b->lock, level + 1); - if (w) + if (w) { + down_write_nested(&b->lock, level + 1); b->seq++; + } else + down_read_nested(&b->lock, level + 1); } static inline void rw_unlock(bool w, struct btree *b) { - if (w) + if (w) { b->seq++; - (w ? up_write : up_read)(&b->lock); + up_write(&b->lock); + } else + up_read(&b->lock); } void bch_btree_node_read_done(struct btree *b);