Created
January 7, 2015 23:28
-
-
Save tuxillo/1cfd1c911b0a401e3ba4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/sbin/hammer/cmd_dedup.c b/sbin/hammer/cmd_dedup.c | |
index 5b4d43d..288020f 100644 | |
--- a/sbin/hammer/cmd_dedup.c | |
+++ b/sbin/hammer/cmd_dedup.c | |
@@ -101,6 +101,7 @@ struct pass2_dedup_entry { | |
#define DEDUP_PASS2 0x0001 /* process_btree_elm() mode */ | |
static int SigInfoFlag; | |
+static int SigAlrmFlag; | |
static int64_t DedupDataReads; | |
static int64_t DedupCurrentRecords; | |
static int64_t DedupTotalRecords; | |
@@ -814,6 +815,12 @@ done: | |
} | |
static void | |
+sigAlrm(int signo __unused) | |
+{ | |
+ SigAlrmFlag = 1; | |
+} | |
+ | |
+static void | |
sigInfo(int signo __unused) | |
{ | |
SigInfoFlag = 1; | |
@@ -834,9 +841,14 @@ scan_pfs(char *filesystem, scan_pfs_cb_t func, const char *id) | |
DedupDataReads = 0; | |
DedupCurrentRecords = 0; | |
signal(SIGINFO, sigInfo); | |
+ signal(SIGALRM, sigAlrm); | |
bzero(&mirror, sizeof(mirror)); | |
hammer_key_beg_init(&mirror.key_beg); | |
+ | |
+ if (CyclePath) | |
+ hammer_get_cycle(&mirror.key_beg, &mirror.tid_beg); | |
+ | |
hammer_key_end_init(&mirror.key_end); | |
mirror.tid_beg = glob_pfs.ondisk->sync_beg_tid; | |
@@ -905,8 +917,16 @@ scan_pfs(char *filesystem, scan_pfs_cb_t func, const char *id) | |
} | |
} | |
mirror.key_beg = mirror.key_cur; | |
- if (DidInterrupt) { | |
- fprintf(stderr, "Interrupted\n"); | |
+ if (DidInterrupt || SigAlrmFlag) { | |
+ fprintf(stderr, "%s\n", | |
+ (DidInterrupt ? "Interrupted" : "Timed out")); | |
+ if (CyclePath) { | |
+ hammer_set_cycle(&mirror.key_cur, | |
+ mirror.tid_beg); | |
+ if (VerboseOpt) | |
+ fprintf(stderr, "Cyclefile %s updated for " | |
+ "continuation\n", CyclePath); | |
+ } | |
exit(1); | |
} | |
if (SigInfoFlag) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment