mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-01 20:36:38 -05:00
Compare commits
8 commits
73b8ee9d29
...
836480951e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
836480951e | ||
|
|
b50332db54 | ||
|
|
6bfbc6e3b2 | ||
|
|
00e50bd965 | ||
|
|
10c327a558 | ||
|
|
4d09bffb94 | ||
|
|
b428cd80cc | ||
|
|
9d7dcdd479 |
3 changed files with 33 additions and 19 deletions
|
|
@ -2989,14 +2989,12 @@ static int devup(uint64_t device, const char* name, const char* wfile)
|
|||
|
||||
if (!CloseHandle(h)) {
|
||||
DWORD error = GetLastError();
|
||||
CloseHandle(h);
|
||||
VirtualFree(buffer, 0, MEM_RELEASE);
|
||||
windows_errno(error);
|
||||
log_tag("device:%s:%s:error:%lu\n", file, name, error);
|
||||
return -1;
|
||||
}
|
||||
|
||||
CloseHandle(h);
|
||||
VirtualFree(buffer, 0, MEM_RELEASE);
|
||||
|
||||
log_tag("attr:%s:%s:power:up\n", file, name);
|
||||
|
|
@ -3346,17 +3344,21 @@ int windows_key_create(windows_key_t* key, void (*destructor)(void*))
|
|||
return 0;
|
||||
}
|
||||
|
||||
int windows_key_delete(windows_key_t key)
|
||||
int windows_key_delete(windows_key_t void_key)
|
||||
{
|
||||
struct windows_key_context* context = key;
|
||||
struct windows_key_context* key = void_key;
|
||||
|
||||
/* remove from the list of destructors */
|
||||
if (context->func)
|
||||
tommy_list_remove_existing(&windows_key_list, &context->node);
|
||||
/* use the destructor for the local variable and remove from the list of destructors */
|
||||
if (key->func) {
|
||||
void* value = windows_getspecific(key);
|
||||
if (value)
|
||||
key->func(value);
|
||||
tommy_list_remove_existing(&windows_key_list, &key->node);
|
||||
}
|
||||
|
||||
TlsFree(context->key);
|
||||
TlsFree(key->key);
|
||||
|
||||
free(context);
|
||||
free(key);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -310,9 +310,7 @@ static void state_config_check(struct snapraid_state* state, const char* path, t
|
|||
}
|
||||
}
|
||||
|
||||
/* skip data disks that are not accessible */
|
||||
if (disk->skip_access)
|
||||
continue;
|
||||
|
||||
|
||||
if (!state->opt.skip_parity_access) {
|
||||
for (l = 0; l < state->level; ++l) {
|
||||
|
|
@ -724,10 +722,9 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
|
|||
pathimport(device, sizeof(device), split_map[s]);
|
||||
slash = strrchr(device, '/');
|
||||
if (slash)
|
||||
*slash = 0;
|
||||
slash[1] = 0;
|
||||
else
|
||||
pathcpy(device, sizeof(device), ".");
|
||||
|
||||
if (stat(device, &st) == 0) {
|
||||
dev = st.st_dev;
|
||||
|
||||
|
|
@ -877,7 +874,7 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
|
|||
pathimport(device, sizeof(device), buffer);
|
||||
slash = strrchr(device, '/');
|
||||
if (slash)
|
||||
*(slash + 1) = 0;
|
||||
slash[1] = 0;
|
||||
else
|
||||
pathcpy(device, sizeof(device), ".");
|
||||
if (stat(device, &st) == 0) {
|
||||
|
|
@ -1802,6 +1799,9 @@ void state_refresh(struct snapraid_state* state)
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (disk->skip_access)
|
||||
continue;
|
||||
|
||||
ret = fsinfo(disk->dir, 0, 0, &total_space, &free_space, disk->fstype, sizeof(disk->fstype), disk->fslabel, sizeof(disk->fslabel));
|
||||
if (ret != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
|
|
@ -1828,6 +1828,9 @@ void state_refresh(struct snapraid_state* state)
|
|||
state->parity[l].total_blocks = 0;
|
||||
state->parity[l].free_blocks = 0;
|
||||
|
||||
if (state->parity[l].skip_access)
|
||||
continue;
|
||||
|
||||
for (s = 0; s < state->parity[l].split_mac; ++s) {
|
||||
struct snapraid_split* split = &state->parity[l].split_map[s];
|
||||
uint64_t total_space;
|
||||
|
|
@ -3084,6 +3087,14 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (v_split_mac > SPLIT_MAX) {
|
||||
/* LCOV_EXCL_START */
|
||||
decoding_error(path, f);
|
||||
log_fatal(ECONTENT, "Too many splits '%u' in the content file!\n", v_split_mac);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (v_level >= LEV_MAX) {
|
||||
/* LCOV_EXCL_START */
|
||||
decoding_error(path, f);
|
||||
|
|
@ -4537,9 +4548,9 @@ static void state_rename_content(struct snapraid_state* state)
|
|||
|
||||
pathcpy(dir, sizeof(dir), content->content);
|
||||
|
||||
slash = strrchr(tmp, '/');
|
||||
slash = strrchr(dir, '/');
|
||||
if (slash)
|
||||
*slash = 0;
|
||||
slash[1] = 0;
|
||||
else
|
||||
pathcpy(dir, sizeof(dir), ".");
|
||||
|
||||
|
|
@ -5244,7 +5255,7 @@ int state_progress(struct snapraid_state* state, struct snapraid_io* io, block_o
|
|||
str_cpu[0] = 0;
|
||||
}
|
||||
if (out_temperature) {
|
||||
snprintf(str_temp, sizeof(str_eta), "%u", out_temperature);
|
||||
snprintf(str_temp, sizeof(str_temp), "%u", out_temperature);
|
||||
} else {
|
||||
str_temp[0] = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2101,7 +2101,8 @@ static int devup(dev_t device, const char* name)
|
|||
}
|
||||
|
||||
/* select a random offset */
|
||||
offset = (random_u64() % (size / 4096)) * 4096;
|
||||
uint64_t blocks = size / 4096;
|
||||
offset = blocks > 0 ? (random_u64() % blocks) * 4096 : 0;
|
||||
|
||||
#if HAVE_POSIX_FADVISE
|
||||
/* clear cache */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue