enh: return value process

This commit is contained in:
kailixu 2024-09-20 11:54:52 +08:00
parent a49c7a84eb
commit f7a24d2351
2 changed files with 15 additions and 15 deletions

View File

@ -96,15 +96,15 @@ void tfsUpdateSize(STfs *pTfs) {
size.used += pTier->size.used; size.used += pTier->size.used;
} }
(void)tfsLock(pTfs); TAOS_UNUSED(tfsLock(pTfs));
pTfs->size = size; pTfs->size = size;
(void)tfsUnLock(pTfs); TAOS_UNUSED(tfsUnLock(pTfs));
} }
SDiskSize tfsGetSize(STfs *pTfs) { SDiskSize tfsGetSize(STfs *pTfs) {
(void)tfsLock(pTfs); TAOS_UNUSED(tfsLock(pTfs));
SDiskSize size = pTfs->size; SDiskSize size = pTfs->size;
(void)tfsUnLock(pTfs); TAOS_UNUSED(tfsUnLock(pTfs));
return size; return size;
} }
@ -204,8 +204,8 @@ bool tfsIsSameFile(const STfsFile *pFile1, const STfsFile *pFile2) {
(void)strncpy(nameBuf2, pFile2->rname, TMPNAME_LEN); (void)strncpy(nameBuf2, pFile2->rname, TMPNAME_LEN);
nameBuf1[TMPNAME_LEN - 1] = 0; nameBuf1[TMPNAME_LEN - 1] = 0;
nameBuf2[TMPNAME_LEN - 1] = 0; nameBuf2[TMPNAME_LEN - 1] = 0;
(void)taosRealPath(nameBuf1, NULL, TMPNAME_LEN); TAOS_UNUSED(taosRealPath(nameBuf1, NULL, TMPNAME_LEN));
(void)taosRealPath(nameBuf2, NULL, TMPNAME_LEN); TAOS_UNUSED(taosRealPath(nameBuf2, NULL, TMPNAME_LEN));
if (strncmp(nameBuf1, nameBuf2, TMPNAME_LEN) != 0) return false; if (strncmp(nameBuf1, nameBuf2, TMPNAME_LEN) != 0) return false;
return true; return true;
} }
@ -483,7 +483,7 @@ const STfsFile *tfsReaddir(STfsDir *pTfsDir) {
void tfsClosedir(STfsDir *pTfsDir) { void tfsClosedir(STfsDir *pTfsDir) {
if (pTfsDir) { if (pTfsDir) {
if (pTfsDir->pDir != NULL) { if (pTfsDir->pDir != NULL) {
(void)taosCloseDir(&pTfsDir->pDir); TAOS_UNUSED(taosCloseDir(&pTfsDir->pDir));
pTfsDir->pDir = NULL; pTfsDir->pDir = NULL;
} }
taosMemoryFree(pTfsDir); taosMemoryFree(pTfsDir);
@ -698,7 +698,7 @@ int32_t tfsGetMonitorInfo(STfs *pTfs, SMonDiskInfo *pInfo) {
tfsUpdateSize(pTfs); tfsUpdateSize(pTfs);
(void)tfsLock(pTfs); TAOS_UNUSED(tfsLock(pTfs));
for (int32_t level = 0; level < pTfs->nlevel; level++) { for (int32_t level = 0; level < pTfs->nlevel; level++) {
STfsTier *pTier = &pTfs->tiers[level]; STfsTier *pTier = &pTfs->tiers[level];
for (int32_t disk = 0; disk < pTier->ndisk; ++disk) { for (int32_t disk = 0; disk < pTier->ndisk; ++disk) {
@ -708,14 +708,14 @@ int32_t tfsGetMonitorInfo(STfs *pTfs, SMonDiskInfo *pInfo) {
dinfo.level = pDisk->level; dinfo.level = pDisk->level;
tstrncpy(dinfo.name, pDisk->path, sizeof(dinfo.name)); tstrncpy(dinfo.name, pDisk->path, sizeof(dinfo.name));
if (taosArrayPush(pInfo->datadirs, &dinfo) == NULL) { if (taosArrayPush(pInfo->datadirs, &dinfo) == NULL) {
(void)tfsUnLock(pTfs); TAOS_UNUSED(tfsUnLock(pTfs));
taosArrayDestroy(pInfo->datadirs); taosArrayDestroy(pInfo->datadirs);
pInfo->datadirs = NULL; pInfo->datadirs = NULL;
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
} }
} }
} }
(void)tfsUnLock(pTfs); TAOS_UNUSED(tfsUnLock(pTfs));
TAOS_RETURN(0); TAOS_RETURN(0);
} }

View File

@ -88,7 +88,7 @@ void tfsUpdateTierSize(STfsTier *pTier) {
SDiskSize size = {0}; SDiskSize size = {0};
int32_t nAvailDisks = 0; int32_t nAvailDisks = 0;
(void)tfsLockTier(pTier); TAOS_UNUSED(tfsLockTier(pTier));
for (int32_t id = 0; id < pTier->ndisk; id++) { for (int32_t id = 0; id < pTier->ndisk; id++) {
STfsDisk *pDisk = pTier->disks[id]; STfsDisk *pDisk = pTier->disks[id];
@ -104,15 +104,15 @@ void tfsUpdateTierSize(STfsTier *pTier) {
pTier->size = size; pTier->size = size;
pTier->nAvailDisks = nAvailDisks; pTier->nAvailDisks = nAvailDisks;
(void)tfsUnLockTier(pTier); TAOS_UNUSED(tfsUnLockTier(pTier));
} }
// Round-Robin to allocate disk on a tier // Round-Robin to allocate disk on a tier
int32_t tfsAllocDiskOnTier(STfsTier *pTier) { int32_t tfsAllocDiskOnTier(STfsTier *pTier) {
(void)tfsLockTier(pTier); TAOS_UNUSED(tfsLockTier(pTier));
if (pTier->ndisk <= 0 || pTier->nAvailDisks <= 0) { if (pTier->ndisk <= 0 || pTier->nAvailDisks <= 0) {
(void)tfsUnLockTier(pTier); TAOS_UNUSED(tfsUnLockTier(pTier));
TAOS_RETURN(TSDB_CODE_FS_NO_VALID_DISK); TAOS_RETURN(TSDB_CODE_FS_NO_VALID_DISK);
} }
@ -155,7 +155,7 @@ int32_t tfsAllocDiskOnTier(STfsTier *pTier) {
#endif #endif
} }
(void)tfsUnLockTier(pTier); TAOS_UNUSED(tfsUnLockTier(pTier));
if (retId < 0) { if (retId < 0) {
TAOS_RETURN(TSDB_CODE_FS_NO_VALID_DISK); TAOS_RETURN(TSDB_CODE_FS_NO_VALID_DISK);
} }