mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-22 07:56:33 -05:00
Add Btrfs snapshot support for atomic sync and recovery consistency
This commit is contained in:
parent
d2c1029017
commit
cffd1ca15c
18 changed files with 1094 additions and 39 deletions
|
|
@ -1835,6 +1835,11 @@ int snapraid_main(int argc, char* argv[])
|
|||
if (opt.gui_touch_before)
|
||||
state_touch(&state);
|
||||
|
||||
ret = state_snapshot_new(&state);
|
||||
if (ret != 0) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
state_scan(&state);
|
||||
|
||||
if (opt.gui_threshold_removes != 0 && state.removed_files >= opt.gui_threshold_removes) {
|
||||
|
|
@ -1884,6 +1889,10 @@ int snapraid_main(int argc, char* argv[])
|
|||
sleep(2);
|
||||
|
||||
ret = state_sync(&state, blockstart, blockcount);
|
||||
|
||||
/* commit the snapshot as stable */
|
||||
if (ret == 0)
|
||||
state_snapshot_commit(&state);
|
||||
} else if (operation == OPERATION_DRY) {
|
||||
state_read(&state);
|
||||
|
||||
|
|
@ -1929,6 +1938,8 @@ int snapraid_main(int argc, char* argv[])
|
|||
/* intercept signals while operating */
|
||||
signal_init();
|
||||
|
||||
state_snapshot_read(&state);
|
||||
|
||||
ret = state_scrub(&state, plan100, olderthan);
|
||||
} else if (operation == OPERATION_REWRITE) {
|
||||
state_read(&state);
|
||||
|
|
@ -2045,6 +2056,8 @@ int snapraid_main(int argc, char* argv[])
|
|||
/* intercept signals while operating */
|
||||
signal_init();
|
||||
|
||||
state_snapshot_write(&state, &filterlist_disk);
|
||||
|
||||
if (operation == OPERATION_CHECK) {
|
||||
ret = state_check(&state, 0, blockstart, blockcount);
|
||||
} else { /* it's fix */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue