Skip to content

Commit 0a2e230

Browse files
committed
Merge tag 'bcachefs-2024-04-29' of https://evilpiepirate.org/git/bcachefs
Pull bcachefs fixes from Kent Overstreet: "Tiny set of fixes this time" * tag 'bcachefs-2024-04-29' of https://evilpiepirate.org/git/bcachefs: bcachefs: fix integer conversion bug bcachefs: btree node scan now fills in sectors_written bcachefs: Remove accidental debug assert
2 parents b947cc5 + c258c08 commit 0a2e230

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

fs/bcachefs/btree_node_scan.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,25 @@ static void found_btree_node_to_key(struct bkey_i *k, const struct found_btree_n
5757
bp->v.seq = cpu_to_le64(f->cookie);
5858
bp->v.sectors_written = 0;
5959
bp->v.flags = 0;
60+
bp->v.sectors_written = cpu_to_le16(f->sectors_written);
6061
bp->v.min_key = f->min_key;
6162
SET_BTREE_PTR_RANGE_UPDATED(&bp->v, f->range_updated);
6263
memcpy(bp->v.start, f->ptrs, sizeof(struct bch_extent_ptr) * f->nr_ptrs);
6364
}
6465

6566
static bool found_btree_node_is_readable(struct btree_trans *trans,
66-
const struct found_btree_node *f)
67+
struct found_btree_node *f)
6768
{
6869
struct { __BKEY_PADDED(k, BKEY_BTREE_PTR_VAL_U64s_MAX); } k;
6970

7071
found_btree_node_to_key(&k.k, f);
7172

7273
struct btree *b = bch2_btree_node_get_noiter(trans, &k.k, f->btree_id, f->level, false);
7374
bool ret = !IS_ERR_OR_NULL(b);
74-
if (ret)
75+
if (ret) {
76+
f->sectors_written = b->written;
7577
six_unlock_read(&b->c.lock);
78+
}
7679

7780
/*
7881
* We might update this node's range; if that happens, we need the node

fs/bcachefs/btree_node_scan_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ struct found_btree_node {
99
bool overwritten:1;
1010
u8 btree_id;
1111
u8 level;
12+
unsigned sectors_written;
1213
u32 seq;
1314
u64 cookie;
1415

fs/bcachefs/buckets.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,6 @@ int bch2_mark_metadata_bucket(struct bch_fs *c, struct bch_dev *ca,
525525
"different types of data in same bucket: %s, %s",
526526
bch2_data_type_str(g->data_type),
527527
bch2_data_type_str(data_type))) {
528-
BUG();
529528
ret = -EIO;
530529
goto err;
531530
}
@@ -629,7 +628,6 @@ int bch2_check_bucket_ref(struct btree_trans *trans,
629628
bch2_data_type_str(ptr_data_type),
630629
(printbuf_reset(&buf),
631630
bch2_bkey_val_to_text(&buf, c, k), buf.buf));
632-
BUG();
633631
ret = -EIO;
634632
goto err;
635633
}

fs/bcachefs/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ int bch2_trigger_inode(struct btree_trans *trans,
606606
struct bkey_s new,
607607
unsigned flags)
608608
{
609-
s64 nr = bkey_is_inode(new.k) - bkey_is_inode(old.k);
609+
s64 nr = (s64) bkey_is_inode(new.k) - (s64) bkey_is_inode(old.k);
610610

611611
if (flags & BTREE_TRIGGER_TRANSACTIONAL) {
612612
if (nr) {

0 commit comments

Comments
 (0)