When I deployed a set of recording at the customer's site yesterday, I encountered a small problem and recorded it.
After the system is started, the following logs are generated:
Statfs error. strPath:/figure/datafile/recordfile5/FullRecord/StreamTS/1-1-Oriental TV, Value too large for defined data type RepeatCount = 34
The query results are as follows:
(1) our system has enabled a thread to continuously scan the usage of the system disk. The system calls statfs ();
Struct statfs {
Long f_type;/* type of file system (see below )*/
Long f_bsize;/* optimal transfer block size */
Long f_blocks;/* total data blocks in file system */
Long f_bfree;/* free blocks in fs */
Long f_bavail;/* free blocks avail to unprivileged user */
Long f_files;/* total file nodes in file system */
Long f_ffree;/* free file nodes in fs */
Fsid_t f_fsid;/* file system id */
Long f_namelen;/* maximum length of filenames */
};
(2) On-site use of NAS with a capacity of 35 TB;
(3) If each block on a disk is 4 k, there are a total of 9395240960 blocks;
(4) On the target platform, sizeof (long) = sizeof (int) = 4 bytes, and the maximum number that can be expressed is: 4294967296
(5) When statfs is called, the call will fail due to overflow.
The final solution is to use 64-bit statfs64.
Struct statfs64 fs;
If (statfs64 (strPath. c_str (), & fs) <0)
{
LOG_PERIOD (LOG_TYPE_WARN, "statfs error. strPath: % s, % s", strPath. c_str (), strerror (errno ));
Return 100;
}