@@ -2371,22 +2371,6 @@ static bool darray_u32_has(darray_u32 *d, u32 v)
2371
2371
return false;
2372
2372
}
2373
2373
2374
- /*
2375
- * We've checked that inode backpointers point to valid dirents; here, it's
2376
- * sufficient to check that the subvolume root has a dirent:
2377
- */
2378
- static int subvol_has_dirent (struct btree_trans * trans , struct bkey_s_c_subvolume s )
2379
- {
2380
- struct bch_inode_unpacked inode ;
2381
- int ret = bch2_inode_find_by_inum_trans (trans ,
2382
- (subvol_inum ) { s .k -> p .offset , le64_to_cpu (s .v -> inode ) },
2383
- & inode );
2384
- if (ret )
2385
- return ret ;
2386
-
2387
- return inode .bi_dir != 0 ;
2388
- }
2389
-
2390
2374
static int check_subvol_path (struct btree_trans * trans , struct btree_iter * iter , struct bkey_s_c k )
2391
2375
{
2392
2376
struct bch_fs * c = trans -> c ;
@@ -2405,14 +2389,24 @@ static int check_subvol_path(struct btree_trans *trans, struct btree_iter *iter,
2405
2389
2406
2390
struct bkey_s_c_subvolume s = bkey_s_c_to_subvolume (k );
2407
2391
2408
- ret = subvol_has_dirent (trans , s );
2409
- if (ret < 0 )
2392
+ struct bch_inode_unpacked subvol_root ;
2393
+ ret = bch2_inode_find_by_inum_trans (trans ,
2394
+ (subvol_inum ) { s .k -> p .offset , le64_to_cpu (s .v -> inode ) },
2395
+ & subvol_root );
2396
+ if (ret )
2410
2397
break ;
2411
2398
2412
- if (fsck_err_on (!ret ,
2399
+ /*
2400
+ * We've checked that inode backpointers point to valid dirents;
2401
+ * here, it's sufficient to check that the subvolume root has a
2402
+ * dirent:
2403
+ */
2404
+ if (fsck_err_on (!subvol_root .bi_dir ,
2413
2405
trans , subvol_unreachable ,
2414
2406
"unreachable subvolume %s" ,
2415
2407
(bch2_bkey_val_to_text (& buf , c , s .s_c ),
2408
+ prt_newline (& buf ),
2409
+ bch2_inode_unpacked_to_text (& buf , & subvol_root ),
2416
2410
buf .buf ))) {
2417
2411
ret = reattach_subvol (trans , s );
2418
2412
break ;
0 commit comments