From f82cd58008706da43dd652dd9191511f2786d15d Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Thu, 1 Dec 2022 11:20:40 -0500 Subject: Update bcachefs sources to f1c9030ccb bcachefs: Don't error out when just reading the journal --- libbcachefs/fsck.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'libbcachefs/fsck.c') diff --git a/libbcachefs/fsck.c b/libbcachefs/fsck.c index cd0a8d0..3b71eed 100644 --- a/libbcachefs/fsck.c +++ b/libbcachefs/fsck.c @@ -31,14 +31,12 @@ static s64 bch2_count_inode_sectors(struct btree_trans *trans, u64 inum, u64 sectors = 0; int ret; - for_each_btree_key(trans, iter, BTREE_ID_extents, - SPOS(inum, 0, snapshot), 0, k, ret) { - if (k.k->p.inode != inum) - break; - + for_each_btree_key_upto(trans, iter, BTREE_ID_extents, + SPOS(inum, 0, snapshot), + POS(inum, U64_MAX), + 0, k, ret) if (bkey_extent_is_allocation(k.k)) sectors += k.k->size; - } bch2_trans_iter_exit(trans, &iter); @@ -54,11 +52,10 @@ static s64 bch2_count_subdirs(struct btree_trans *trans, u64 inum, u64 subdirs = 0; int ret; - for_each_btree_key(trans, iter, BTREE_ID_dirents, - SPOS(inum, 0, snapshot), 0, k, ret) { - if (k.k->p.inode != inum) - break; - + for_each_btree_key_upto(trans, iter, BTREE_ID_dirents, + SPOS(inum, 0, snapshot), + POS(inum, U64_MAX), + 0, k, ret) { if (k.k->type != KEY_TYPE_dirent) continue; @@ -66,7 +63,6 @@ static s64 bch2_count_subdirs(struct btree_trans *trans, u64 inum, if (d.v->d_type == DT_DIR) subdirs++; } - bch2_trans_iter_exit(trans, &iter); return ret ?: subdirs; -- cgit v1.2.3