mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 02:49:02 -04:00
Uses a more specific message if UUID are not supported.
This commit is contained in:
parent
dde48ca299
commit
16ddf36121
4 changed files with 58 additions and 40 deletions
|
|
@ -611,6 +611,7 @@ struct snapraid_disk* disk_alloc(const char* name, const char* dir, uint64_t dev
|
|||
disk->has_volatile_inodes = 0;
|
||||
disk->has_unreliable_physical = 0;
|
||||
disk->has_different_uuid = 0;
|
||||
disk->has_unsupported_uuid = 0;
|
||||
disk->had_empty_uuid = 0;
|
||||
disk->mapping = -1;
|
||||
tommy_list_init(&disk->filelist);
|
||||
|
|
|
|||
|
|
@ -297,6 +297,7 @@ struct snapraid_disk {
|
|||
int has_volatile_inodes; /**< If the underline filesystem has not persistent inodes. */
|
||||
int has_unreliable_physical; /**< If the physical offset of files has duplicates. */
|
||||
int has_different_uuid; /**< If the disk has a different UUID, meaning that it is not the same filesystem. */
|
||||
int has_unsupported_uuid; /**< If the disk doesn't report UUID, meaning it's not supported. */
|
||||
int had_empty_uuid; /**< If the disk had an empty UUID, meaning that it's a new disk. */
|
||||
int mapping; /**< Index in the mapping vector. Used only as buffer when writing the content file. */
|
||||
|
||||
|
|
|
|||
|
|
@ -483,7 +483,7 @@ static void scan_file(struct snapraid_scan* scan, int output, const char* sub, c
|
|||
* This ensures that no file is found with a past inode, but at the same time,
|
||||
* it allows to find new files with the same inode, to identify them as hardlinks.
|
||||
*/
|
||||
int has_past_inodes = !disk->has_volatile_inodes && !disk->has_different_uuid;
|
||||
int has_past_inodes = !disk->has_volatile_inodes && !disk->has_different_uuid && !disk->has_unsupported_uuid;
|
||||
|
||||
/* always search with the new inode, in the all new inodes found until now, */
|
||||
/* with the eventual presence of also the past inodes */
|
||||
|
|
@ -1199,6 +1199,7 @@ void state_scan(struct snapraid_state* state, int output)
|
|||
tommy_node* i;
|
||||
tommy_node* j;
|
||||
tommy_list scanlist;
|
||||
int done;
|
||||
|
||||
tommy_list_init(&scanlist);
|
||||
|
||||
|
|
@ -1244,8 +1245,8 @@ void state_scan(struct snapraid_state* state, int output)
|
|||
disk->has_volatile_inodes = 1;
|
||||
}
|
||||
|
||||
/* if inodes or UUID are not persistent */
|
||||
if (disk->has_volatile_inodes || disk->has_different_uuid) {
|
||||
/* if inodes or UUID are not persistent/changed/unsupported */
|
||||
if (disk->has_volatile_inodes || disk->has_different_uuid || disk->has_unsupported_uuid) {
|
||||
/* removes all the inodes from the inode collection */
|
||||
/* if they are not persistent, all of them could be changed now */
|
||||
/* and we don't want to find false matching ones */
|
||||
|
|
@ -1422,7 +1423,7 @@ void state_scan(struct snapraid_state* state, int output)
|
|||
|
||||
/* checks for disks where all the previously existing files where removed */
|
||||
if (!state->opt.force_empty) {
|
||||
int done = 0;
|
||||
done = 0;
|
||||
for(i=state->disklist,j=scanlist;i!=0;i=i->next,j=j->next) {
|
||||
struct snapraid_disk* disk = i->data;
|
||||
struct snapraid_scan* scan = j->data;
|
||||
|
|
@ -1449,7 +1450,7 @@ void state_scan(struct snapraid_state* state, int output)
|
|||
|
||||
/* checks for disks without the physical offset support */
|
||||
if (state->opt.force_order == SORT_PHYSICAL) {
|
||||
int done = 0;
|
||||
done = 0;
|
||||
for(i=state->disklist;i!=0;i=i->next) {
|
||||
struct snapraid_disk* disk = i->data;
|
||||
|
||||
|
|
@ -1467,49 +1468,64 @@ void state_scan(struct snapraid_state* state, int output)
|
|||
}
|
||||
}
|
||||
|
||||
/* Check for disks without persistent inodes */
|
||||
{
|
||||
int done = 0;
|
||||
for(i=state->disklist;i!=0;i=i->next) {
|
||||
struct snapraid_disk* disk = i->data;
|
||||
/* checks for disks without persistent inodes */
|
||||
done = 0;
|
||||
for(i=state->disklist;i!=0;i=i->next) {
|
||||
struct snapraid_disk* disk = i->data;
|
||||
|
||||
if (disk->has_volatile_inodes) {
|
||||
if (!done) {
|
||||
done = 1;
|
||||
fprintf(stderr, "WARNING! Inodes are not persistent for disks: '%s'", disk->name);
|
||||
} else {
|
||||
fprintf(stderr, ", '%s", disk->name);
|
||||
}
|
||||
if (disk->has_volatile_inodes) {
|
||||
if (!done) {
|
||||
done = 1;
|
||||
fprintf(stderr, "WARNING! Inodes are not persistent for disks: '%s'", disk->name);
|
||||
} else {
|
||||
fprintf(stderr, ", '%s", disk->name);
|
||||
}
|
||||
}
|
||||
if (done) {
|
||||
fprintf(stderr, ". Move operations won't be optimal (but you can live with that).\n");
|
||||
}
|
||||
}
|
||||
if (done) {
|
||||
fprintf(stderr, ". Move operations won't be optimal (but you can live with that).\n");
|
||||
}
|
||||
|
||||
/* Check for disks with changed UUID */
|
||||
{
|
||||
int done = 0;
|
||||
for(i=state->disklist;i!=0;i=i->next) {
|
||||
struct snapraid_disk* disk = i->data;
|
||||
/* checks for disks with changed UUID */
|
||||
done = 0;
|
||||
for(i=state->disklist;i!=0;i=i->next) {
|
||||
struct snapraid_disk* disk = i->data;
|
||||
|
||||
/* don't print the message if the UUID changed because before */
|
||||
/* it was no set. */
|
||||
/* this is the normal condition for an empty disk because it */
|
||||
/* isn't stored */
|
||||
if (disk->has_different_uuid && !disk->had_empty_uuid) {
|
||||
if (!done) {
|
||||
done = 1;
|
||||
fprintf(stderr, "WARNING! UUID is changed for disks: '%s'", disk->name);
|
||||
} else {
|
||||
fprintf(stderr, ", '%s", disk->name);
|
||||
}
|
||||
/* don't print the message if the UUID changed because before */
|
||||
/* it was no set. */
|
||||
/* this is the normal condition for an empty disk because it */
|
||||
/* isn't stored */
|
||||
if (disk->has_different_uuid && !disk->had_empty_uuid) {
|
||||
if (!done) {
|
||||
done = 1;
|
||||
fprintf(stderr, "WARNING! UUID is changed for disks: '%s'", disk->name);
|
||||
} else {
|
||||
fprintf(stderr, ", '%s", disk->name);
|
||||
}
|
||||
}
|
||||
if (done) {
|
||||
fprintf(stderr, ". Move operations won't be optimal (but you can live with that).\n");
|
||||
}
|
||||
if (done) {
|
||||
fprintf(stderr, ". Move operations won't be optimal (but you can live with that).\n");
|
||||
}
|
||||
|
||||
/* checks for disks with unsupported UUID */
|
||||
done = 0;
|
||||
for(i=state->disklist;i!=0;i=i->next) {
|
||||
struct snapraid_disk* disk = i->data;
|
||||
|
||||
if (disk->has_unsupported_uuid) {
|
||||
if (!done) {
|
||||
done = 1;
|
||||
fprintf(stderr, "WARNING! UUID is unsupported for disks: '%s'", disk->name);
|
||||
} else {
|
||||
fprintf(stderr, ", '%s", disk->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (done) {
|
||||
fprintf(stderr, ". Move operations won't be optimal (but you can live with that).\n");
|
||||
}
|
||||
|
||||
|
||||
if (state->opt.verbose || output) {
|
||||
struct snapraid_scan total;
|
||||
|
|
|
|||
|
|
@ -994,8 +994,8 @@ static void state_map(struct snapraid_state* state)
|
|||
|
||||
ret = devuuid(disk->device, uuid, sizeof(uuid));
|
||||
if (ret != 0) {
|
||||
/* uuid not available, just ignore but marks the disk with not persistent UUID */
|
||||
disk->has_different_uuid = 1;
|
||||
/* uuid not available, just ignore but marks the disk with unsupported UUID */
|
||||
disk->has_unsupported_uuid = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue