Describe the bug
OS_FileSysStatVolume_Impl() abstraction layer for posix, qnx, and rterms were updated to use statvfs() some time ago. However, statvfs() returns a new parameter f_frsize that relates to physical size and changed f_bsize to refer to the optimal transfer size.
They are NOT garanteed to be the same value! Yet the OS_FileSysStatVolume_Impl() abstraction layer for those OSs are still using f_bsize when returning block size.
i.e. For very large drives, f_frsize may be larger than f_bsize to represent the entire drive size.
To Reproduce
Steps to reproduce the behavior:
- Modify a OS if possible to have different size for f_frsize than f_bsize. This is likely necessary for very large TB drives.
- Run Test program to calculate the drive size and free space Bytese from the OS_statvfs_t information returned from OS_FileSysStatVolume().
- Compare the calculations the with the command prompt return. e.g. "df -h"
Expected behavior
block_size should be assigned to f_frsize
Code snips
Go to '/osal/src/os/{one of the os mentioned above}/src/os-impl-filesys.c'
Implemented
result->block_size = OSAL_SIZE_C(stat_buf.f_bsize);
result->blocks_free = OSAL_BLOCKCOUNT_C(stat_buf.f_bfree);
result->total_blocks = OSAL_BLOCKCOUNT_C(stat_buf.f_blocks);
should be
result->block_size = OSAL_SIZE_C(stat_buf.f_frsize);
result->blocks_free = OSAL_BLOCKCOUNT_C(stat_buf.f_bfree);
result->total_blocks = OSAL_BLOCKCOUNT_C(stat_buf.f_blocks);
System observed on:
- Hardware -
- OS: Oracle 8
- Draco 2.4
Additional context
return structure snipit
unsigned long f_bsize; /* Filesystem block size i.e. optimal transfer block size */
unsigned long f_frsize; /* Fragment size i.e. OS abstract physical block size (needs to be bigger to support larger drives)*/
fsblkcnt_t f_blocks; /* Size of FS drive in f_frsize units i.e. stat_buf.f_blocks = Drive size/stat_buf.f_frsize*/
fsblkcnt_t f_bfree; /* Number of free blocks in f_frsize units */
Reporter Info
Nathaniel Lynch CACI International/ ER611 - Gateway Flight Software
Describe the bug
OS_FileSysStatVolume_Impl() abstraction layer for posix, qnx, and rterms were updated to use statvfs() some time ago. However, statvfs() returns a new parameter f_frsize that relates to physical size and changed f_bsize to refer to the optimal transfer size.
They are NOT garanteed to be the same value! Yet the OS_FileSysStatVolume_Impl() abstraction layer for those OSs are still using f_bsize when returning block size.
i.e. For very large drives, f_frsize may be larger than f_bsize to represent the entire drive size.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
block_size should be assigned to f_frsize
Code snips
Go to '/osal/src/os/{one of the os mentioned above}/src/os-impl-filesys.c'
Implemented
should be
System observed on:
Additional context
return structure snipit
Reporter Info
Nathaniel Lynch CACI International/ ER611 - Gateway Flight Software