From 7f5eaf9eec52497bfcdae9a803cc8bf7225ac016 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 28 Jan 2021 14:59:43 +0800 Subject: [PATCH] fix two small bugs --- src/tfs/src/tfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tfs/src/tfs.c b/src/tfs/src/tfs.c index 6fc96b0c0e..803cfa6d0e 100644 --- a/src/tfs/src/tfs.c +++ b/src/tfs/src/tfs.c @@ -153,10 +153,12 @@ void tfsGetMeta(SFSMeta *pMeta) { /* Allocate an existing available tier level */ void tfsAllocDisk(int expLevel, int *level, int *id) { + ASSERT(expLevel >= 0); + *level = expLevel; *id = TFS_UNDECIDED_ID; - if (*level > TFS_NLEVEL()) { + if (*level >= TFS_NLEVEL()) { *level = TFS_NLEVEL() - 1; } @@ -396,7 +398,7 @@ static int tfsMount(SDiskCfg *pCfg) { did.level = pCfg->level; pDisk = tfsMountDiskToTier(TFS_TIER_AT(did.level), pCfg); if (pDisk == NULL) { - fError("failed to mount disk %s to level %d since %s", pCfg->dir, pCfg->level, strerror(terrno)); + fError("failed to mount disk %s to level %d since %s", pCfg->dir, pCfg->level, tstrerror(terrno)); return -1; } did.id = DISK_ID(pDisk); -- GitLab