gavinchou commented on code in PR #53570:
URL: https://github.com/apache/doris/pull/53570#discussion_r2218635165
##########
be/src/io/cache/block_file_cache.cpp:
##########
@@ -1676,11 +1676,11 @@ int disk_used_percentage(const std::string& path,
std::pair<int, int>* percent)
// nonroot_total = stat.f_blocks - stat.f_bfree + stat.f_bavail
uintmax_t u100 = (stat.f_blocks - stat.f_bfree) * 100;
uintmax_t nonroot_total = stat.f_blocks - stat.f_bfree + stat.f_bavail;
- int capacity_percentage = u100 / nonroot_total + (u100 % nonroot_total !=
0);
+ int capacity_percentage = int(u100 / nonroot_total + (u100 % nonroot_total
!= 0));
unsigned long long inode_free = stat.f_ffree;
unsigned long long inode_total = stat.f_files;
- int inode_percentage = int(inode_free * 1.0 / inode_total * 100);
+ int inode_percentage = int((double)inode_free / (double)inode_total * 100);
Review Comment:
这里是不是全部用整数运算就行, 不用转来转去
(inode_free * 100) / inode_total
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]