提交 e4829090 编写于 作者: H Hongze Cheng

fix disk update problem

上级 584b147f
...@@ -41,8 +41,9 @@ SDisk *tfsFreeDisk(SDisk *pDisk) { ...@@ -41,8 +41,9 @@ SDisk *tfsFreeDisk(SDisk *pDisk) {
int tfsUpdateDiskInfo(SDisk *pDisk) { int tfsUpdateDiskInfo(SDisk *pDisk) {
ASSERT(pDisk != NULL); ASSERT(pDisk != NULL);
SysDiskSize dstat;
if (taosGetDiskSize(pDisk->dir, &dstat) < 0) { struct statvfs dstat;
if (statvfs(pDisk->dir, &dstat) < 0) {
fError("failed to update disk information at level %d id %d dir %s since %s", pDisk->level, pDisk->id, pDisk->dir, fError("failed to update disk information at level %d id %d dir %s since %s", pDisk->level, pDisk->id, pDisk->dir,
strerror(errno)); strerror(errno));
terrno = TAOS_SYSTEM_ERROR(errno); terrno = TAOS_SYSTEM_ERROR(errno);
...@@ -50,8 +51,8 @@ int tfsUpdateDiskInfo(SDisk *pDisk) { ...@@ -50,8 +51,8 @@ int tfsUpdateDiskInfo(SDisk *pDisk) {
pDisk->dmeta.free = 0; pDisk->dmeta.free = 0;
return -1; return -1;
} else { } else {
pDisk->dmeta.size = dstat.tsize; pDisk->dmeta.size = dstat.f_blocks * dstat.f_frsize;
pDisk->dmeta.free = dstat.avail; pDisk->dmeta.free = dstat.f_bavail * dstat.f_frsize;
return 0; return 0;
} }
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册