This commit is contained in:
Hongze Cheng 2020-11-23 03:38:05 +00:00
parent f2253189b7
commit dde486998c
5 changed files with 9 additions and 6 deletions

View File

@ -186,7 +186,7 @@ static int32_t dnodeInitStorage() {
dError("failed to init TFS since %s", tstrerror(terrno)); dError("failed to init TFS since %s", tstrerror(terrno));
return -1; return -1;
} }
tfsPrimaryPath(tsDataDir); snprintf(tsDataDir, tfsPrimaryPath(), TSDB_FILENAME_LEN);
sprintf(tsMnodeDir, "%s/mnode", tsDataDir); sprintf(tsMnodeDir, "%s/mnode", tsDataDir);
sprintf(tsVnodeDir, "%s/vnode", tsDataDir); sprintf(tsVnodeDir, "%s/vnode", tsDataDir);
sprintf(tsDnodeDir, "%s/dnode", tsDataDir); sprintf(tsDnodeDir, "%s/dnode", tsDataDir);

View File

@ -31,11 +31,12 @@ typedef struct {
int tfsInit(SDiskCfg *pDiskCfg, int ndisk); int tfsInit(SDiskCfg *pDiskCfg, int ndisk);
void tfsDestroy(); void tfsDestroy();
int tfsUpdateInfo(); int tfsUpdateInfo();
void tfsPrimaryPath(char *dst);
int tfsCreateDir(char *dirname); int tfsCreateDir(char *dirname);
int tfsRemoveDir(char *dirname); int tfsRemoveDir(char *dirname);
int tfsRename(char *oldpath, char *newpath); int tfsRename(char *oldpath, char *newpath);
const char *tfsPrimaryPath();
// tfcntl.c // tfcntl.c
typedef struct TFSFILE TFSFILE; typedef struct TFSFILE TFSFILE;
typedef struct TFSDIR TFSDIR; typedef struct TFSDIR TFSDIR;

View File

@ -35,6 +35,8 @@ SDisk *tfsNewDisk(int level, int id, char *dir);
void tfsFreeDisk(SDisk *pDisk); void tfsFreeDisk(SDisk *pDisk);
int tfsUpdateDiskInfo(SDisk *pDisk); int tfsUpdateDiskInfo(SDisk *pDisk);
const char *tfsDiskDir(SDisk *pDisk);
// ttier.c // ttier.c
typedef struct STier STier; typedef struct STier STier;

View File

@ -63,4 +63,6 @@ int tfsUpdateDiskInfo(SDisk *pDisk) {
pDisk->dmeta.free = dstat.avail; pDisk->dmeta.free = dstat.avail;
return 0; return 0;
} }
const char *tfsDiskDir(SDisk *pDisk) { return pDisk->dir; }

View File

@ -100,9 +100,7 @@ int tfsUpdateInfo() {
tfsUnLock(); tfsUnLock();
} }
void tfsPrimaryPath(char *dst) { const char *tfsPrimaryPath() { return tfsDiskDir(DISK_AT(0, 0)); }
strncpy(dst, DISK_AT(0, 0)->dir, TSDB_FILENAME_LEN);
}
int tfsCreateDir(char *dirname) { int tfsCreateDir(char *dirname) {
char dirName[TSDB_FILENAME_LEN] = "\0"; char dirName[TSDB_FILENAME_LEN] = "\0";