Prints the list of files with dup offset.

This commit is contained in:
Andrea Mazzoleni 2013-12-02 19:03:00 +01:00
parent 70fc6f5143
commit a7d6b86b7b
2 changed files with 11 additions and 1 deletions

View file

@ -4,6 +4,8 @@ SnapRAID HISTORY
5.1 2013/12 (BETA)
==================
* Fixed the -C, --gen-conf command.
* Prints the files with duplicate physical offset if the
-v, --verbose option is specified.
5.0 2013/11
===========

10
scan.c
View file

@ -980,6 +980,7 @@ void state_scan(struct snapraid_state* state, int output)
unsigned phy_count;
unsigned phy_dup;
uint64_t phy_last;
struct snapraid_file* phy_file_last;
scan = malloc_nofail(sizeof(struct snapraid_scan));
scan->count_equal = 0;
@ -1117,13 +1118,20 @@ void state_scan(struct snapraid_state* state, int output)
phy_count = 0;
phy_dup = 0;
phy_last = -1;
phy_file_last = 0;
while (node) {
struct snapraid_file* file = node->data;
/* if the file is not empty, count duplicate physical offsets */
if (state->opt.force_order == SORT_PHYSICAL && file->size != 0) {
if (phy_count > 0 && file->physical == phy_last && phy_last != FILEPHY_WITHOUT_OFFSET)
if (phy_file_last != 0 && file->physical == phy_last && phy_last != FILEPHY_WITHOUT_OFFSET) {
/* if verbose, prints the list of duplicates */
if (state->opt.verbose) {
fprintf(stderr, "WARNING! Files '%s%s' and '%s%s' have the same physical offset %"PRId64".\n", disk->dir, phy_file_last->sub, disk->dir, file->sub, phy_last);
}
++phy_dup;
}
phy_file_last = file;
phy_last = file->physical;
++phy_count;
}