diff options
author | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2017-01-25 16:09:12 +0530 |
---|---|---|
committer | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2017-01-30 19:31:50 +0530 |
commit | d65f7b890a2554c9e3d0cafdb58ac257d4f26ab3 (patch) | |
tree | 32fb92ab62279ea56e1ada3d496b950d467b4cbc /glfs-operations.h | |
parent | b58e4765ed7e232f638ceb764b8ef1210bb43ff9 (diff) |
gluster-blockd: implement transaction framework
This patch introduce the transaction locking also, start maintaining
meta data journaling per block
Every request is follows transaction, at the start of any transaction
we take blocking lock on "/block-meta/meta.lock" file and at the end
we unlock.
Meanwhile while, when the transaction is in progress we do
journaling, while performing series of operations, used for future
purposes and roll backing.
A sample journal file looks like:
$ cat /mnt/block-meta/LUN1
GBID: xyz-abc
SIZE : 5GiB
HA: 3
ENTRYCREATE: INPROGRESS
ENTRYCREATE: SUCCESS
NODE1: INPROGRESS
NODE2: INPROGRESS
NODE3: INPROGRESS
NODE2: SUCCESS
NODE3: FAIL
NODE1: SUCCESS
NODE4: INPROGRESS
NODE4: SUCCESS
NODE3: CLEANUPSUCCESS
<EOF>
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Diffstat (limited to 'glfs-operations.h')
-rw-r--r-- | glfs-operations.h | 55 |
1 files changed, 46 insertions, 9 deletions
diff --git a/glfs-operations.h b/glfs-operations.h index ceadcd7..8fe1bd6 100644 --- a/glfs-operations.h +++ b/glfs-operations.h @@ -22,19 +22,56 @@ # include "rpc/block.h" +typedef enum Metakey { + GBID = 0, + SIZE = 1, + HA = 2, + ENTRYCREATE = 3, -typedef struct glusterBlockDef { - char *volume; - char *host; /* TODO: use proper Transport Object */ - char *filename; + METAKEY__MAX = 4 /* Updata this when add new Key */ +} Metakey; + + +typedef struct NodeInfo { + char addr[255]; + char status[16]; +} NodeInfo; + +typedef struct MetaInfo { + char gbid[38]; size_t size; - bool status; -} glusterBlockDef; -typedef glusterBlockDef *glusterBlockDefPtr; + size_t mpath; + char entry[16]; + + size_t nhosts; + NodeInfo **list; +} MetaInfo; + +static const char *const MetakeyLookup[] = { + [GBID] = "GBID", + [SIZE] = "SIZE", + [HA] = "HA", + [ENTRYCREATE] = "ENTRYCREATE", + [METAKEY__MAX] = NULL, +}; + + +struct glfs * +glusterBlockVolumeInit(char *volume, char *volfileserver); + +int +glusterBlockCreateEntry(blockCreateCli *blk, char *gbid); + +int +glusterBlockDeleteEntry(blockCreate *blk); +struct glfs_fd * +glusterBlockCreateMetaLockFile(struct glfs *glfs); -int glusterBlockCreateEntry(blockCreateCli *blk, char *gbid); +void +blockGetMetaInfo(struct glfs *glfs, char *metafile, MetaInfo *info); -int glusterBlockDeleteEntry(blockCreate *blk); +void +blockFreeMetaInfo(MetaInfo *info); #endif /* _GLFS_OPERATIONS_H */ |