diff options
author | Avra Sengupta <asengupt@redhat.com> | 2016-04-04 14:55:20 +0530 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2016-04-25 12:05:35 -0700 |
commit | 0a43265f1b10c35506fe82a525aa0fa43af6c0cd (patch) | |
tree | 42f27443ef5e4dc85b935cbfc1a8eb3f1d7a96b3 /xlators | |
parent | c3353cdc4a3bcea416953af0585a08f33c5d4639 (diff) |
nsr/jbr: Renaming nsr to jbr
As per community consensus, we have decided to rename
nsr to jbr(Journal-Based-Replication). This is the patch
to rename the "nsr" code to "jbr"
Change-Id: Id2a9837f2ec4da89afc32438b91a1c302bb4104f
BUG: 1328043
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/13899
Smoke: Gluster Build System <jenkins@build.gluster.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/experimental/Makefile.am | 2 | ||||
-rw-r--r-- | xlators/experimental/jbr-client/Makefile.am (renamed from xlators/experimental/nsr-client/Makefile.am) | 0 | ||||
-rw-r--r-- | xlators/experimental/jbr-client/src/Makefile.am | 32 | ||||
-rw-r--r-- | xlators/experimental/jbr-client/src/fop-template.c (renamed from xlators/experimental/nsr-client/src/fop-template.c) | 26 | ||||
-rwxr-xr-x | xlators/experimental/jbr-client/src/gen-fops.py (renamed from xlators/experimental/nsr-client/src/gen-fops.py) | 0 | ||||
-rw-r--r-- | xlators/experimental/jbr-client/src/jbr-messages.h (renamed from xlators/experimental/nsr-client/src/nsr-messages.h) | 28 | ||||
-rw-r--r-- | xlators/experimental/jbr-client/src/jbrc.c (renamed from xlators/experimental/nsr-client/src/nsrc.c) | 168 | ||||
-rw-r--r-- | xlators/experimental/jbr-client/src/jbrc.h (renamed from xlators/experimental/nsr-client/src/nsrc.h) | 10 | ||||
-rw-r--r-- | xlators/experimental/jbr-server/Makefile.am (renamed from xlators/experimental/nsr-server/Makefile.am) | 0 | ||||
-rw-r--r-- | xlators/experimental/jbr-server/src/Makefile.am | 35 | ||||
-rw-r--r-- | xlators/experimental/jbr-server/src/all-templates.c (renamed from xlators/experimental/nsr-server/src/all-templates.c) | 92 | ||||
-rwxr-xr-x | xlators/experimental/jbr-server/src/gen-fops.py (renamed from xlators/experimental/nsr-server/src/gen-fops.py) | 8 | ||||
-rw-r--r-- | xlators/experimental/jbr-server/src/jbr-internal.h (renamed from xlators/experimental/nsr-server/src/nsr-internal.h) | 42 | ||||
-rw-r--r-- | xlators/experimental/jbr-server/src/jbr.c (renamed from xlators/experimental/nsr-server/src/nsr.c) | 288 | ||||
-rw-r--r-- | xlators/experimental/nsr-client/src/Makefile.am | 32 | ||||
-rw-r--r-- | xlators/experimental/nsr-server/src/Makefile.am | 35 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volgen.c | 20 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-set.c | 12 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.h | 4 |
19 files changed, 417 insertions, 417 deletions
diff --git a/xlators/experimental/Makefile.am b/xlators/experimental/Makefile.am index be53a44d4b0..927e2df654a 100644 --- a/xlators/experimental/Makefile.am +++ b/xlators/experimental/Makefile.am @@ -1,3 +1,3 @@ -SUBDIRS = nsr-client nsr-server fdl dht2 +SUBDIRS = jbr-client jbr-server fdl dht2 CLEANFILES = diff --git a/xlators/experimental/nsr-client/Makefile.am b/xlators/experimental/jbr-client/Makefile.am index a985f42a877..a985f42a877 100644 --- a/xlators/experimental/nsr-client/Makefile.am +++ b/xlators/experimental/jbr-client/Makefile.am diff --git a/xlators/experimental/jbr-client/src/Makefile.am b/xlators/experimental/jbr-client/src/Makefile.am new file mode 100644 index 00000000000..58f399f0607 --- /dev/null +++ b/xlators/experimental/jbr-client/src/Makefile.am @@ -0,0 +1,32 @@ +xlator_LTLIBRARIES = jbrc.la +xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/experimental + +nodist_jbrc_la_SOURCES = jbrc-cg.c +CLEANFILES = $(nodist_jbrc_la_SOURCES) + +jbrc_la_LDFLAGS = -module -avoid-version +jbrc_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la + +noinst_HEADERS = \ + $(top_srcdir)/xlators/lib/src/libxlator.h \ + $(top_srcdir)/glusterfsd/src/glusterfsd.h \ + jbrc.h jbr-messages.h + +AM_CPPFLAGS = $(GF_CPPFLAGS) \ + -I$(top_srcdir)/libglusterfs/src -I$(top_srcdir)/xlators/lib/src \ + -I$(top_srcdir)/rpc/rpc-lib/src + +AM_CFLAGS = -Wall $(GF_CFLAGS) + +JBRC_PREFIX = $(top_srcdir)/xlators/experimental/jbr-client/src +JBRC_GEN_FOPS = $(JBRC_PREFIX)/gen-fops.py +JBRC_TEMPLATES = $(JBRC_PREFIX)/fop-template.c +JBRC_WRAPPER = $(JBRC_PREFIX)/jbrc.c +noinst_PYTHON = $(JBRC_GEN_FOPS) +EXTRA_DIST = $(JBRC_TEMPLATES) $(JBRC_WRAPPER) + +jbrc-cg.c: $(JBRC_GEN_FOPS) $(JBRC_TEMPLATES) $(JBRC_WRAPPER) + $(PYTHON) $(JBRC_GEN_FOPS) $(JBRC_TEMPLATES) $(JBRC_WRAPPER) > $@ + +uninstall-local: + rm -f $(DESTDIR)$(xlatordir)/jbr.so diff --git a/xlators/experimental/nsr-client/src/fop-template.c b/xlators/experimental/jbr-client/src/fop-template.c index 59708732aa0..7719f511f01 100644 --- a/xlators/experimental/nsr-client/src/fop-template.c +++ b/xlators/experimental/jbr-client/src/fop-template.c @@ -1,9 +1,9 @@ /* template-name fop */ int32_t -nsrc_@NAME@ (call_frame_t *frame, xlator_t *this, +jbrc_@NAME@ (call_frame_t *frame, xlator_t *this, @LONG_ARGS@) { - nsrc_local_t *local = NULL; + jbrc_local_t *local = NULL; xlator_t *target_xl = ACTIVE_CHILD(this); local = mem_get(this->local_pool); @@ -11,7 +11,7 @@ nsrc_@NAME@ (call_frame_t *frame, xlator_t *this, goto err; } - local->stub = fop_@NAME@_stub (frame, nsrc_@NAME@_continue, + local->stub = fop_@NAME@_stub (frame, jbrc_@NAME@_continue, @SHORT_ARGS@); if (!local->stub) { goto err; @@ -20,7 +20,7 @@ nsrc_@NAME@ (call_frame_t *frame, xlator_t *this, local->scars = 0; frame->local = local; - STACK_WIND_COOKIE (frame, nsrc_@NAME@_cbk, target_xl, + STACK_WIND_COOKIE (frame, jbrc_@NAME@_cbk, target_xl, target_xl, target_xl->fops->@NAME@, @SHORT_ARGS@); return 0; @@ -36,19 +36,19 @@ err: /* template-name cbk */ int32_t -nsrc_@NAME@_cbk (call_frame_t *frame, void *cookie, xlator_t *this, +jbrc_@NAME@_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, @LONG_ARGS@) { - nsrc_local_t *local = frame->local; + jbrc_local_t *local = frame->local; xlator_t *last_xl = cookie; xlator_t *next_xl; - nsrc_private_t *priv = this->private; + jbrc_private_t *priv = this->private; struct timespec spec; if (op_ret != (-1)) { if (local->scars) { - gf_msg (this->name, GF_LOG_INFO, 0, N_MSG_RETRY_MSG, + gf_msg (this->name, GF_LOG_INFO, 0, J_MSG_RETRY_MSG, HILITE("retried %p OK"), frame->local); } priv->active = last_xl; @@ -69,7 +69,7 @@ nsrc_@NAME@_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * TBD: implement slow/finite retry via a worker thread */ if (!next_xl || (local->scars >= SCAR_LIMIT)) { - gf_msg (this->name, GF_LOG_DEBUG, 0, N_MSG_RETRY_MSG, + gf_msg (this->name, GF_LOG_DEBUG, 0, J_MSG_RETRY_MSG, HILITE("ran out of retries for %p"), frame->local); goto unwind; } @@ -88,7 +88,7 @@ nsrc_@NAME@_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * implement a stricter (and more complicated) queuing mechanism to * ensure absolute consistency in this case. */ - if (gf_timer_call_after(this->ctx, spec, nsrc_retry_cb, local)) { + if (gf_timer_call_after(this->ctx, spec, jbrc_retry_cb, local)) { return 0; } @@ -101,12 +101,12 @@ unwind: /* template-name cont-func */ int32_t -nsrc_@NAME@_continue (call_frame_t *frame, xlator_t *this, +jbrc_@NAME@_continue (call_frame_t *frame, xlator_t *this, @LONG_ARGS@) { - nsrc_local_t *local = frame->local; + jbrc_local_t *local = frame->local; - STACK_WIND_COOKIE (frame, nsrc_@NAME@_cbk, local->curr_xl, + STACK_WIND_COOKIE (frame, jbrc_@NAME@_cbk, local->curr_xl, local->curr_xl, local->curr_xl->fops->@NAME@, @SHORT_ARGS@); return 0; diff --git a/xlators/experimental/nsr-client/src/gen-fops.py b/xlators/experimental/jbr-client/src/gen-fops.py index 4d9451f7177..4d9451f7177 100755 --- a/xlators/experimental/nsr-client/src/gen-fops.py +++ b/xlators/experimental/jbr-client/src/gen-fops.py diff --git a/xlators/experimental/nsr-client/src/nsr-messages.h b/xlators/experimental/jbr-client/src/jbr-messages.h index aa28a639a16..61fa725d56a 100644 --- a/xlators/experimental/nsr-client/src/nsr-messages.h +++ b/xlators/experimental/jbr-client/src/jbr-messages.h @@ -8,8 +8,8 @@ cases as published by the Free Software Foundation. */ -#ifndef _NSR_MESSAGES_H_ -#define _NSR_MESSAGES_H_ +#ifndef _JBR_MESSAGES_H_ +#define _JBR_MESSAGES_H_ #include "glfs-message-id.h" @@ -35,71 +35,71 @@ * holes. */ -#define NSR_COMP_BASE GLFS_MSGID_COMP_NSR +#define JBR_COMP_BASE GLFS_MSGID_COMP_JBR #define GLFS_NUM_MESSAGES 1 -#define GLFS_MSGID_END (NSR_COMP_BASE + GLFS_NUM_MESSAGES + 1) +#define GLFS_MSGID_END (JBR_COMP_BASE + GLFS_NUM_MESSAGES + 1) /*! * @messageid * @diagnosis * @recommendedaction */ -#define N_MSG_INIT_FAIL (NSR_COMP_BASE + 1) +#define J_MSG_INIT_FAIL (JBR_COMP_BASE + 1) /*! * @messageid * @diagnosis * @recommendedaction */ -#define N_MSG_RETRY_MSG (NSR_COMP_BASE + 2) +#define J_MSG_RETRY_MSG (JBR_COMP_BASE + 2) /*! * @messageid * @diagnosis * @recommendedaction */ -#define N_MSG_MEM_ERR (NSR_COMP_BASE + 3) +#define J_MSG_MEM_ERR (JBR_COMP_BASE + 3) /*! * @messageid * @diagnosis * @recommendedaction */ -#define N_MSG_DICT_FLR (NSR_COMP_BASE + 4) +#define J_MSG_DICT_FLR (JBR_COMP_BASE + 4) /*! * @messageid * @diagnosis * @recommendedaction */ -#define N_MSG_GENERIC (NSR_COMP_BASE + 5) +#define J_MSG_GENERIC (JBR_COMP_BASE + 5) /*! * @messageid * @diagnosis * @recommendedaction */ -#define N_MSG_INVALID (NSR_COMP_BASE + 6) +#define J_MSG_INVALID (JBR_COMP_BASE + 6) /*! * @messageid * @diagnosis * @recommendedaction */ -#define N_MSG_NO_DATA (NSR_COMP_BASE + 7) +#define J_MSG_NO_DATA (JBR_COMP_BASE + 7) /*! * @messageid * @diagnosis * @recommendedaction */ -#define N_MSG_SYS_CALL_FAILURE (NSR_COMP_BASE + 8) +#define J_MSG_SYS_CALL_FAILURE (JBR_COMP_BASE + 8) /*! * @messageid * @diagnosis * @recommendedaction */ -#define N_MSG_QUORUM_NOT_MET (NSR_COMP_BASE + 9) +#define J_MSG_QUORUM_NOT_MET (JBR_COMP_BASE + 9) -#endif /* _NSR_MESSAGES_H_ */ +#endif /* _JBR_MESSAGES_H_ */ diff --git a/xlators/experimental/nsr-client/src/nsrc.c b/xlators/experimental/jbr-client/src/jbrc.c index 13f1a2d38c5..9bb9346c5c0 100644 --- a/xlators/experimental/nsr-client/src/nsrc.c +++ b/xlators/experimental/jbr-client/src/jbrc.c @@ -16,8 +16,8 @@ #include "defaults.h" #include "timer.h" #include "xlator.h" -#include "nsr-messages.h" -#include "nsrc.h" +#include "jbr-messages.h" +#include "jbrc.h" #include "statedump.h" #define SCAR_LIMIT 20 @@ -29,17 +29,17 @@ */ enum gf_dht_mem_types_ { - gf_mt_nsrc_private_t = gf_common_mt_end + 1, - gf_mt_nsrc_end + gf_mt_jbrc_private_t = gf_common_mt_end + 1, + gf_mt_jbrc_end }; -char *NSRC_XATTR = "user.nsr.active"; +char *JBRC_XATTR = "user.jbr.active"; static inline xlator_t * ACTIVE_CHILD (xlator_t *parent) { - nsrc_private_t *priv = parent->private; + jbrc_private_t *priv = parent->private; return priv ? priv->active : FIRST_CHILD(parent); } @@ -60,11 +60,11 @@ next_xlator (xlator_t *this, xlator_t *prev) } void -nsrc_retry_cb (void *cb_arg) +jbrc_retry_cb (void *cb_arg) { - nsrc_local_t *local = cb_arg; + jbrc_local_t *local = cb_arg; - gf_msg (__func__, GF_LOG_INFO, 0, N_MSG_RETRY_MSG, + gf_msg (__func__, GF_LOG_INFO, 0, J_MSG_RETRY_MSG, HILITE("retrying %p"), local); call_resume_wind(local->stub); } @@ -72,74 +72,74 @@ nsrc_retry_cb (void *cb_arg) #pragma generate int32_t -nsrc_forget (xlator_t *this, inode_t *inode) +jbrc_forget (xlator_t *this, inode_t *inode) { - gf_msg_callingfn (this->name, GF_LOG_WARNING, 0, N_MSG_INIT_FAIL, + gf_msg_callingfn (this->name, GF_LOG_WARNING, 0, J_MSG_INIT_FAIL, "xlator does not implement forget_cbk"); return 0; } int32_t -nsrc_releasedir (xlator_t *this, fd_t *fd) +jbrc_releasedir (xlator_t *this, fd_t *fd) { - gf_msg_callingfn (this->name, GF_LOG_WARNING, 0, N_MSG_INIT_FAIL, + gf_msg_callingfn (this->name, GF_LOG_WARNING, 0, J_MSG_INIT_FAIL, "xlator does not implement releasedir_cbk"); return 0; } int32_t -nsrc_release (xlator_t *this, fd_t *fd) +jbrc_release (xlator_t *this, fd_t *fd) { - gf_msg_callingfn (this->name, GF_LOG_WARNING, 0, N_MSG_INIT_FAIL, + gf_msg_callingfn (this->name, GF_LOG_WARNING, 0, J_MSG_INIT_FAIL, "xlator does not implement release_cbk"); return 0; } struct xlator_fops fops = { - .lookup = nsrc_lookup, - .stat = nsrc_stat, - .fstat = nsrc_fstat, - .truncate = nsrc_truncate, - .ftruncate = nsrc_ftruncate, - .access = nsrc_access, - .readlink = nsrc_readlink, - .mknod = nsrc_mknod, - .mkdir = nsrc_mkdir, - .unlink = nsrc_unlink, - .rmdir = nsrc_rmdir, - .symlink = nsrc_symlink, - .rename = nsrc_rename, - .link = nsrc_link, - .create = nsrc_create, - .open = nsrc_open, - .readv = nsrc_readv, - .writev = nsrc_writev, - .flush = nsrc_flush, - .fsync = nsrc_fsync, - .opendir = nsrc_opendir, - .readdir = nsrc_readdir, - .readdirp = nsrc_readdirp, - .fsyncdir = nsrc_fsyncdir, - .statfs = nsrc_statfs, - .setxattr = nsrc_setxattr, - .getxattr = nsrc_getxattr, - .fsetxattr = nsrc_fsetxattr, - .fgetxattr = nsrc_fgetxattr, - .removexattr = nsrc_removexattr, - .fremovexattr = nsrc_fremovexattr, - .lk = nsrc_lk, - .inodelk = nsrc_inodelk, - .finodelk = nsrc_finodelk, - .entrylk = nsrc_entrylk, - .fentrylk = nsrc_fentrylk, - .rchecksum = nsrc_rchecksum, - .xattrop = nsrc_xattrop, - .fxattrop = nsrc_fxattrop, - .setattr = nsrc_setattr, - .fsetattr = nsrc_fsetattr, - .fallocate = nsrc_fallocate, - .discard = nsrc_discard, + .lookup = jbrc_lookup, + .stat = jbrc_stat, + .fstat = jbrc_fstat, + .truncate = jbrc_truncate, + .ftruncate = jbrc_ftruncate, + .access = jbrc_access, + .readlink = jbrc_readlink, + .mknod = jbrc_mknod, + .mkdir = jbrc_mkdir, + .unlink = jbrc_unlink, + .rmdir = jbrc_rmdir, + .symlink = jbrc_symlink, + .rename = jbrc_rename, + .link = jbrc_link, + .create = jbrc_create, + .open = jbrc_open, + .readv = jbrc_readv, + .writev = jbrc_writev, + .flush = jbrc_flush, + .fsync = jbrc_fsync, + .opendir = jbrc_opendir, + .readdir = jbrc_readdir, + .readdirp = jbrc_readdirp, + .fsyncdir = jbrc_fsyncdir, + .statfs = jbrc_statfs, + .setxattr = jbrc_setxattr, + .getxattr = jbrc_getxattr, + .fsetxattr = jbrc_fsetxattr, + .fgetxattr = jbrc_fgetxattr, + .removexattr = jbrc_removexattr, + .fremovexattr = jbrc_fremovexattr, + .lk = jbrc_lk, + .inodelk = jbrc_inodelk, + .finodelk = jbrc_finodelk, + .entrylk = jbrc_entrylk, + .fentrylk = jbrc_fentrylk, + .rchecksum = jbrc_rchecksum, + .xattrop = jbrc_xattrop, + .fxattrop = jbrc_fxattrop, + .setattr = jbrc_setattr, + .fsetattr = jbrc_fsetattr, + .fallocate = jbrc_fallocate, + .discard = jbrc_discard, }; struct xlator_cbks cbks = { @@ -151,12 +151,12 @@ mem_acct_init (xlator_t *this) { int ret = -1; - GF_VALIDATE_OR_GOTO ("nsrc", this, out); + GF_VALIDATE_OR_GOTO ("jbrc", this, out); - ret = xlator_mem_acct_init (this, gf_mt_nsrc_end + 1); + ret = xlator_mem_acct_init (this, gf_mt_jbrc_end + 1); if (ret != 0) { - gf_msg (this->name, GF_LOG_ERROR, ENOMEM, N_MSG_MEM_ERR, + gf_msg (this->name, GF_LOG_ERROR, ENOMEM, J_MSG_MEM_ERR, "Memory accounting init failed"); return ret; } @@ -166,19 +166,19 @@ out: int32_t -nsrc_init (xlator_t *this) +jbrc_init (xlator_t *this) { - nsrc_private_t *priv = NULL; + jbrc_private_t *priv = NULL; xlator_list_t *trav = NULL; - this->local_pool = mem_pool_new (nsrc_local_t, 128); + this->local_pool = mem_pool_new (jbrc_local_t, 128); if (!this->local_pool) { - gf_msg (this->name, GF_LOG_ERROR, ENOMEM, N_MSG_MEM_ERR, - "failed to create nsrc_local_t pool"); + gf_msg (this->name, GF_LOG_ERROR, ENOMEM, J_MSG_MEM_ERR, + "failed to create jbrc_local_t pool"); goto err; } - priv = GF_CALLOC (1, sizeof (*priv), gf_mt_nsrc_private_t); + priv = GF_CALLOC (1, sizeof (*priv), gf_mt_jbrc_private_t); if (!priv) { goto err; } @@ -199,13 +199,13 @@ err: } void -nsrc_fini (xlator_t *this) +jbrc_fini (xlator_t *this) { GF_FREE(this->private); } int -nsrc_get_child_index (xlator_t *this, xlator_t *kid) +jbrc_get_child_index (xlator_t *this, xlator_t *kid) { xlator_list_t *trav; int retval = -1; @@ -221,7 +221,7 @@ nsrc_get_child_index (xlator_t *this, xlator_t *kid) } uint8_t -nsrc_count_up_kids (nsrc_private_t *priv) +jbrc_count_up_kids (jbrc_private_t *priv) { uint8_t retval = 0; uint8_t i; @@ -236,11 +236,11 @@ nsrc_count_up_kids (nsrc_private_t *priv) } int32_t -nsrc_notify (xlator_t *this, int32_t event, void *data, ...) +jbrc_notify (xlator_t *this, int32_t event, void *data, ...) { int32_t ret = 0; int32_t index = 0; - nsrc_private_t *priv = NULL; + jbrc_private_t *priv = NULL; GF_VALIDATE_OR_GOTO (THIS->name, this, out); priv = this->private; @@ -248,11 +248,11 @@ nsrc_notify (xlator_t *this, int32_t event, void *data, ...) switch (event) { case GF_EVENT_CHILD_UP: - index = nsrc_get_child_index(this, data); + index = jbrc_get_child_index(this, data); if (index >= 0) { priv->kid_state |= (1 << index); - priv->up_children = nsrc_count_up_kids(priv); - gf_msg (this->name, GF_LOG_INFO, 0, N_MSG_GENERIC, + priv->up_children = jbrc_count_up_kids(priv); + gf_msg (this->name, GF_LOG_INFO, 0, J_MSG_GENERIC, "got CHILD_UP for %s, now %u kids", ((xlator_t *)data)->name, priv->up_children); @@ -260,11 +260,11 @@ nsrc_notify (xlator_t *this, int32_t event, void *data, ...) ret = default_notify (this, event, data); break; case GF_EVENT_CHILD_DOWN: - index = nsrc_get_child_index(this, data); + index = jbrc_get_child_index(this, data); if (index >= 0) { priv->kid_state &= ~(1 << index); - priv->up_children = nsrc_count_up_kids(priv); - gf_msg (this->name, GF_LOG_INFO, 0, N_MSG_GENERIC, + priv->up_children = jbrc_count_up_kids(priv); + gf_msg (this->name, GF_LOG_INFO, 0, J_MSG_GENERIC, "got CHILD_DOWN for %s, now %u kids", ((xlator_t *)data)->name, priv->up_children); @@ -279,9 +279,9 @@ out: } int -nsrc_priv_dump (xlator_t *this) +jbrc_priv_dump (xlator_t *this) { - nsrc_private_t *priv = NULL; + jbrc_private_t *priv = NULL; char key_prefix[GF_DUMP_MAX_BUF_LEN]; xlator_list_t *trav = NULL; int32_t i = -1; @@ -306,13 +306,13 @@ out: } struct xlator_dumpops dumpops = { - .priv = nsrc_priv_dump, + .priv = jbrc_priv_dump, }; class_methods_t class_methods = { - .init = nsrc_init, - .fini = nsrc_fini, - .notify = nsrc_notify, + .init = jbrc_init, + .fini = jbrc_fini, + .notify = jbrc_notify, }; struct volume_options options[] = { diff --git a/xlators/experimental/nsr-client/src/nsrc.h b/xlators/experimental/jbr-client/src/jbrc.h index 15f0d7c85a0..c83259ca1bd 100644 --- a/xlators/experimental/nsr-client/src/nsrc.h +++ b/xlators/experimental/jbr-client/src/jbrc.h @@ -8,20 +8,20 @@ cases as published by the Free Software Foundation. */ -#ifndef _NSRC_H_ -#define _NSRC_H_ +#ifndef _JBRC_H_ +#define _JBRC_H_ typedef struct { xlator_t *active; uint8_t up_children; uint8_t n_children; uint32_t kid_state; -} nsrc_private_t; +} jbrc_private_t; typedef struct { call_stub_t *stub; xlator_t *curr_xl; uint16_t scars; -} nsrc_local_t; +} jbrc_local_t; -#endif /* _NSRC_H_ */ +#endif /* _JBRC_H_ */ diff --git a/xlators/experimental/nsr-server/Makefile.am b/xlators/experimental/jbr-server/Makefile.am index a985f42a877..a985f42a877 100644 --- a/xlators/experimental/nsr-server/Makefile.am +++ b/xlators/experimental/jbr-server/Makefile.am diff --git a/xlators/experimental/jbr-server/src/Makefile.am b/xlators/experimental/jbr-server/src/Makefile.am new file mode 100644 index 00000000000..66f73ba8c96 --- /dev/null +++ b/xlators/experimental/jbr-server/src/Makefile.am @@ -0,0 +1,35 @@ +xlator_LTLIBRARIES = jbr.la +xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/experimental + +nodist_jbr_la_SOURCES = jbr-cg.c +CLEANFILES = $(nodist_jbr_la_SOURCES) + +jbr_la_LDFLAGS = -module -avoid-version +jbr_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \ + $(top_builddir)/api/src/libgfapi.la + +noinst_HEADERS = jbr-internal.h \ + $(top_srcdir)/xlators/lib/src/libxlator.h \ + $(top_srcdir)/glusterfsd/src/glusterfsd.h + +AM_CPPFLAGS = $(GF_CPPFLAGS) \ + -I$(top_srcdir)/libglusterfs/src \ + -I$(top_srcdir)/xlators/lib/src \ + -I$(top_srcdir)/rpc/rpc-lib/src -DSBIN_DIR=\"$(sbindir)\" \ + -I$(top_srcdir)/api/src -DJBR_SCRIPT_PREFIX=\"$(jbrdir)\" \ + -I$(top_srcdir)/xlators/experimental/jbr-client/src/ + +AM_CFLAGS = -Wall $(GF_CFLAGS) + +JBR_PREFIX = $(top_srcdir)/xlators/experimental/jbr-server/src +JBR_GEN_FOPS = $(JBR_PREFIX)/gen-fops.py +JBR_TEMPLATES = $(JBR_PREFIX)/all-templates.c +JBR_WRAPPER = $(JBR_PREFIX)/jbr.c +noinst_PYTHON = $(JBR_GEN_FOPS) +EXTRA_DIST = $(JBR_TEMPLATES) $(JBR_WRAPPER) + +jbr-cg.c: $(JBR_GEN_FOPS) $(JBR_TEMPLATES) $(JBR_WRAPPER) + $(PYTHON) $(JBR_GEN_FOPS) $(JBR_TEMPLATES) $(JBR_WRAPPER) > $@ + +uninstall-local: + rm -f $(DESTDIR)$(xlatordir)/jbr.so diff --git a/xlators/experimental/nsr-server/src/all-templates.c b/xlators/experimental/jbr-server/src/all-templates.c index c3819d2af54..9b9a3e0be5e 100644 --- a/xlators/experimental/nsr-server/src/all-templates.c +++ b/xlators/experimental/jbr-server/src/all-templates.c @@ -6,10 +6,10 @@ /* template-name read-fop */ int32_t -nsr_@NAME@ (call_frame_t *frame, xlator_t *this, +jbr_@NAME@ (call_frame_t *frame, xlator_t *this, @LONG_ARGS@) { - nsr_private_t *priv = this->private; + jbr_private_t *priv = this->private; gf_boolean_t in_recon = _gf_false; int32_t recon_term, recon_index; @@ -51,11 +51,11 @@ err: /* template-name write-fop */ int32_t -nsr_@NAME@ (call_frame_t *frame, xlator_t *this, +jbr_@NAME@ (call_frame_t *frame, xlator_t *this, @LONG_ARGS@) { - nsr_local_t *local = NULL; - nsr_private_t *priv = this->private; + jbr_local_t *local = NULL; + jbr_private_t *priv = this->private; gf_boolean_t result = _gf_false; int op_errno = ENOMEM; int from_leader; @@ -84,14 +84,14 @@ nsr_@NAME@ (call_frame_t *frame, xlator_t *this, if (result == _gf_false) { /* Emulate the AFR client-side-quorum behavior. */ gf_msg (this->name, GF_LOG_ERROR, EROFS, - N_MSG_QUORUM_NOT_MET, "Sufficient number of " + J_MSG_QUORUM_NOT_MET, "Sufficient number of " "subvolumes are not up to meet quorum."); op_errno = EROFS; goto err; } } else { if (xdata) { - from_leader = !!dict_get(xdata, NSR_TERM_XATTR); + from_leader = !!dict_get(xdata, JBR_TERM_XATTR); from_recon = !!dict_get(xdata, RECON_TERM_XATTR) && !!dict_get(xdata, RECON_INDEX_XATTR); } else { @@ -111,7 +111,7 @@ nsr_@NAME@ (call_frame_t *frame, xlator_t *this, if (!local) { goto err; } -#if defined(NSR_CG_NEED_FD) +#if defined(JBR_CG_NEED_FD) local->fd = fd_ref(fd); #else local->fd = NULL; @@ -122,11 +122,11 @@ nsr_@NAME@ (call_frame_t *frame, xlator_t *this, /* * If we let it through despite not being the leader, then we just want * to pass it on down without all of the additional xattrs, queuing, and - * so on. However, nsr_*_complete does depend on the initialization + * so on. However, jbr_*_complete does depend on the initialization * immediately above this. */ if (!priv->leader) { - STACK_WIND (frame, nsr_@NAME@_complete, + STACK_WIND (frame, jbr_@NAME@_complete, FIRST_CHILD(this), FIRST_CHILD(this)->fops->@NAME@, @SHORT_ARGS@); return 0; @@ -136,35 +136,35 @@ nsr_@NAME@ (call_frame_t *frame, xlator_t *this, xdata = dict_new(); if (!xdata) { gf_msg (this->name, GF_LOG_ERROR, ENOMEM, - N_MSG_MEM_ERR, "failed to allocate xdata"); + J_MSG_MEM_ERR, "failed to allocate xdata"); goto err; } } - if (dict_set_int32(xdata, NSR_TERM_XATTR, priv->current_term) != 0) { + if (dict_set_int32(xdata, JBR_TERM_XATTR, priv->current_term) != 0) { gf_msg (this->name, GF_LOG_ERROR, 0, - N_MSG_DICT_FLR, "failed to set nsr-term"); + J_MSG_DICT_FLR, "failed to set jbr-term"); goto err; } LOCK(&priv->index_lock); ti = ++(priv->index); UNLOCK(&priv->index_lock); - if (dict_set_int32(xdata, NSR_INDEX_XATTR, ti) != 0) { + if (dict_set_int32(xdata, JBR_INDEX_XATTR, ti) != 0) { gf_msg (this->name, GF_LOG_ERROR, 0, - N_MSG_DICT_FLR, "failed to set index"); + J_MSG_DICT_FLR, "failed to set index"); goto err; } - local->stub = fop_@NAME@_stub (frame, nsr_@NAME@_continue, + local->stub = fop_@NAME@_stub (frame, jbr_@NAME@_continue, @SHORT_ARGS@); if (!local->stub) { goto err; } -#if defined(NSR_CG_QUEUE) - nsr_inode_ctx_t *ictx = nsr_get_inode_ctx(this, fd->inode); +#if defined(JBR_CG_QUEUE) + jbr_inode_ctx_t *ictx = jbr_get_inode_ctx(this, fd->inode); if (!ictx) { op_errno = EIO; @@ -190,7 +190,7 @@ nsr_@NAME@ (call_frame_t *frame, xlator_t *this, * would be incorrect. */ local->qstub = fop_@NAME@_stub (frame, - nsr_@NAME@_dispatch, + jbr_@NAME@_dispatch, @SHORT_ARGS@); if (!local->qstub) { UNLOCK(&ictx->lock); @@ -207,7 +207,7 @@ nsr_@NAME@ (call_frame_t *frame, xlator_t *this, UNLOCK(&ictx->lock); #endif - return nsr_@NAME@_dispatch (frame, this, @SHORT_ARGS@); + return jbr_@NAME@_dispatch (frame, this, @SHORT_ARGS@); err: if (local) { @@ -229,23 +229,23 @@ err: /* template-name write-dispatch */ int32_t -nsr_@NAME@_dispatch (call_frame_t *frame, xlator_t *this, +jbr_@NAME@_dispatch (call_frame_t *frame, xlator_t *this, @LONG_ARGS@) { - nsr_local_t *local = frame->local; - nsr_private_t *priv = this->private; + jbr_local_t *local = frame->local; + jbr_private_t *priv = this->private; xlator_list_t *trav; /* * TBD: unblock pending request(s) if we fail after this point but - * before we get to nsr_@NAME@_complete (where that code currently + * before we get to jbr_@NAME@_complete (where that code currently * resides). */ local->call_count = priv->n_children - 1; local->successful_acks = 0; for (trav = this->children->next; trav; trav = trav->next) { - STACK_WIND (frame, nsr_@NAME@_fan_in, + STACK_WIND (frame, jbr_@NAME@_fan_in, trav->xlator, trav->xlator->fops->@NAME@, @SHORT_ARGS@); } @@ -256,11 +256,11 @@ nsr_@NAME@_dispatch (call_frame_t *frame, xlator_t *this, /* template-name write-fan-in */ int32_t -nsr_@NAME@_fan_in (call_frame_t *frame, void *cookie, xlator_t *this, +jbr_@NAME@_fan_in (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, @LONG_ARGS@) { - nsr_local_t *local = frame->local; + jbr_local_t *local = frame->local; uint8_t call_count; gf_msg_trace (this->name, 0, "op_ret = %d, op_errno = %d\n", @@ -289,15 +289,15 @@ nsr_@NAME@_fan_in (call_frame_t *frame, void *cookie, xlator_t *this, /* template-name write-continue */ int32_t -nsr_@NAME@_continue (call_frame_t *frame, xlator_t *this, +jbr_@NAME@_continue (call_frame_t *frame, xlator_t *this, @LONG_ARGS@) { int32_t ret = -1; gf_boolean_t result = _gf_false; - nsr_local_t *local = NULL; - nsr_private_t *priv = NULL; + jbr_local_t *local = NULL; + jbr_private_t *priv = NULL; - GF_VALIDATE_OR_GOTO ("nsr", this, out); + GF_VALIDATE_OR_GOTO ("jbr", this, out); GF_VALIDATE_OR_GOTO (this->name, frame, out); priv = this->private; local = frame->local; @@ -313,13 +313,13 @@ nsr_@NAME@_continue (call_frame_t *frame, xlator_t *this, (double)local->successful_acks + 1); if (result == _gf_false) { gf_msg (this->name, GF_LOG_ERROR, EROFS, - N_MSG_QUORUM_NOT_MET, "Didn't receive enough acks " + J_MSG_QUORUM_NOT_MET, "Didn't receive enough acks " "to meet quorum. Failing the operation without trying " "it on the leader."); STACK_UNWIND_STRICT (@NAME@, frame, -1, EROFS, @ERROR_ARGS@); } else { - STACK_WIND (frame, nsr_@NAME@_complete, + STACK_WIND (frame, jbr_@NAME@_complete, FIRST_CHILD(this), FIRST_CHILD(this)->fops->@NAME@, @SHORT_ARGS@); } @@ -331,14 +331,14 @@ out: /* template-name write-complete */ int32_t -nsr_@NAME@_complete (call_frame_t *frame, void *cookie, xlator_t *this, +jbr_@NAME@_complete (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, @LONG_ARGS@) { gf_boolean_t result = _gf_false; - nsr_private_t *priv = this->private; + jbr_private_t *priv = this->private; - nsr_local_t *local = frame->local; + jbr_local_t *local = frame->local; /* If the fop failed on the leader, then reduce one succesful ack * before calculating the fop quorum @@ -348,13 +348,13 @@ nsr_@NAME@_complete (call_frame_t *frame, void *cookie, xlator_t *this, (local->successful_acks)--; UNLOCK(&frame->lock); -#if defined(NSR_CG_QUEUE) - nsr_inode_ctx_t *ictx; - nsr_local_t *next; +#if defined(JBR_CG_QUEUE) + jbr_inode_ctx_t *ictx; + jbr_local_t *next; if (local->qlinks.next != &local->qlinks) { list_del(&local->qlinks); - ictx = nsr_get_inode_ctx(this, local->fd->inode); + ictx = jbr_get_inode_ctx(this, local->fd->inode); if (ictx) { LOCK(&ictx->lock); if (ictx->pending) { @@ -375,7 +375,7 @@ nsr_@NAME@_complete (call_frame_t *frame, void *cookie, xlator_t *this, "unblocking next request"); --(ictx->pending); next = list_entry (ictx->pqueue.next, - nsr_local_t, qlinks); + jbr_local_t, qlinks); list_del(&next->qlinks); list_add_tail(&next->qlinks, &ictx->aqueue); @@ -388,11 +388,11 @@ nsr_@NAME@_complete (call_frame_t *frame, void *cookie, xlator_t *this, } #endif -#if defined(NSR_CG_FSYNC) - nsr_mark_fd_dirty(this, local); +#if defined(JBR_CG_FSYNC) + jbr_mark_fd_dirty(this, local); #endif -#if defined(NSR_CG_NEED_FD) +#if defined(JBR_CG_NEED_FD) fd_unref(local->fd); #endif @@ -414,10 +414,10 @@ nsr_@NAME@_complete (call_frame_t *frame, void *cookie, xlator_t *this, op_ret = -1; op_errno = EROFS; gf_msg (this->name, GF_LOG_ERROR, EROFS, - N_MSG_QUORUM_NOT_MET, "Quorum is not met. " + J_MSG_QUORUM_NOT_MET, "Quorum is not met. " "The operation has failed."); } else { -#if defined(NSR_CG_NEED_FD) +#if defined(JBR_CG_NEED_FD) op_ret = local->successful_op_ret; #else op_ret = 0; diff --git a/xlators/experimental/nsr-server/src/gen-fops.py b/xlators/experimental/jbr-server/src/gen-fops.py index 336b218a8fb..64cbe4f760e 100755 --- a/xlators/experimental/nsr-server/src/gen-fops.py +++ b/xlators/experimental/jbr-server/src/gen-fops.py @@ -53,7 +53,7 @@ def load_templates (path): # # Various keywords can be used to define/undefine preprocessor symbols used # in the templates, on a per-function basis. For example, if the keyword here -# is "fsync" (lowercase word or abbreviation) that will cause NSR_CG_FSYNC +# is "fsync" (lowercase word or abbreviation) that will cause JBR_CG_FSYNC # (prefix plus uppercase version) to be defined above all of the generated code # for that fop. @@ -113,19 +113,19 @@ def gen_server (templates): if ("fsync" in flags) or ("queue" in flags): flags.append("need_fd") for fname in flags: - print "#define NSR_CG_%s" % fname.upper() + print "#define JBR_CG_%s" % fname.upper() print generate(templates[kind+"-complete"],name,cbk_subs) print generate(templates[kind+"-continue"],name,fop_subs) print generate(templates[kind+"-fan-in"],name,cbk_subs) print generate(templates[kind+"-dispatch"],name,fop_subs) print generate(templates[kind+"-fop"],name,fop_subs) for fname in flags: - print "#undef NSR_CG_%s" % fname.upper() + print "#undef JBR_CG_%s" % fname.upper() fops_done.append(name) # Just for fun, emit the fops table too. print("struct xlator_fops fops = {") for x in fops_done: - print(" .%s = nsr_%s,"%(x,x)) + print(" .%s = jbr_%s,"%(x,x)) print("};") tmpl = load_templates(sys.argv[1]) diff --git a/xlators/experimental/nsr-server/src/nsr-internal.h b/xlators/experimental/jbr-server/src/jbr-internal.h index d43fbac9a53..ab1dfc16de2 100644 --- a/xlators/experimental/nsr-server/src/nsr-internal.h +++ b/xlators/experimental/jbr-server/src/jbr-internal.h @@ -11,29 +11,29 @@ #include <sys/stat.h> #include <sys/types.h> -#define LEADER_XATTR "user.nsr.leader" +#define LEADER_XATTR "user.jbr.leader" #define SECOND_CHILD(xl) (xl->children->next->xlator) -#define RECONCILER_PATH NSR_SCRIPT_PREFIX"/reconciler.py" +#define RECONCILER_PATH JBR_SCRIPT_PREFIX"/reconciler.py" #define CHANGELOG_ENTRY_SIZE 128 enum { - gf_mt_nsr_private_t = gf_common_mt_end + 1, - gf_mt_nsr_fd_ctx_t, - gf_mt_nsr_inode_ctx_t, - gf_mt_nsr_dirty_t, - gf_mt_nsr_end + gf_mt_jbr_private_t = gf_common_mt_end + 1, + gf_mt_jbr_fd_ctx_t, + gf_mt_jbr_inode_ctx_t, + gf_mt_jbr_dirty_t, + gf_mt_jbr_end }; -typedef enum nsr_recon_notify_ev_id_t { - NSR_RECON_SET_LEADER = 1, - NSR_RECON_ADD_CHILD = 2 -} nsr_recon_notify_ev_id_t; +typedef enum jbr_recon_notify_ev_id_t { + JBR_RECON_SET_LEADER = 1, + JBR_RECON_ADD_CHILD = 2 +} jbr_recon_notify_ev_id_t; -typedef struct _nsr_recon_notify_ev_s { - nsr_recon_notify_ev_id_t id; +typedef struct _jbr_recon_notify_ev_s { + jbr_recon_notify_ev_id_t id; uint32_t index; /* in case of add */ struct list_head list; -} nsr_recon_notify_ev_t; +} jbr_recon_notify_ev_t; typedef struct { /* @@ -44,7 +44,7 @@ typedef struct { * config_leader is true, then leader will *always* be true as well, * giving that brick precedence. If config_leader is false, then * leader will only be true if there is no connection to the other - * brick (tracked in nsr_notify). + * brick (tracked in jbr_notify). * * TBD: implement real leader election */ @@ -76,7 +76,7 @@ typedef struct { char term_buf[CHANGELOG_ENTRY_SIZE]; gf_boolean_t child_up; /* To maintain the state of * * the translator */ -} nsr_private_t; +} jbr_private_t; typedef struct { call_stub_t *stub; @@ -86,7 +86,7 @@ typedef struct { uint32_t successful_op_ret; fd_t *fd; struct list_head qlinks; -} nsr_local_t; +} jbr_local_t; /* * This should match whatever changelog returns on the pre-op for us to pass @@ -97,13 +97,13 @@ typedef uint32_t log_id_t; typedef struct { struct list_head links; log_id_t id; -} nsr_dirty_list_t; +} jbr_dirty_list_t; typedef struct { fd_t *fd; struct list_head dirty_list; struct list_head fd_list; -} nsr_fd_ctx_t; +} jbr_fd_ctx_t; typedef struct { gf_lock_t lock; @@ -111,6 +111,6 @@ typedef struct { struct list_head aqueue; uint32_t pending; struct list_head pqueue; -} nsr_inode_ctx_t; +} jbr_inode_ctx_t; -void nsr_start_reconciler (xlator_t *this); +void jbr_start_reconciler (xlator_t *this); diff --git a/xlators/experimental/nsr-server/src/nsr.c b/xlators/experimental/jbr-server/src/jbr.c index 0fb618f236e..984392c2f87 100644 --- a/xlators/experimental/nsr-server/src/nsr.c +++ b/xlators/experimental/jbr-server/src/jbr.c @@ -25,17 +25,17 @@ #include "syscall.h" #include "compat-errno.h" -#include "nsr-internal.h" -#include "nsr-messages.h" +#include "jbr-internal.h" +#include "jbr-messages.h" -#define NSR_FLUSH_INTERVAL 5 +#define JBR_FLUSH_INTERVAL 5 enum { - /* echo "cluster/nsr-server" | md5sum | cut -c 1-8 */ - NSR_SERVER_IPC_BASE = 0x0e2d66a5, - NSR_SERVER_TERM_RANGE, - NSR_SERVER_OPEN_TERM, - NSR_SERVER_NEXT_ENTRY + /* echo "cluster/jbr-server" | md5sum | cut -c 1-8 */ + JBR_SERVER_IPC_BASE = 0x0e2d66a5, + JBR_SERVER_TERM_RANGE, + JBR_SERVER_OPEN_TERM, + JBR_SERVER_NEXT_ENTRY }; /* Used to check the quorum of acks received after the fop @@ -46,12 +46,12 @@ gf_boolean_t fop_quorum_check (xlator_t *this, double n_children, double current_state) { - nsr_private_t *priv = NULL; + jbr_private_t *priv = NULL; gf_boolean_t result = _gf_false; double required = 0; double current = 0; - GF_VALIDATE_OR_GOTO ("nsr", this, out); + GF_VALIDATE_OR_GOTO ("jbr", this, out); priv = this->private; GF_VALIDATE_OR_GOTO (this->name, priv, out); @@ -74,7 +74,7 @@ fop_quorum_check (xlator_t *this, double n_children, if (current < required) { gf_msg (this->name, GF_LOG_ERROR, 0, - N_MSG_QUORUM_NOT_MET, + J_MSG_QUORUM_NOT_MET, "Quorum not met. quorum_pct = %f " "Current State = %f, Required State = %f", priv->quorum_pct, current, @@ -86,17 +86,17 @@ out: return result; } -nsr_inode_ctx_t * -nsr_get_inode_ctx (xlator_t *this, inode_t *inode) +jbr_inode_ctx_t * +jbr_get_inode_ctx (xlator_t *this, inode_t *inode) { uint64_t ctx_int = 0LL; - nsr_inode_ctx_t *ctx_ptr; + jbr_inode_ctx_t *ctx_ptr; if (__inode_ctx_get(inode, this, &ctx_int) == 0) { - ctx_ptr = (nsr_inode_ctx_t *)(long)ctx_int; + ctx_ptr = (jbr_inode_ctx_t *)(long)ctx_int; } else { ctx_ptr = GF_CALLOC (1, sizeof(*ctx_ptr), - gf_mt_nsr_inode_ctx_t); + gf_mt_jbr_inode_ctx_t); if (ctx_ptr) { ctx_int = (uint64_t)(long)ctx_ptr; if (__inode_ctx_set(inode, this, &ctx_int) == 0) { @@ -114,16 +114,16 @@ nsr_get_inode_ctx (xlator_t *this, inode_t *inode) return ctx_ptr; } -nsr_fd_ctx_t * -nsr_get_fd_ctx (xlator_t *this, fd_t *fd) +jbr_fd_ctx_t * +jbr_get_fd_ctx (xlator_t *this, fd_t *fd) { uint64_t ctx_int = 0LL; - nsr_fd_ctx_t *ctx_ptr; + jbr_fd_ctx_t *ctx_ptr; if (__fd_ctx_get(fd, this, &ctx_int) == 0) { - ctx_ptr = (nsr_fd_ctx_t *)(long)ctx_int; + ctx_ptr = (jbr_fd_ctx_t *)(long)ctx_int; } else { - ctx_ptr = GF_CALLOC (1, sizeof(*ctx_ptr), gf_mt_nsr_fd_ctx_t); + ctx_ptr = GF_CALLOC (1, sizeof(*ctx_ptr), gf_mt_jbr_fd_ctx_t); if (ctx_ptr) { if (__fd_ctx_set(fd, this, (uint64_t)ctx_ptr) == 0) { INIT_LIST_HEAD(&ctx_ptr->dirty_list); @@ -140,12 +140,12 @@ nsr_get_fd_ctx (xlator_t *this, fd_t *fd) } void -nsr_mark_fd_dirty (xlator_t *this, nsr_local_t *local) +jbr_mark_fd_dirty (xlator_t *this, jbr_local_t *local) { fd_t *fd = local->fd; - nsr_fd_ctx_t *ctx_ptr; - nsr_dirty_list_t *dirty; - nsr_private_t *priv = this->private; + jbr_fd_ctx_t *ctx_ptr; + jbr_dirty_list_t *dirty; + jbr_private_t *priv = this->private; /* * TBD: don't do any of this for O_SYNC/O_DIRECT writes. @@ -156,8 +156,8 @@ nsr_mark_fd_dirty (xlator_t *this, nsr_local_t *local) */ LOCK(&fd->lock); - ctx_ptr = nsr_get_fd_ctx(this, fd); - dirty = GF_CALLOC(1, sizeof(*dirty), gf_mt_nsr_dirty_t); + ctx_ptr = jbr_get_fd_ctx(this, fd); + dirty = GF_CALLOC(1, sizeof(*dirty), gf_mt_jbr_dirty_t); if (ctx_ptr && dirty) { gf_msg_trace (this->name, 0, "marking fd %p as dirty (%p)", fd, dirty); @@ -173,7 +173,7 @@ nsr_mark_fd_dirty (xlator_t *this, nsr_local_t *local) } } else { gf_msg (this->name, GF_LOG_ERROR, ENOMEM, - N_MSG_MEM_ERR, "could not mark %p dirty", fd); + J_MSG_MEM_ERR, "could not mark %p dirty", fd); if (ctx_ptr) { GF_FREE(ctx_ptr); } @@ -184,16 +184,16 @@ nsr_mark_fd_dirty (xlator_t *this, nsr_local_t *local) UNLOCK(&fd->lock); } -#define NSR_TERM_XATTR "trusted.nsr.term" -#define NSR_INDEX_XATTR "trusted.nsr.index" -#define NSR_REP_COUNT_XATTR "trusted.nsr.rep-count" -#define RECON_TERM_XATTR "trusted.nsr.recon-term" -#define RECON_INDEX_XATTR "trusted.nsr.recon-index" +#define JBR_TERM_XATTR "trusted.jbr.term" +#define JBR_INDEX_XATTR "trusted.jbr.index" +#define JBR_REP_COUNT_XATTR "trusted.jbr.rep-count" +#define RECON_TERM_XATTR "trusted.jbr.recon-term" +#define RECON_INDEX_XATTR "trusted.jbr.recon-index" #pragma generate uint8_t -nsr_count_up_kids (nsr_private_t *priv) +jbr_count_up_kids (jbr_private_t *priv) { uint8_t retval = 0; uint8_t i; @@ -219,11 +219,11 @@ nsr_count_up_kids (nsr_private_t *priv) */ int32_t -nsr_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, +jbr_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata) { - nsr_local_t *local = frame->local; + jbr_local_t *local = frame->local; gf_boolean_t unwind; LOCK(&frame->lock); @@ -238,13 +238,13 @@ nsr_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } int32_t -nsr_fsync_local_cbk (call_frame_t *frame, void *cookie, xlator_t *this, +jbr_fsync_local_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata) { - nsr_dirty_list_t *dirty; - nsr_dirty_list_t *dtmp; - nsr_local_t *local = frame->local; + jbr_dirty_list_t *dirty; + jbr_dirty_list_t *dtmp; + jbr_local_t *local = frame->local; list_for_each_entry_safe (dirty, dtmp, &local->qlinks, links) { gf_msg_trace (this->name, 0, @@ -252,18 +252,18 @@ nsr_fsync_local_cbk (call_frame_t *frame, void *cookie, xlator_t *this, GF_FREE(dirty); } - return nsr_fsync_cbk (frame, cookie, this, op_ret, op_errno, + return jbr_fsync_cbk (frame, cookie, this, op_ret, op_errno, prebuf, postbuf, xdata); } int32_t -nsr_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, +jbr_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, dict_t *xdata) { - nsr_private_t *priv = this->private; - nsr_local_t *local; + jbr_private_t *priv = this->private; + jbr_local_t *local; uint64_t ctx_int = 0LL; - nsr_fd_ctx_t *ctx_ptr; + jbr_fd_ctx_t *ctx_ptr; xlator_list_t *trav; local = mem_get0(this->local_pool); @@ -278,7 +278,7 @@ nsr_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, /* Move the dirty list from the fd to the fsync request. */ LOCK(&fd->lock); if (__fd_ctx_get(fd, this, &ctx_int) == 0) { - ctx_ptr = (nsr_fd_ctx_t *)(long)ctx_int; + ctx_ptr = (jbr_fd_ctx_t *)(long)ctx_int; list_splice_init (&ctx_ptr->dirty_list, &local->qlinks); } @@ -286,14 +286,14 @@ nsr_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, /* Issue the local call. */ local->call_count = priv->leader ? priv->n_children : 1; - STACK_WIND (frame, nsr_fsync_local_cbk, + STACK_WIND (frame, jbr_fsync_local_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fsync, fd, flags, xdata); /* Issue remote calls if we're the leader. */ if (priv->leader) { for (trav = this->children->next; trav; trav = trav->next) { - STACK_WIND (frame, nsr_fsync_cbk, + STACK_WIND (frame, jbr_fsync_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fsync, fd, flags, xdata); @@ -304,18 +304,18 @@ nsr_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, } int32_t -nsr_getxattr_special (call_frame_t *frame, xlator_t *this, loc_t *loc, +jbr_getxattr_special (call_frame_t *frame, xlator_t *this, loc_t *loc, const char *name, dict_t *xdata) { dict_t *result; - nsr_private_t *priv = this->private; + jbr_private_t *priv = this->private; if (!priv->leader) { STACK_UNWIND_STRICT (getxattr, frame, -1, EREMOTE, NULL, NULL); return 0; } - if (!name || (strcmp(name, NSR_REP_COUNT_XATTR) != 0)) { + if (!name || (strcmp(name, JBR_REP_COUNT_XATTR) != 0)) { STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->getxattr, @@ -328,8 +328,8 @@ nsr_getxattr_special (call_frame_t *frame, xlator_t *this, loc_t *loc, goto dn_failed; } - priv->up_children = nsr_count_up_kids(this->private); - if (dict_set_uint32(result, NSR_REP_COUNT_XATTR, + priv->up_children = jbr_count_up_kids(this->private); + if (dict_set_uint32(result, JBR_REP_COUNT_XATTR, priv->up_children) != 0) { goto dsu_failed; } @@ -346,10 +346,10 @@ dn_failed: } void -nsr_flush_fd (xlator_t *this, nsr_fd_ctx_t *fd_ctx) +jbr_flush_fd (xlator_t *this, jbr_fd_ctx_t *fd_ctx) { - nsr_dirty_list_t *dirty; - nsr_dirty_list_t *dtmp; + jbr_dirty_list_t *dirty; + jbr_dirty_list_t *dtmp; list_for_each_entry_safe (dirty, dtmp, &fd_ctx->dirty_list, links) { gf_msg_trace (this->name, 0, @@ -361,13 +361,13 @@ nsr_flush_fd (xlator_t *this, nsr_fd_ctx_t *fd_ctx) } void * -nsr_flush_thread (void *ctx) +jbr_flush_thread (void *ctx) { xlator_t *this = ctx; - nsr_private_t *priv = this->private; + jbr_private_t *priv = this->private; struct list_head dirty_fds; - nsr_fd_ctx_t *fd_ctx; - nsr_fd_ctx_t *fd_tmp; + jbr_fd_ctx_t *fd_ctx; + jbr_fd_ctx_t *fd_tmp; int ret; for (;;) { @@ -406,19 +406,19 @@ nsr_flush_thread (void *ctx) NULL, NULL); if (ret) { gf_msg (this->name, GF_LOG_WARNING, 0, - N_MSG_SYS_CALL_FAILURE, + J_MSG_SYS_CALL_FAILURE, "failed to fsync %p (%d)", fd_ctx->fd, -ret); } LOCK(&fd_ctx->fd->lock); - nsr_flush_fd(this, fd_ctx); + jbr_flush_fd(this, fd_ctx); list_del_init(&fd_ctx->fd_list); UNLOCK(&fd_ctx->fd->lock); fd_unref(fd_ctx->fd); } - sleep(NSR_FLUSH_INTERVAL); + sleep(JBR_FLUSH_INTERVAL); } return NULL; @@ -426,7 +426,7 @@ nsr_flush_thread (void *ctx) int32_t -nsr_get_changelog_dir (xlator_t *this, char **cl_dir_p) +jbr_get_changelog_dir (xlator_t *this, char **cl_dir_p) { xlator_t *cl_xl; @@ -440,7 +440,7 @@ nsr_get_changelog_dir (xlator_t *this, char **cl_dir_p) } if (!cl_xl) { gf_msg (this->name, GF_LOG_ERROR, 0, - N_MSG_INIT_FAIL, + J_MSG_INIT_FAIL, "failed to find changelog translator"); return ENOENT; } @@ -448,7 +448,7 @@ nsr_get_changelog_dir (xlator_t *this, char **cl_dir_p) /* Find the actual changelog directory. */ if (dict_get_str(cl_xl->options, "changelog-dir", cl_dir_p) != 0) { gf_msg (this->name, GF_LOG_ERROR, 0, - N_MSG_INIT_FAIL, + J_MSG_INIT_FAIL, "failed to find changelog-dir for %s", cl_xl->name); return ENODATA; } @@ -458,7 +458,7 @@ nsr_get_changelog_dir (xlator_t *this, char **cl_dir_p) void -nsr_get_terms (call_frame_t *frame, xlator_t *this) +jbr_get_terms (call_frame_t *frame, xlator_t *this) { int32_t op_errno; char *cl_dir; @@ -472,7 +472,7 @@ nsr_get_terms (call_frame_t *frame, xlator_t *this) char *probe_str; dict_t *my_xdata = NULL; - op_errno = nsr_get_changelog_dir(this, &cl_dir); + op_errno = jbr_get_changelog_dir(this, &cl_dir); if (op_errno) { goto err; /* Error was already logged. */ } @@ -505,11 +505,11 @@ nsr_get_terms (call_frame_t *frame, xlator_t *this) /* +5 points to the character after the period */ term_num = atoi(rd_entry->d_name+5); gf_msg (this->name, GF_LOG_INFO, 0, - N_MSG_GENERIC, + J_MSG_GENERIC, "%s => %d", rd_entry->d_name, term_num); if (term_num < 0) { gf_msg (this->name, GF_LOG_ERROR, 0, - N_MSG_INVALID, + J_MSG_INVALID, "invalid term file name %s", rd_entry->d_name); op_errno = EINVAL; goto err; @@ -524,7 +524,7 @@ nsr_get_terms (call_frame_t *frame, xlator_t *this) if ((term_first < 0) || (term_last < 0)) { /* TBD: are we *sure* there should always be at least one? */ gf_msg (this->name, GF_LOG_ERROR, 0, - N_MSG_NO_DATA, "no terms found"); + J_MSG_NO_DATA, "no terms found"); op_errno = EINVAL; goto err; } @@ -540,7 +540,7 @@ nsr_get_terms (call_frame_t *frame, xlator_t *this) if (gf_asprintf(&probe_str, "%s/TERM.%d", cl_dir, term_contig-1) <= 0) { gf_msg (this->name, GF_LOG_ERROR, 0, - N_MSG_MEM_ERR, + J_MSG_MEM_ERR, "failed to format term %d", term_contig-1); goto err; } @@ -552,7 +552,7 @@ nsr_get_terms (call_frame_t *frame, xlator_t *this) } gf_msg (this->name, GF_LOG_INFO, 0, - N_MSG_GENERIC, + J_MSG_GENERIC, "found terms %d-%d (%d)", term_first, term_last, term_contig); @@ -560,25 +560,25 @@ nsr_get_terms (call_frame_t *frame, xlator_t *this) my_xdata = dict_new(); if (!my_xdata) { gf_msg (this->name, GF_LOG_ERROR, 0, - N_MSG_MEM_ERR, + J_MSG_MEM_ERR, "failed to allocate reply dictionary"); goto err; } if (dict_set_int32(my_xdata, "term-first", term_first) != 0) { gf_msg (this->name, GF_LOG_ERROR, 0, - N_MSG_DICT_FLR, + J_MSG_DICT_FLR, "failed to set term-first"); goto err; } if (dict_set_int32(my_xdata, "term-contig", term_contig) != 0) { gf_msg (this->name, GF_LOG_ERROR, 0, - N_MSG_DICT_FLR, + J_MSG_DICT_FLR, "failed to set term-contig"); goto err; } if (dict_set_int32(my_xdata, "term-last", term_last) != 0) { gf_msg (this->name, GF_LOG_ERROR, 0, - N_MSG_DICT_FLR, + J_MSG_DICT_FLR, "failed to set term-last"); goto err; } @@ -632,7 +632,7 @@ get_entry_count (xlator_t *this, int fd) if (sys_lseek(fd, 0, SEEK_SET) < 0) { gf_msg (this->name, GF_LOG_WARNING, 0, - N_MSG_SYS_CALL_FAILURE, + J_MSG_SYS_CALL_FAILURE, "failed to reset offset"); } return max; @@ -640,29 +640,29 @@ get_entry_count (xlator_t *this, int fd) void -nsr_open_term (call_frame_t *frame, xlator_t *this, dict_t *xdata) +jbr_open_term (call_frame_t *frame, xlator_t *this, dict_t *xdata) { int32_t op_errno; char *cl_dir; char *term; char *path; - nsr_private_t *priv = this->private; + jbr_private_t *priv = this->private; - op_errno = nsr_get_changelog_dir(this, &cl_dir); + op_errno = jbr_get_changelog_dir(this, &cl_dir); if (op_errno) { goto err; } if (dict_get_str(xdata, "term", &term) != 0) { gf_msg (this->name, GF_LOG_ERROR, 0, - N_MSG_NO_DATA, "missing term"); + J_MSG_NO_DATA, "missing term"); op_errno = ENODATA; goto err; } if (gf_asprintf(&path, "%s/TERM.%s", cl_dir, term) < 0) { gf_msg (this->name, GF_LOG_ERROR, 0, - N_MSG_MEM_ERR, "failed to construct path"); + J_MSG_MEM_ERR, "failed to construct path"); op_errno = ENOMEM; goto err; } @@ -674,7 +674,7 @@ nsr_open_term (call_frame_t *frame, xlator_t *this, dict_t *xdata) if (priv->term_fd < 0) { op_errno = errno; gf_msg (this->name, GF_LOG_ERROR, 0, - N_MSG_SYS_CALL_FAILURE, + J_MSG_SYS_CALL_FAILURE, "failed to open term file"); goto err; } @@ -682,7 +682,7 @@ nsr_open_term (call_frame_t *frame, xlator_t *this, dict_t *xdata) priv->term_total = get_entry_count(this, priv->term_fd); if (priv->term_total < 0) { gf_msg (this->name, GF_LOG_ERROR, 0, - N_MSG_NO_DATA, "failed to get entry count"); + J_MSG_NO_DATA, "failed to get entry count"); sys_close (priv->term_fd); priv->term_fd = -1; op_errno = EIO; @@ -700,10 +700,10 @@ err: void -nsr_next_entry (call_frame_t *frame, xlator_t *this) +jbr_next_entry (call_frame_t *frame, xlator_t *this) { int32_t op_errno = ENOMEM; - nsr_private_t *priv = this->private; + jbr_private_t *priv = this->private; ssize_t nbytes; dict_t *my_xdata; @@ -722,13 +722,13 @@ nsr_next_entry (call_frame_t *frame, xlator_t *this) if (nbytes < 0) { op_errno = errno; gf_msg (this->name, GF_LOG_ERROR, 0, - N_MSG_SYS_CALL_FAILURE, + J_MSG_SYS_CALL_FAILURE, "error reading next entry: %s", strerror(errno)); } else { op_errno = EIO; gf_msg (this->name, GF_LOG_ERROR, 0, - N_MSG_SYS_CALL_FAILURE, + J_MSG_SYS_CALL_FAILURE, "got %ld/%d bytes for next entry", nbytes, CHANGELOG_ENTRY_SIZE); } @@ -739,14 +739,14 @@ nsr_next_entry (call_frame_t *frame, xlator_t *this) my_xdata = dict_new(); if (!my_xdata) { gf_msg (this->name, GF_LOG_ERROR, 0, - N_MSG_MEM_ERR, "failed to allocate reply xdata"); + J_MSG_MEM_ERR, "failed to allocate reply xdata"); goto err; } if (dict_set_static_bin(my_xdata, "data", priv->term_buf, CHANGELOG_ENTRY_SIZE) != 0) { gf_msg (this->name, GF_LOG_ERROR, 0, - N_MSG_DICT_FLR, "failed to assign reply xdata"); + J_MSG_DICT_FLR, "failed to assign reply xdata"); goto err; } @@ -760,17 +760,17 @@ err: int32_t -nsr_ipc (call_frame_t *frame, xlator_t *this, int32_t op, dict_t *xdata) +jbr_ipc (call_frame_t *frame, xlator_t *this, int32_t op, dict_t *xdata) { switch (op) { - case NSR_SERVER_TERM_RANGE: - nsr_get_terms(frame, this); + case JBR_SERVER_TERM_RANGE: + jbr_get_terms(frame, this); break; - case NSR_SERVER_OPEN_TERM: - nsr_open_term(frame, this, xdata); + case JBR_SERVER_OPEN_TERM: + jbr_open_term(frame, this, xdata); break; - case NSR_SERVER_NEXT_ENTRY: - nsr_next_entry(frame, this); + case JBR_SERVER_NEXT_ENTRY: + jbr_next_entry(frame, this); break; default: STACK_WIND_TAIL (frame, @@ -784,7 +784,7 @@ nsr_ipc (call_frame_t *frame, xlator_t *this, int32_t op, dict_t *xdata) int32_t -nsr_forget (xlator_t *this, inode_t *inode) +jbr_forget (xlator_t *this, inode_t *inode) { uint64_t ctx = 0LL; @@ -796,7 +796,7 @@ nsr_forget (xlator_t *this, inode_t *inode) } int32_t -nsr_release (xlator_t *this, fd_t *fd) +jbr_release (xlator_t *this, fd_t *fd) { uint64_t ctx = 0LL; @@ -808,20 +808,20 @@ nsr_release (xlator_t *this, fd_t *fd) } struct xlator_cbks cbks = { - .forget = nsr_forget, - .release = nsr_release, + .forget = jbr_forget, + .release = jbr_release, }; int -nsr_reconfigure (xlator_t *this, dict_t *options) +jbr_reconfigure (xlator_t *this, dict_t *options) { - nsr_private_t *priv = this->private; + jbr_private_t *priv = this->private; GF_OPTION_RECONF ("leader", priv->config_leader, options, bool, err); GF_OPTION_RECONF ("quorum-percent", priv->quorum_pct, options, percent, err); - gf_msg (this->name, GF_LOG_INFO, 0, N_MSG_GENERIC, + gf_msg (this->name, GF_LOG_INFO, 0, J_MSG_GENERIC, "reconfigure called, config_leader = %d, quorum_pct = %.1f\n", priv->leader, priv->quorum_pct); @@ -834,7 +834,7 @@ err: } int -nsr_get_child_index (xlator_t *this, xlator_t *kid) +jbr_get_child_index (xlator_t *this, xlator_t *kid) { xlator_list_t *trav; int retval = -1; @@ -858,9 +858,9 @@ nsr_get_child_index (xlator_t *this, xlator_t *kid) * then generate counts on demand. */ int -nsr_notify (xlator_t *this, int event, void *data, ...) +jbr_notify (xlator_t *this, int event, void *data, ...) { - nsr_private_t *priv = this->private; + jbr_private_t *priv = this->private; int index = -1; int ret = -1; gf_boolean_t result = _gf_false; @@ -868,7 +868,7 @@ nsr_notify (xlator_t *this, int event, void *data, ...) switch (event) { case GF_EVENT_CHILD_UP: - index = nsr_get_child_index(this, data); + index = jbr_get_child_index(this, data); if (index >= 0) { /* Check if the child was previously down * and it's not a false CHILD_UP @@ -878,8 +878,8 @@ nsr_notify (xlator_t *this, int event, void *data, ...) } priv->kid_state |= (1 << index); - priv->up_children = nsr_count_up_kids(priv); - gf_msg (this->name, GF_LOG_INFO, 0, N_MSG_GENERIC, + priv->up_children = jbr_count_up_kids(priv); + gf_msg (this->name, GF_LOG_INFO, 0, J_MSG_GENERIC, "got CHILD_UP for %s, now %u kids", ((xlator_t *)data)->name, priv->up_children); @@ -905,12 +905,12 @@ nsr_notify (xlator_t *this, int event, void *data, ...) (double)(priv->up_children - 1)); if (result == _gf_false) { gf_msg (this->name, GF_LOG_INFO, 0, - N_MSG_GENERIC, "Not enough children " + J_MSG_GENERIC, "Not enough children " "are up to meet quorum. Waiting to " "send CHILD_UP from leader"); } else { gf_msg (this->name, GF_LOG_INFO, 0, - N_MSG_GENERIC, "Enough children are up " + J_MSG_GENERIC, "Enough children are up " "to meet quorum. Sending CHILD_UP " "from leader"); ret = default_notify(this, event, data); @@ -920,7 +920,7 @@ nsr_notify (xlator_t *this, int event, void *data, ...) } break; case GF_EVENT_CHILD_DOWN: - index = nsr_get_child_index(this, data); + index = jbr_get_child_index(this, data); if (index >= 0) { /* Check if the child was previously up * and it's not a false CHILD_DOWN @@ -929,8 +929,8 @@ nsr_notify (xlator_t *this, int event, void *data, ...) relevant = _gf_true; } priv->kid_state &= ~(1 << index); - priv->up_children = nsr_count_up_kids(priv); - gf_msg (this->name, GF_LOG_INFO, 0, N_MSG_GENERIC, + priv->up_children = jbr_count_up_kids(priv); + gf_msg (this->name, GF_LOG_INFO, 0, J_MSG_GENERIC, "got CHILD_DOWN for %s, now %u kids", ((xlator_t *)data)->name, priv->up_children); @@ -957,7 +957,7 @@ nsr_notify (xlator_t *this, int event, void *data, ...) (double)(priv->up_children - 1)); if (result == _gf_false) { gf_msg (this->name, GF_LOG_INFO, 0, - N_MSG_GENERIC, "Enough children are " + J_MSG_GENERIC, "Enough children are " "to down to fail quorum. " "Sending CHILD_DOWN from leader"); ret = default_notify(this, event, data); @@ -965,7 +965,7 @@ nsr_notify (xlator_t *this, int event, void *data, ...) priv->child_up = _gf_false; } else { gf_msg (this->name, GF_LOG_INFO, 0, - N_MSG_GENERIC, "Not enough children " + J_MSG_GENERIC, "Not enough children " "are down to fail quorum. Waiting to " "send CHILD_DOWN from leader"); } @@ -984,12 +984,12 @@ mem_acct_init (xlator_t *this) { int ret = -1; - GF_VALIDATE_OR_GOTO ("nsr", this, out); + GF_VALIDATE_OR_GOTO ("jbr", this, out); - ret = xlator_mem_acct_init (this, gf_mt_nsr_end + 1); + ret = xlator_mem_acct_init (this, gf_mt_jbr_end + 1); if (ret != 0) { - gf_msg (this->name, GF_LOG_ERROR, 0, N_MSG_MEM_ERR, + gf_msg (this->name, GF_LOG_ERROR, 0, J_MSG_MEM_ERR, "Memory accounting init" "failed"); return ret; } @@ -999,7 +999,7 @@ out: void -nsr_deallocate_priv (nsr_private_t *priv) +jbr_deallocate_priv (jbr_private_t *priv) { if (!priv) { return; @@ -1010,11 +1010,11 @@ nsr_deallocate_priv (nsr_private_t *priv) int32_t -nsr_init (xlator_t *this) +jbr_init (xlator_t *this) { xlator_list_t *remote; xlator_list_t *local; - nsr_private_t *priv = NULL; + jbr_private_t *priv = NULL; xlator_list_t *trav; pthread_t kid; extern xlator_t global_xlator; @@ -1027,34 +1027,34 @@ nsr_init (xlator_t *this) * this->fops because of some dynamic-linking strangeness; modifying * the static table doesn't work. */ - this->fops->getxattr = nsr_getxattr_special; - this->fops->fsync = nsr_fsync; - this->fops->ipc = nsr_ipc; + this->fops->getxattr = jbr_getxattr_special; + this->fops->fsync = jbr_fsync; + this->fops->ipc = jbr_ipc; local = this->children; if (!local) { - gf_msg (this->name, GF_LOG_ERROR, 0, N_MSG_NO_DATA, + gf_msg (this->name, GF_LOG_ERROR, 0, J_MSG_NO_DATA, "no local subvolume"); goto err; } remote = local->next; if (!remote) { - gf_msg (this->name, GF_LOG_ERROR, 0, N_MSG_NO_DATA, + gf_msg (this->name, GF_LOG_ERROR, 0, J_MSG_NO_DATA, "no remote subvolumes"); goto err; } - this->local_pool = mem_pool_new (nsr_local_t, 128); + this->local_pool = mem_pool_new (jbr_local_t, 128); if (!this->local_pool) { - gf_msg (this->name, GF_LOG_ERROR, 0, N_MSG_MEM_ERR, - "failed to create nsr_local_t pool"); + gf_msg (this->name, GF_LOG_ERROR, 0, J_MSG_MEM_ERR, + "failed to create jbr_local_t pool"); goto err; } - priv = GF_CALLOC (1, sizeof(*priv), gf_mt_nsr_private_t); + priv = GF_CALLOC (1, sizeof(*priv), gf_mt_jbr_private_t); if (!priv) { - gf_msg (this->name, GF_LOG_ERROR, 0, N_MSG_MEM_ERR, + gf_msg (this->name, GF_LOG_ERROR, 0, J_MSG_MEM_ERR, "could not allocate priv"); goto err; } @@ -1076,9 +1076,9 @@ nsr_init (xlator_t *this) priv->leader = priv->config_leader; priv->child_up = _gf_false; - if (pthread_create(&kid, NULL, nsr_flush_thread, + if (pthread_create(&kid, NULL, jbr_flush_thread, this) != 0) { - gf_msg (this->name, GF_LOG_ERROR, 0, N_MSG_SYS_CALL_FAILURE, + gf_msg (this->name, GF_LOG_ERROR, 0, J_MSG_SYS_CALL_FAILURE, "could not start flush thread"); /* TBD: treat this as a fatal error? */ } @@ -1096,22 +1096,22 @@ nsr_init (xlator_t *this) return 0; err: - nsr_deallocate_priv(priv); + jbr_deallocate_priv(priv); return -1; } void -nsr_fini (xlator_t *this) +jbr_fini (xlator_t *this) { - nsr_deallocate_priv(this->private); + jbr_deallocate_priv(this->private); } class_methods_t class_methods = { - .init = nsr_init, - .fini = nsr_fini, - .reconfigure = nsr_reconfigure, - .notify = nsr_notify, + .init = jbr_init, + .fini = jbr_fini, + .reconfigure = jbr_reconfigure, + .notify = jbr_notify, }; struct volume_options options[] = { @@ -1136,7 +1136,7 @@ struct volume_options options[] = { }, { .key = {"subvol-uuid"}, .type = GF_OPTION_TYPE_STR, - .description = "UUID for this NSR (sub)volume" + .description = "UUID for this JBR (sub)volume" }, { .key = {"quorum-percent"}, .type = GF_OPTION_TYPE_PERCENT, diff --git a/xlators/experimental/nsr-client/src/Makefile.am b/xlators/experimental/nsr-client/src/Makefile.am deleted file mode 100644 index 0dbba285cc9..00000000000 --- a/xlators/experimental/nsr-client/src/Makefile.am +++ /dev/null @@ -1,32 +0,0 @@ -xlator_LTLIBRARIES = nsrc.la -xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/experimental - -nodist_nsrc_la_SOURCES = nsrc-cg.c -CLEANFILES = $(nodist_nsrc_la_SOURCES) - -nsrc_la_LDFLAGS = -module -avoid-version -nsrc_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la - -noinst_HEADERS = \ - $(top_srcdir)/xlators/lib/src/libxlator.h \ - $(top_srcdir)/glusterfsd/src/glusterfsd.h \ - nsrc.h nsr-messages.h - -AM_CPPFLAGS = $(GF_CPPFLAGS) \ - -I$(top_srcdir)/libglusterfs/src -I$(top_srcdir)/xlators/lib/src \ - -I$(top_srcdir)/rpc/rpc-lib/src - -AM_CFLAGS = -Wall $(GF_CFLAGS) - -NSRC_PREFIX = $(top_srcdir)/xlators/experimental/nsr-client/src -NSRC_GEN_FOPS = $(NSRC_PREFIX)/gen-fops.py -NSRC_TEMPLATES = $(NSRC_PREFIX)/fop-template.c -NSRC_WRAPPER = $(NSRC_PREFIX)/nsrc.c -noinst_PYTHON = $(NSRC_GEN_FOPS) -EXTRA_DIST = $(NSRC_TEMPLATES) $(NSRC_WRAPPER) - -nsrc-cg.c: $(NSRC_GEN_FOPS) $(NSRC_TEMPLATES) $(NSRC_WRAPPER) - $(PYTHON) $(NSRC_GEN_FOPS) $(NSRC_TEMPLATES) $(NSRC_WRAPPER) > $@ - -uninstall-local: - rm -f $(DESTDIR)$(xlatordir)/nsr.so diff --git a/xlators/experimental/nsr-server/src/Makefile.am b/xlators/experimental/nsr-server/src/Makefile.am deleted file mode 100644 index 6c0597610a2..00000000000 --- a/xlators/experimental/nsr-server/src/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -xlator_LTLIBRARIES = nsr.la -xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/experimental - -nodist_nsr_la_SOURCES = nsr-cg.c -CLEANFILES = $(nodist_nsr_la_SOURCES) - -nsr_la_LDFLAGS = -module -avoid-version -nsr_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \ - $(top_builddir)/api/src/libgfapi.la - -noinst_HEADERS = nsr-internal.h \ - $(top_srcdir)/xlators/lib/src/libxlator.h \ - $(top_srcdir)/glusterfsd/src/glusterfsd.h - -AM_CPPFLAGS = $(GF_CPPFLAGS) \ - -I$(top_srcdir)/libglusterfs/src \ - -I$(top_srcdir)/xlators/lib/src \ - -I$(top_srcdir)/rpc/rpc-lib/src -DSBIN_DIR=\"$(sbindir)\" \ - -I$(top_srcdir)/api/src -DNSR_SCRIPT_PREFIX=\"$(nsrdir)\" \ - -I$(top_srcdir)/xlators/experimental/nsr-client/src/ - -AM_CFLAGS = -Wall $(GF_CFLAGS) - -NSR_PREFIX = $(top_srcdir)/xlators/experimental/nsr-server/src -NSR_GEN_FOPS = $(NSR_PREFIX)/gen-fops.py -NSR_TEMPLATES = $(NSR_PREFIX)/all-templates.c -NSR_WRAPPER = $(NSR_PREFIX)/nsr.c -noinst_PYTHON = $(NSR_GEN_FOPS) -EXTRA_DIST = $(NSR_TEMPLATES) $(NSR_WRAPPER) - -nsr-cg.c: $(NSR_GEN_FOPS) $(NSR_TEMPLATES) $(NSR_WRAPPER) - $(PYTHON) $(NSR_GEN_FOPS) $(NSR_TEMPLATES) $(NSR_WRAPPER) > $@ - -uninstall-local: - rm -f $(DESTDIR)$(xlatordir)/nsr.so diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index 44b3e777490..62a4f31cd69 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -1876,7 +1876,7 @@ add_one_peer (volgen_graph_t *graph, glusterd_brickinfo_t *peer, } int -add_nsr_stuff (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, +add_jbr_stuff (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, glusterd_brickinfo_t *brickinfo) { xlator_t *me; @@ -1886,8 +1886,8 @@ add_nsr_stuff (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, uint16_t index = 0; xlator_t *kid; - /* Create the NSR xlator, but defer linkage for now. */ - me = xlator_instantiate ("experimental/nsr", "%s-nsr", + /* Create the JBR xlator, but defer linkage for now. */ + me = xlator_instantiate ("experimental/jbr", "%s-jbr", volinfo->volname); if (!me || volgen_xlator_link(me, first_of(graph))) { return -1; @@ -1960,9 +1960,9 @@ brick_graph_add_index (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, if (!graph || !volinfo || !brickinfo || !set_dict) goto out; - /* For NSR we don't need/want index. */ - if (glusterd_volinfo_get_boolean(volinfo, "cluster.nsr") > 0) { - return add_nsr_stuff (graph, volinfo, brickinfo); + /* For JBR we don't need/want index. */ + if (glusterd_volinfo_get_boolean(volinfo, "cluster.jbr") > 0) { + return add_jbr_stuff (graph, volinfo, brickinfo); } xl = volgen_graph_add (graph, "features/index", volinfo->volname); @@ -3552,8 +3552,8 @@ volgen_graph_build_afr_clusters (volgen_graph_t *graph, char option[32] = {0}; int start_count = 0; - if (glusterd_volinfo_get_boolean(volinfo, "cluster.nsr") > 0) { - replicate_type = "experimental/nsrc"; + if (glusterd_volinfo_get_boolean(volinfo, "cluster.jbr") > 0) { + replicate_type = "experimental/jbrc"; } else { replicate_type = "cluster/replicate"; } @@ -5309,7 +5309,7 @@ assign_groups (glusterd_volinfo_t *volinfo) gf_uuid_generate(tmp_uuid); } brickinfo->group = group_num; - gf_uuid_copy(brickinfo->nsr_uuid, tmp_uuid); + gf_uuid_copy(brickinfo->jbr_uuid, tmp_uuid); if (++in_group >= volinfo->replica_count) { in_group = 0; ++group_num; @@ -5385,7 +5385,7 @@ generate_brick_volfiles (glusterd_volinfo_t *volinfo) } } - if (glusterd_volinfo_get_boolean(volinfo, "cluster.nsr") > 0) { + if (glusterd_volinfo_get_boolean(volinfo, "cluster.jbr") > 0) { assign_groups(volinfo); } diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c index ecec57b4159..40323bb7ece 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c @@ -2735,15 +2735,15 @@ struct volopt_map_entry glusterd_volopt_map[] = { .op_version = GD_OP_VERSION_3_7_6, .flags = OPT_FLAG_CLIENT_OPT }, - { .key = "cluster.nsr", - .voltype = "experimental/nsr", - .option = "!nsr", + { .key = "cluster.jbr", + .voltype = "experimental/jbr", + .option = "!jbr", .op_version = GD_OP_VERSION_4_0_0, - .description = "enable NSR instead of AFR for replication", + .description = "enable JBR instead of AFR for replication", .flags = OPT_FLAG_CLIENT_OPT | OPT_FLAG_XLATOR_OPT }, - { .key = "cluster.nsr.quorum-percent", - .voltype = "experimental/nsr", + { .key = "cluster.jbr.quorum-percent", + .voltype = "experimental/jbr", .option = "quorum-percent", .op_version = GD_OP_VERSION_4_0_0, .description = "percent of rep_count-1 bricks that must be up" diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h index 34e3e19d32c..587c2e82774 100644 --- a/xlators/mgmt/glusterd/src/glusterd.h +++ b/xlators/mgmt/glusterd/src/glusterd.h @@ -210,13 +210,13 @@ struct glusterd_brickinfo { int32_t snap_status; /* * The group is used to identify which bricks are part of the same - * replica set during brick-volfile generation, so that NSR volfiles + * replica set during brick-volfile generation, so that JBR volfiles * can "cross-connect" the bricks to one another. It is also used by * AFR to load the arbiter xlator in the appropriate brick in case of * a replica 3 volume with arbiter enabled. */ uint16_t group; - uuid_t nsr_uuid; + uuid_t jbr_uuid; }; typedef struct glusterd_brickinfo glusterd_brickinfo_t; |