enh: return value process
This commit is contained in:
parent
a49c7a84eb
commit
f7a24d2351
|
@ -96,15 +96,15 @@ void tfsUpdateSize(STfs *pTfs) {
|
|||
size.used += pTier->size.used;
|
||||
}
|
||||
|
||||
(void)tfsLock(pTfs);
|
||||
TAOS_UNUSED(tfsLock(pTfs));
|
||||
pTfs->size = size;
|
||||
(void)tfsUnLock(pTfs);
|
||||
TAOS_UNUSED(tfsUnLock(pTfs));
|
||||
}
|
||||
|
||||
SDiskSize tfsGetSize(STfs *pTfs) {
|
||||
(void)tfsLock(pTfs);
|
||||
TAOS_UNUSED(tfsLock(pTfs));
|
||||
SDiskSize size = pTfs->size;
|
||||
(void)tfsUnLock(pTfs);
|
||||
TAOS_UNUSED(tfsUnLock(pTfs));
|
||||
|
||||
return size;
|
||||
}
|
||||
|
@ -204,8 +204,8 @@ bool tfsIsSameFile(const STfsFile *pFile1, const STfsFile *pFile2) {
|
|||
(void)strncpy(nameBuf2, pFile2->rname, TMPNAME_LEN);
|
||||
nameBuf1[TMPNAME_LEN - 1] = 0;
|
||||
nameBuf2[TMPNAME_LEN - 1] = 0;
|
||||
(void)taosRealPath(nameBuf1, NULL, TMPNAME_LEN);
|
||||
(void)taosRealPath(nameBuf2, NULL, TMPNAME_LEN);
|
||||
TAOS_UNUSED(taosRealPath(nameBuf1, NULL, TMPNAME_LEN));
|
||||
TAOS_UNUSED(taosRealPath(nameBuf2, NULL, TMPNAME_LEN));
|
||||
if (strncmp(nameBuf1, nameBuf2, TMPNAME_LEN) != 0) return false;
|
||||
return true;
|
||||
}
|
||||
|
@ -483,7 +483,7 @@ const STfsFile *tfsReaddir(STfsDir *pTfsDir) {
|
|||
void tfsClosedir(STfsDir *pTfsDir) {
|
||||
if (pTfsDir) {
|
||||
if (pTfsDir->pDir != NULL) {
|
||||
(void)taosCloseDir(&pTfsDir->pDir);
|
||||
TAOS_UNUSED(taosCloseDir(&pTfsDir->pDir));
|
||||
pTfsDir->pDir = NULL;
|
||||
}
|
||||
taosMemoryFree(pTfsDir);
|
||||
|
@ -698,7 +698,7 @@ int32_t tfsGetMonitorInfo(STfs *pTfs, SMonDiskInfo *pInfo) {
|
|||
|
||||
tfsUpdateSize(pTfs);
|
||||
|
||||
(void)tfsLock(pTfs);
|
||||
TAOS_UNUSED(tfsLock(pTfs));
|
||||
for (int32_t level = 0; level < pTfs->nlevel; level++) {
|
||||
STfsTier *pTier = &pTfs->tiers[level];
|
||||
for (int32_t disk = 0; disk < pTier->ndisk; ++disk) {
|
||||
|
@ -708,14 +708,14 @@ int32_t tfsGetMonitorInfo(STfs *pTfs, SMonDiskInfo *pInfo) {
|
|||
dinfo.level = pDisk->level;
|
||||
tstrncpy(dinfo.name, pDisk->path, sizeof(dinfo.name));
|
||||
if (taosArrayPush(pInfo->datadirs, &dinfo) == NULL) {
|
||||
(void)tfsUnLock(pTfs);
|
||||
TAOS_UNUSED(tfsUnLock(pTfs));
|
||||
taosArrayDestroy(pInfo->datadirs);
|
||||
pInfo->datadirs = NULL;
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
}
|
||||
}
|
||||
}
|
||||
(void)tfsUnLock(pTfs);
|
||||
TAOS_UNUSED(tfsUnLock(pTfs));
|
||||
|
||||
TAOS_RETURN(0);
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ void tfsUpdateTierSize(STfsTier *pTier) {
|
|||
SDiskSize size = {0};
|
||||
int32_t nAvailDisks = 0;
|
||||
|
||||
(void)tfsLockTier(pTier);
|
||||
TAOS_UNUSED(tfsLockTier(pTier));
|
||||
|
||||
for (int32_t id = 0; id < pTier->ndisk; id++) {
|
||||
STfsDisk *pDisk = pTier->disks[id];
|
||||
|
@ -104,15 +104,15 @@ void tfsUpdateTierSize(STfsTier *pTier) {
|
|||
pTier->size = size;
|
||||
pTier->nAvailDisks = nAvailDisks;
|
||||
|
||||
(void)tfsUnLockTier(pTier);
|
||||
TAOS_UNUSED(tfsUnLockTier(pTier));
|
||||
}
|
||||
|
||||
// Round-Robin to allocate disk on a tier
|
||||
int32_t tfsAllocDiskOnTier(STfsTier *pTier) {
|
||||
(void)tfsLockTier(pTier);
|
||||
TAOS_UNUSED(tfsLockTier(pTier));
|
||||
|
||||
if (pTier->ndisk <= 0 || pTier->nAvailDisks <= 0) {
|
||||
(void)tfsUnLockTier(pTier);
|
||||
TAOS_UNUSED(tfsUnLockTier(pTier));
|
||||
TAOS_RETURN(TSDB_CODE_FS_NO_VALID_DISK);
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ int32_t tfsAllocDiskOnTier(STfsTier *pTier) {
|
|||
#endif
|
||||
}
|
||||
|
||||
(void)tfsUnLockTier(pTier);
|
||||
TAOS_UNUSED(tfsUnLockTier(pTier));
|
||||
if (retId < 0) {
|
||||
TAOS_RETURN(TSDB_CODE_FS_NO_VALID_DISK);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue