diff options
author | Venky Shankar <vshankar@redhat.com> | 2014-02-13 12:09:46 +0530 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2014-03-12 13:59:37 +0000 |
commit | a58b023443b7a2ec089c45bf35bde2b0108aa19b (patch) | |
tree | e03704bf10d87e5ecac9cc8cf0fd1744743c22b2 /xlators/cluster | |
parent | 2a2a2ab2cb08a38f0bfb773900b5ef5babce856b (diff) |
features/changelog: NSR Journal changes
* Sequential updates to journal
* Journal update in the FOP path
* NSR specific format changes
TBD
---
* POST-OP record
Change-Id: I5b21b7624ccb095295a0c69abf00866e0d6cd818
Signed-off-by: Venky Shankar <vshankar@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r-- | xlators/cluster/nsr-recon/src/recon_xlator.c | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/xlators/cluster/nsr-recon/src/recon_xlator.c b/xlators/cluster/nsr-recon/src/recon_xlator.c index c58260cf0..da389fccf 100644 --- a/xlators/cluster/nsr-recon/src/recon_xlator.c +++ b/xlators/cluster/nsr-recon/src/recon_xlator.c @@ -277,6 +277,15 @@ get_link_using_gfid(nsr_recon_private_t *priv, char *gfid, char *path) // // Really, 90% of this code should just GO AWAY in favor of using // libgfchangelog, enhanced as necessary to support our needs. + +/* + * Use this macro to skip over a field we're not using yet. + * NB: the body is a null statement on purpose + * TBD: all instances of this should be removed eventually! + */ +#define SKIP_FIELD do /* nothing */ ; while (*(start++) != '\0') + +#define SKIP_OVER gf_boolean_t nsr_recon_libchangelog_get_records(xlator_t *this, char *bp, int32_t term, uint32_t first, uint32_t last, void *buf) { // do a mmap; seek into the first and read all records till last. @@ -315,21 +324,20 @@ gf_boolean_t nsr_recon_libchangelog_get_records(xlator_t *this, char *bp, int32_ "libchangelog_get_records start inspecting records at index %d \n", index ); if (!strncmp(start, "_PRE_", 5)) { - char op_str[4]; - uint32_t i=0, opcode = 0; + uint32_t i; + uint32_t opcode = 0; records_type_t type; start += 5; // increment by the NULLs after the PRE start += 4; + SKIP_FIELD; // real index // now we have the opcode - i = 0; - while (*start != 0) { - op_str[i++] = (*start); - start++; + while (*start != '\0') { + opcode *= 10; + opcode += (*(start++) - '0'); } - op_str[i] = '\0'; - opcode = strtoul(op_str, NULL, 10); + ++start; recon_main_log (this->name, GF_LOG_ERROR, "libchangelog_get_records: got opcode %d @index %d\n", opcode, index); if ((opcode == GF_FOP_RENAME)) { @@ -376,7 +384,6 @@ gf_boolean_t nsr_recon_libchangelog_get_records(xlator_t *this, char *bp, int32_ // Now get the gfid and parse it // before that increment the pointer - start++; for (i=0; i < 36; i++) { rec->gfid[i] = (*start); start++; @@ -430,6 +437,21 @@ gf_boolean_t nsr_recon_libchangelog_get_records(xlator_t *this, char *bp, int32_ } i = 0; if (type == fop_gfid_pgfid_entry) { + switch (opcode) { + case GF_FOP_CREATE: + case GF_FOP_MKDIR: + case GF_FOP_MKNOD: + SKIP_FIELD; // mode + break; + /* TBD: handle GF_FOP_SYMLINK target */ + default: + ; + } + SKIP_FIELD; // uid + SKIP_FIELD; // gid + if (opcode == GF_FOP_MKNOD) { + SKIP_FIELD; // dev + } // first get the gfid and then the path for (i=0; i < 36; i++) { rec->pargfid[i] = (*start); |