mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-28 19:06:42 -05:00
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:
parent
8ee1131bed
commit
7e9a5e6a6d
12 changed files with 519 additions and 128 deletions
|
|
@ -205,7 +205,7 @@ int filephy(const char* path, uint64_t size, uint64_t* physical)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int fsinfo(const char* path, int* has_persistent_inode, uint64_t* free_space)
|
||||
int fsinfo(const char* path, int* has_persistent_inode, uint64_t* total_space, uint64_t* free_space)
|
||||
{
|
||||
#if HAVE_STATFS && HAVE_STRUCT_STATFS_F_TYPE
|
||||
struct statfs st;
|
||||
|
|
@ -249,6 +249,8 @@ int fsinfo(const char* path, int* has_persistent_inode, uint64_t* free_space)
|
|||
break;
|
||||
}
|
||||
|
||||
if (total_space)
|
||||
*total_space = st.f_bsize * (uint64_t)st.f_blocks;
|
||||
if (free_space)
|
||||
*free_space = st.f_bsize * (uint64_t)st.f_bfree;
|
||||
#else
|
||||
|
|
@ -257,6 +259,8 @@ int fsinfo(const char* path, int* has_persistent_inode, uint64_t* free_space)
|
|||
/* by default assume yes */
|
||||
if (has_persistent_inode)
|
||||
*has_persistent_inode = 1;
|
||||
if (total_space)
|
||||
*total_space = 0;
|
||||
if (free_space)
|
||||
*free_space = 0;
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue