Stores the free space in the content file.

This avoids the need to access data and parity disks in
the status command.
Also removed some data disk access, in list, dup and similar
commands that don't need to scan the disks.
This commit is contained in:
Andrea Mazzoleni 2014-11-09 19:14:29 +01:00
parent 8ee1131bed
commit 7e9a5e6a6d
12 changed files with 519 additions and 128 deletions

View file

@ -82,6 +82,7 @@ struct snapraid_option {
int skip_self; /**< Skip the self-test. */
int skip_content_check; /**< Relax some content file checks. */
int skip_parity_access; /**< Skip the parity access for commands that don't need it. */
int skip_disk_access; /**< Skip the data disk access for commands that don't need it. */
int kill_after_sync; /**< Kill the process after sync without saving the final state. */
int force_murmur3; /**< Force Murmur3 choice. */
int force_spooky2; /**< Force Spooky2 choice. */
@ -140,11 +141,6 @@ struct snapraid_state {
*/
uint64_t tick_io;
/**
* Cumulative time used for parity disks.
*/
uint64_t tick_parity[LEV_MAX];
/**
* Last time used for time measure.
*/
@ -263,6 +259,13 @@ void state_list(struct snapraid_state* state);
*/
void state_pool(struct snapraid_state* state);
/**
* Refresh the free space info.
*
* Note that it requires disks access.
*/
void state_refresh(struct snapraid_state* state);
/**
* Filter files, symlinks and dirs.
* Apply an additional filter to the list currently loaded.
@ -344,7 +347,7 @@ static inline void state_usage_parity(struct snapraid_state* state, unsigned lev
assert(level < LEV_MAX);
/* increment the time spent in the parity disk */
state->tick_parity[level] += delta;
state->parity[level].tick += delta;
state->tick_io += delta;
state->tick_last = now;