From 3b5e7e0ead6397c58e5347c17101df97bdaa8d93 Mon Sep 17 00:00:00 2001 From: Christophe Grenier Date: Sat, 4 Oct 2014 18:18:00 +0200 Subject: [PATCH] PhotoRec: limit to 200 MB when searching the previous unrecovered file --- src/photorec.c | 7 ++++--- src/psearchn.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/photorec.c b/src/photorec.c index 170fe59e..6340b61d 100644 --- a/src/photorec.c +++ b/src/photorec.c @@ -282,7 +282,7 @@ void get_prev_location(alloc_data_t *list_search_space, alloc_data_t **current_s uint64_t size=0; /* Search backward the first fragment of a file not successfully recovered * Limit the search to 10 fragments or 1GB */ - for(nbr=0; nbr<10 && size < (uint64_t)1024*1024*1024; nbr++) + for(nbr=0; nbr<3 && size < (uint64_t)200*1024*1024; nbr++) { file_space=td_list_entry(file_space->list.prev, alloc_data_t, list); if(file_space==list_search_space) @@ -302,7 +302,7 @@ int get_prev_file_header(alloc_data_t *list_search_space, alloc_data_t **current uint64_t size=0; /* Search backward the first fragment of a file not successfully recovered * Limit the search to 10 fragments or 1GB */ - for(nbr=0; nbr<10 && size < (uint64_t)1024*1024*1024; nbr++) + for(nbr=0; nbr<3 && size < (uint64_t)200*1024*1024; nbr++) { file_space=td_list_entry(file_space->list.prev, alloc_data_t, list); if(file_space==list_search_space) @@ -556,7 +556,8 @@ static void file_finish_aux(file_recovery_t *file_recovery, struct ph_param *par if(file_recovery->file_stat!=NULL && file_recovery->file_size> 0 && file_recovery->file_size < file_recovery->min_filesize) { - log_info("File too small ( %llu < %llu), reject it\n", + log_info("%s File too small ( %llu < %llu), reject it\n", + file_recovery->filename, (long long unsigned) file_recovery->file_size, (long long unsigned) file_recovery->min_filesize); file_recovery->file_size=0; diff --git a/src/psearchn.c b/src/psearchn.c index 95cc1b0e..3246a306 100644 --- a/src/psearchn.c +++ b/src/psearchn.c @@ -372,7 +372,7 @@ pstatus_t photorec_aux(struct ph_param *params, const struct ph_options *options { /* try to recover the previous file, otherwise stay at the current location */ offset_before_back=offset; - if(back < 10 && + if(back < 5 && get_prev_file_header(list_search_space, ¤t_search_space, &offset)==0) back++; else