Loading drivers/md/bcache/bcache.h +0 −4 Original line number Diff line number Diff line Loading @@ -736,10 +736,6 @@ static inline unsigned local_clock_us(void) #define node(i, j) ((struct bkey *) ((i)->d + (j))) #define end(i) node(i, (i)->keys) #define index(i, b) \ ((size_t) (((void *) i - (void *) (b)->sets[0].data) / \ block_bytes(b->c))) #define btree_data_space(b) (PAGE_SIZE << (b)->page_order) #define prios_per_bucket(c) \ Loading drivers/md/bcache/btree.c +3 −3 Original line number Diff line number Diff line Loading @@ -258,7 +258,7 @@ static void bch_btree_node_read_done(struct btree *b) err = "corrupted btree"; for (i = write_block(b); index(i, b) < btree_blocks(b); bset_sector_offset(b, i) < KEY_SIZE(&b->key); i = ((void *) i) + block_bytes(b->c)) if (i->seq == b->sets[0].data->seq) goto err; Loading @@ -278,9 +278,9 @@ out: return; err: set_btree_node_io_error(b); bch_cache_set_error(b->c, "%s at bucket %zu, block %zu, %u keys", bch_cache_set_error(b->c, "%s at bucket %zu, block %u, %u keys", err, PTR_BUCKET_NR(b->c, &b->key, 0), index(i, b), i->keys); bset_block_offset(b, i), i->keys); goto out; } Loading drivers/md/bcache/btree.h +20 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,26 @@ static inline unsigned bset_offset(struct btree *b, struct bset *i) return (((size_t) i) - ((size_t) b->sets->data)) >> 9; } static inline struct bset *btree_bset_first(struct btree *b) { return b->sets->data; } static inline unsigned bset_byte_offset(struct btree *b, struct bset *i) { return ((size_t) i) - ((size_t) b->sets->data); } static inline unsigned bset_sector_offset(struct btree *b, struct bset *i) { return (((void *) i) - ((void *) btree_bset_first(b))) >> 9; } static inline unsigned bset_block_offset(struct btree *b, struct bset *i) { return bset_sector_offset(b, i) >> b->c->block_bits; } static inline struct bset *write_block(struct btree *b) { return ((void *) b->sets[0].data) + b->written * block_bytes(b->c); Loading drivers/md/bcache/debug.c +1 −1 Original line number Diff line number Diff line Loading @@ -88,7 +88,7 @@ static void dump_bset(struct btree *b, struct bset *i) next = bkey_next(k); bch_bkey_to_text(buf, sizeof(buf), k); printk(KERN_ERR "block %zu key %zi/%u: %s", index(i, b), printk(KERN_ERR "block %u key %zi/%u: %s", bset_block_offset(b, i), (uint64_t *) k - i->d, i->keys, buf); for (j = 0; j < KEY_PTRS(k); j++) { Loading Loading
drivers/md/bcache/bcache.h +0 −4 Original line number Diff line number Diff line Loading @@ -736,10 +736,6 @@ static inline unsigned local_clock_us(void) #define node(i, j) ((struct bkey *) ((i)->d + (j))) #define end(i) node(i, (i)->keys) #define index(i, b) \ ((size_t) (((void *) i - (void *) (b)->sets[0].data) / \ block_bytes(b->c))) #define btree_data_space(b) (PAGE_SIZE << (b)->page_order) #define prios_per_bucket(c) \ Loading
drivers/md/bcache/btree.c +3 −3 Original line number Diff line number Diff line Loading @@ -258,7 +258,7 @@ static void bch_btree_node_read_done(struct btree *b) err = "corrupted btree"; for (i = write_block(b); index(i, b) < btree_blocks(b); bset_sector_offset(b, i) < KEY_SIZE(&b->key); i = ((void *) i) + block_bytes(b->c)) if (i->seq == b->sets[0].data->seq) goto err; Loading @@ -278,9 +278,9 @@ out: return; err: set_btree_node_io_error(b); bch_cache_set_error(b->c, "%s at bucket %zu, block %zu, %u keys", bch_cache_set_error(b->c, "%s at bucket %zu, block %u, %u keys", err, PTR_BUCKET_NR(b->c, &b->key, 0), index(i, b), i->keys); bset_block_offset(b, i), i->keys); goto out; } Loading
drivers/md/bcache/btree.h +20 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,26 @@ static inline unsigned bset_offset(struct btree *b, struct bset *i) return (((size_t) i) - ((size_t) b->sets->data)) >> 9; } static inline struct bset *btree_bset_first(struct btree *b) { return b->sets->data; } static inline unsigned bset_byte_offset(struct btree *b, struct bset *i) { return ((size_t) i) - ((size_t) b->sets->data); } static inline unsigned bset_sector_offset(struct btree *b, struct bset *i) { return (((void *) i) - ((void *) btree_bset_first(b))) >> 9; } static inline unsigned bset_block_offset(struct btree *b, struct bset *i) { return bset_sector_offset(b, i) >> b->c->block_bits; } static inline struct bset *write_block(struct btree *b) { return ((void *) b->sets[0].data) + b->written * block_bytes(b->c); Loading
drivers/md/bcache/debug.c +1 −1 Original line number Diff line number Diff line Loading @@ -88,7 +88,7 @@ static void dump_bset(struct btree *b, struct bset *i) next = bkey_next(k); bch_bkey_to_text(buf, sizeof(buf), k); printk(KERN_ERR "block %zu key %zi/%u: %s", index(i, b), printk(KERN_ERR "block %u key %zi/%u: %s", bset_block_offset(b, i), (uint64_t *) k - i->d, i->keys, buf); for (j = 0; j < KEY_PTRS(k); j++) { Loading