@@ -365,32 +365,44 @@ pub(crate) async fn list_blocks(transport: &Transport) -> Result<HashSet<BlockHa
365365 let job_limit = job_limit. clone ( ) ;
366366 subdir_tasks. spawn ( async move {
367367 let _permit = job_limit. acquire ( ) . await . unwrap ( ) ;
368- transport. list_dir ( & subdir_name) . await
368+ ( subdir_name . clone ( ) , transport. list_dir ( & subdir_name) . await )
369369 } ) ;
370370 }
371371 let mut blocks = HashSet :: new ( ) ;
372372 while let Some ( result) = subdir_tasks. join_next ( ) . await {
373373 let result = result. expect ( "await listdir result" ) ;
374374 match result {
375- Ok ( entries) => {
375+ ( subdir_name , Ok ( entries) ) => {
376376 for entry in entries {
377377 if entry. is_file ( ) {
378- if entry. len . is_none_or ( |a| a == 0 ) {
379- warn ! ( "Empty block file: {:?}" , entry. name) ;
380- continue ;
381- }
382- let Ok ( hash) = entry. name . parse ( ) else {
383- warn ! ( "Unexpected block name: {:?}" , entry. name) ;
384- continue ;
385- } ;
386- if !blocks. insert ( hash) {
387- warn ! ( "Duplicate block name: {:?}" , entry. name) ;
378+ if let Ok ( hash) = entry. name . parse ( ) {
379+ if entry. len . is_none_or ( |a| a == 0 ) {
380+ warn ! (
381+ "Empty block file in directory {:?}: {:?}" ,
382+ subdir_name, entry. name
383+ ) ;
384+ } else if !blocks. insert ( hash) {
385+ warn ! (
386+ "Duplicate block name in directory {:?}: {:?}" ,
387+ subdir_name, entry. name
388+ ) ;
389+ }
390+ } else {
391+ warn ! (
392+ "Unexpected file name in block directory {:?}: {:?}" ,
393+ subdir_name, entry. name
394+ ) ;
388395 }
396+ } else if entry. is_dir ( ) {
397+ warn ! (
398+ "Unexpected subdirectory in block directory {:?}: {:?}" ,
399+ subdir_name, entry. name
400+ ) ;
389401 }
390402 }
391403 }
392- Err ( source) => {
393- error ! ( "Error listing blocks: { :?}" , source) ;
404+ ( subdir , Err ( source) ) => {
405+ error ! ( "Error listing block subdir {subdir :?}: { source:?}" ) ;
394406 return Err ( Error :: ListBlocks { source } ) ;
395407 }
396408 }
0 commit comments