mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Compare commits
4 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7df9d2772c | ||
|
|
765c9bf73a | ||
|
|
745c51e8e5 | ||
|
|
71355c563b |
4 changed files with 32 additions and 32 deletions
|
|
@ -289,7 +289,7 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par
|
|||
if (handle[j].st.st_size != block_file_get(block)->size
|
||||
|| handle[j].st.st_mtime != block_file_get(block)->mtime_sec
|
||||
|| STAT_NSEC(&handle[j].st) != block_file_get(block)->mtime_nsec
|
||||
|| handle[j].st.st_ino != block_file_get(block)->inode
|
||||
/* don't check the inode to support filesystem without persistent inodes */
|
||||
) {
|
||||
/* report that the block and the file are not synced */
|
||||
block_is_unsynced = 1;
|
||||
|
|
|
|||
|
|
@ -4693,6 +4693,7 @@ int state_progress(struct snapraid_state* state, block_off_t blockpos, block_off
|
|||
) {
|
||||
uint64_t tick_total;
|
||||
uint64_t tick_cpu;
|
||||
time_t elapsed;
|
||||
unsigned out_perc = 0;
|
||||
unsigned out_speed = 0;
|
||||
unsigned out_cpu = 0;
|
||||
|
|
@ -4700,6 +4701,7 @@ int state_progress(struct snapraid_state* state, block_off_t blockpos, block_off
|
|||
|
||||
tick_total = state->tick_cpu + state->tick_io;
|
||||
tick_cpu = state->tick_cpu;
|
||||
elapsed = now - state->progress_whole_start - state->progress_wasted;
|
||||
|
||||
/* completion percentage */
|
||||
if (countmax)
|
||||
|
|
@ -4757,7 +4759,7 @@ int state_progress(struct snapraid_state* state, block_off_t blockpos, block_off
|
|||
}
|
||||
|
||||
if (state->opt.gui) {
|
||||
fprintf(stdlog, "run:pos:%u:%u:%" PRIu64 ":%u:%u:%u:%u\n", blockpos, countpos, countsize, out_perc, out_eta, out_speed, out_cpu);
|
||||
fprintf(stdlog, "run:pos:%u:%u:%" PRIu64 ":%u:%u:%u:%u:%" PRIu64 "\n", blockpos, countpos, countsize, out_perc, out_eta, out_speed, out_cpu, (uint64_t)elapsed);
|
||||
fflush(stdlog);
|
||||
} else {
|
||||
printf("%u%%, %u MiB", out_perc, (unsigned)(countsize / (1024 * 1024)));
|
||||
|
|
|
|||
|
|
@ -1437,14 +1437,21 @@ size_t malloc_counter(void)
|
|||
return mcounter;
|
||||
}
|
||||
|
||||
static int malloc_printn(int f, size_t value)
|
||||
static ssize_t malloc_print(int f, const char* str)
|
||||
{
|
||||
ssize_t len = 0;
|
||||
while (str[len])
|
||||
++len;
|
||||
return write(f, str, len);
|
||||
}
|
||||
|
||||
static ssize_t malloc_printn(int f, size_t value)
|
||||
{
|
||||
char buf[32];
|
||||
int i;
|
||||
|
||||
if (!value) {
|
||||
if (!value)
|
||||
return write(f, "0", 1);
|
||||
}
|
||||
|
||||
i = sizeof(buf);
|
||||
while (value) {
|
||||
|
|
@ -1461,20 +1468,17 @@ static void malloc_fail(size_t size)
|
|||
/* LCOV_EXCL_START */
|
||||
int f = 2; /* stderr */
|
||||
|
||||
if (write(f, "Low Memory\n", 11) < 0)
|
||||
return;
|
||||
if (write(f, "Allocating ", 11) < 0)
|
||||
return;
|
||||
if (malloc_printn(f, size) < 0)
|
||||
return;
|
||||
if (write(f, " bytes\n", 7) < 0)
|
||||
return;
|
||||
if (write(f, "Allocated ", 10) < 0)
|
||||
return;
|
||||
if (malloc_printn(f, malloc_counter()) < 0)
|
||||
return;
|
||||
if (write(f, " bytes\n", 7) < 0)
|
||||
return;
|
||||
malloc_print(f, "Failed for Low Memory!\n");
|
||||
malloc_print(f, "Allocating ");
|
||||
malloc_printn(f, size);
|
||||
malloc_print(f, " bytes.\n");
|
||||
malloc_print(f, "Already allocated ");
|
||||
malloc_printn(f, malloc_counter());
|
||||
malloc_print(f, " bytes.\n");
|
||||
if (sizeof(void*) == 4) {
|
||||
malloc_print(f, "You are currently using a 32 bits executable.\n");
|
||||
malloc_print(f, "If you have more than 4GB of memory, please upgrade to a 64 bits one.\n");
|
||||
}
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
|
|
@ -1558,10 +1562,7 @@ void* malloc_nofail_align(size_t size, void** freeptr)
|
|||
|
||||
if (!ptr) {
|
||||
/* LCOV_EXCL_START */
|
||||
/* don't use printf to avoid any possible extra allocation */
|
||||
if (write(2, "Low Memory\n", 11) != 11) {
|
||||
/* ignore error */
|
||||
}
|
||||
malloc_fail(size);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
@ -1577,10 +1578,7 @@ void** malloc_nofail_vector_align(int nd, int n, size_t size, void** freeptr)
|
|||
|
||||
if (!ptr) {
|
||||
/* LCOV_EXCL_START */
|
||||
/* don't use printf to avoid any possible extra allocation */
|
||||
if (write(2, "Low Memory\n", 11) != 11) {
|
||||
/* ignore error */
|
||||
}
|
||||
malloc_fail(n * size);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
@ -1593,7 +1591,7 @@ void mtest_vector(int n, size_t size, void** vv)
|
|||
if (raid_mtest_vector(n, size, vv) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
fprintf(stderr, "DANGER! Your RAM memory is broken! DO NOT PROCEED UNTIL FIXED!\n");
|
||||
fprintf(stderr, "Try running some memory test like http://www.memtest86.com/\n");
|
||||
fprintf(stderr, "Try running a memory test like http://www.memtest86.com/\n");
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,11 +84,11 @@ static void tommy_hashdyn_resize(tommy_hashdyn* hashdyn, tommy_count_t new_bucke
|
|||
j = hashdyn->bucket[i];
|
||||
while (j) {
|
||||
tommy_hashdyn_node* j_next = j->next;
|
||||
tommy_count_t index = j->key & new_bucket_mask;
|
||||
if (new_bucket[index])
|
||||
tommy_list_insert_tail_not_empty(new_bucket[index], j);
|
||||
tommy_count_t pos = j->key & new_bucket_mask;
|
||||
if (new_bucket[pos])
|
||||
tommy_list_insert_tail_not_empty(new_bucket[pos], j);
|
||||
else
|
||||
tommy_list_insert_first(&new_bucket[index], j);
|
||||
tommy_list_insert_first(&new_bucket[pos], j);
|
||||
j = j_next;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue