提交 83234b0a 编写于 作者: H Hongze Cheng

more code

上级 17a27fa2
......@@ -33,6 +33,8 @@
#include "dnodeShell.h"
#include "dnodeTelemetry.h"
SDnodeTier *pDnodeTier = NULL;
static int32_t dnodeInitStorage();
static void dnodeCleanupStorage();
static void dnodeSetRunStatus(SDnodeRunStatus status);
......
......@@ -20,7 +20,7 @@
SDnodeTier *dnodeNewTier() { return NULL; }
void * dnodeCloseTier(SDnodeTier *pDnodeTier) { return NULL; }
int dnodeAddDisk(SDnodeTier *pDnodeTier, char *dir, int level) { return 0; }
int dnodeAddDisks(SDnodeTier *pDnodeTier, SDiskCfg *pDiskCfgs, int ndisks);
int dnodeUpdateTiersInfo(SDnodeTier *pDnodeTier) { return 0; }
int dnodeCheckTiers(SDnodeTier *pDnodeTier) { return 0; }
SDisk * dnodeAssignDisk(SDnodeTier *pDnodeTier, int level) { return NULL; }
......
......@@ -75,6 +75,12 @@ void dnodeSendStatusMsgToMnode();
#define DNODE_MAX_TIERS 3
#define DNODE_MAX_DISKS_PER_TIER 16
typedef struct {
char dir[TSDB_FILENAME_LEN];
int level;
int primary;
} SDiskCfg;
typedef struct {
int level;
int did;
......@@ -92,9 +98,9 @@ typedef struct {
} SDisk;
typedef struct {
int level;
int nDisks;
SDisk disks[DNODE_MAX_DISKS_PER_TIER];
int level;
int nDisks;
SDisk *disks[DNODE_MAX_DISKS_PER_TIER];
} STier;
typedef struct SDnodeTier {
......@@ -104,7 +110,7 @@ typedef struct SDnodeTier {
SHashObj * map;
} SDnodeTier;
#define DNODE_PRIMARY_DISK(pDnodeTier) (&(pDnodeTier)->tiers[0].disks[0])
#define DNODE_PRIMARY_DISK(pDnodeTier) (pDnodeTier)->tiers[0].disks[0]
static FORCE_INLINE int dnodeRLockTiers(SDnodeTier *pDnodeTier) {
int code = pthread_rwlock_rdlock(&(pDnodeTier->rwlock));
......@@ -138,12 +144,12 @@ static FORCE_INLINE SDisk *dnodeGetDisk(SDnodeTier *pDnodeTier, int level, int d
if (did < 0 || did >= pDnodeTier->tiers[level].nDisks) return NULL;
return &(pDnodeTier->tiers[level].disks[did]);
return pDnodeTier->tiers[level].disks[did];
}
SDnodeTier *dnodeNewTier();
void * dnodeCloseTier(SDnodeTier *pDnodeTier);
int dnodeAddDisk(SDnodeTier *pDnodeTier, char *dir, int level);
int dnodeAddDisks(SDnodeTier *pDnodeTier, SDiskCfg *pDiskCfgs, int ndisks);
int dnodeUpdateTiersInfo(SDnodeTier *pDnodeTier);
int dnodeCheckTiers(SDnodeTier *pDnodeTier);
SDisk * dnodeAssignDisk(SDnodeTier *pDnodeTier, int level);
......
......@@ -186,6 +186,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_DND_TOO_MANY_DISKS, 0, 0x0405, "Too many d
TAOS_DEFINE_ERROR(TSDB_CODE_DND_DISK_ALREADY_EXISTS, 0, 0x0406, "Disk already exists")
TAOS_DEFINE_ERROR(TSDB_CODE_DND_DISK_NOT_DIRECTORY, 0, 0x0407, "Disk is not a directory")
TAOS_DEFINE_ERROR(TSDB_CODE_DND_NO_DISK_SPACE, 0, 0x0408, "Dnode no disk space")
TAOS_DEFINE_ERROR(TSDB_CODE_DND_DUPLICATE_PRIMARY_DISK, 0, 0x0409, "Duplicate primary disk")
// vnode
TAOS_DEFINE_ERROR(TSDB_CODE_VND_ACTION_IN_PROGRESS, 0, 0x0500, "Action in progress")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册