From 3a23ffacdd7d14d3a525807cda452a865a7d11b7 Mon Sep 17 00:00:00 2001 From: Venky Shankar Date: Fri, 31 Jan 2014 11:58:00 +0530 Subject: features/changelog: remove dead code and fix compile warnings Change-Id: I869121a31c057a73534e59db91a7d2392037763a Signed-off-by: Venky Shankar --- .../src/policy/changelog-policy-replication.c | 117 +-------------------- 1 file changed, 1 insertion(+), 116 deletions(-) (limited to 'xlators/features') diff --git a/xlators/features/changelog/src/policy/changelog-policy-replication.c b/xlators/features/changelog/src/policy/changelog-policy-replication.c index 5c6fca4e0..1f6a6140e 100644 --- a/xlators/features/changelog/src/policy/changelog-policy-replication.c +++ b/xlators/features/changelog/src/policy/changelog-policy-replication.c @@ -19,40 +19,6 @@ #define PRE_OP_MARK 0x5F4552505FULL /* _PRE_ */ #define POST_OP_MARK 0x5F54534F505FULL /* _POST_ */ -/** - * assume an ever increasing index for now.. - */ -static unsigned long nsr_index = 1; - -static unsigned long -get_index(changelog_priv_t *priv) { - unsigned long idx = 0; - - LOCK (&priv->lock); - { - idx = nsr_index++; - } - UNLOCK (&priv->lock); - - return idx; -} - -static void -reset_index(changelog_priv_t *priv) { - nsr_index = 1; -} - - -#if 0 -static inline void -//changelog_replication_assign_term (changelog_priv_t *priv, - changelog_local_t *local) -{ - local->nr_bytes = 0; - local->lu.val = get_index (priv); -} -#endif - size_t number_fn (void *data, char *buffer, gf_boolean_t encode) { @@ -133,13 +99,12 @@ changelog_fix_term(xlator_t *this, // If coming via reconciliation, we should get the dicts "nsr-recon-term" // that indicates the term and "nsr-recon-index" for the index if ((dict_get_int32(xdata,NSR_TERM_XATTR,&new_term) == 0) && - (dict_get_int32(xdata, NSR_INDEX_XATTR, &index) == 0)) { + (dict_get_uint32(xdata, NSR_INDEX_XATTR, &index) == 0)) { old_term = priv->term; if (old_term != new_term) { GF_ASSERT(new_term > old_term); LOCK (&priv->lock); - reset_index(priv); priv->term = new_term; (void) snprintf (nfile, PATH_MAX, "%s.%d", JOURNAL_NAME, priv->term); @@ -185,11 +150,8 @@ changelog_replication_rmdir (call_frame_t *frame, xlator_t *this, int ret = -1; size_t xtra_len = 0; changelog_opt_t *co = NULL; - changelog_priv_t *priv = NULL; changelog_local_t *local = NULL; - priv = this->private; - /*
 + FOP + GFID + Entry */
         CHANGELOG_INIT_NOCHECK (this, local, NULL, loc->inode->gfid, 4);
         if (!local)
@@ -216,8 +178,6 @@ changelog_replication_rmdir (call_frame_t *frame, xlator_t *this,
 
         changelog_set_usable_record_and_length (local, xtra_len, 4);
 
-        //changelog_replication_assign_term (priv, local);
-
         frame->local = local;
         ret = 0;
 
@@ -241,11 +201,8 @@ changelog_replication_rename (call_frame_t *frame, xlator_t *this,
         int                ret      = -1;
         size_t             xtra_len = 0;
         changelog_opt_t   *co       = NULL;
-        changelog_priv_t  *priv     = NULL;
         changelog_local_t *local    = NULL;
 
-        priv = this->private;
-
         /* 
 + FOP + GFID + OLDLOC + NEWLOC */
         CHANGELOG_INIT_NOCHECK (this, local, NULL, oldloc->inode->gfid, 5);
         if (!local)
@@ -274,8 +231,6 @@ changelog_replication_rename (call_frame_t *frame, xlator_t *this,
         CHANGELOG_FILL_ENTRY (co, newloc->pargfid, newloc->name,
                               entry_fn, entry_free_fn, xtra_len, out);
 
-        //changelog_replication_assign_term (priv, local);
-
         changelog_set_usable_record_and_length (local, xtra_len, 5);
 
         frame->local = local;
@@ -295,11 +250,8 @@ changelog_replication_link (call_frame_t *frame,
         int                ret      = -1;
         size_t             xtra_len = 0;
         changelog_opt_t   *co       = NULL;
-        changelog_priv_t  *priv     = NULL;
         changelog_local_t *local    = NULL;
 
-        priv = this->private;
-
         /* 
 + FOP + GFID + Entry */
         CHANGELOG_INIT_NOCHECK (this, local, NULL, oldloc->gfid, 4);
         if (!local)
@@ -326,8 +278,6 @@ changelog_replication_link (call_frame_t *frame,
 
         changelog_set_usable_record_and_length (local, xtra_len, 4);
 
-        //changelog_replication_assign_term (priv, local);
-
         frame->local = local;
         ret = 0;
 
@@ -347,11 +297,8 @@ changelog_replication_mkdir (call_frame_t *frame,
         void              *uuid_req = NULL;
         size_t             xtra_len = 0;
         changelog_opt_t   *co       = NULL;
-        changelog_priv_t  *priv     = NULL;
         changelog_local_t *local    = NULL;
 
-        priv = this->private;
-
         ret = dict_get_ptr (xdata, "gfid-req", &uuid_req);
         if (ret) {
                 gf_log (this->name, GF_LOG_DEBUG,
@@ -388,8 +335,6 @@ changelog_replication_mkdir (call_frame_t *frame,
 
         changelog_set_usable_record_and_length (local, xtra_len, 4);
 
-        //changelog_replication_assign_term (priv, local);
-
         frame->local = local;
         ret = 0;
 
@@ -409,11 +354,8 @@ changelog_replication_symlink (call_frame_t *frame, xlator_t *this,
         uuid_t             gfid     = {0,};
         void              *uuid_req = NULL;
         changelog_opt_t   *co       = NULL;
-        changelog_priv_t  *priv     = NULL;
         changelog_local_t *local    = NULL;
 
-        priv = this->private;
-
         ret = dict_get_ptr (xdata, "gfid-req", &uuid_req);
         if (ret) {
                 gf_log (this->name, GF_LOG_DEBUG,
@@ -450,8 +392,6 @@ changelog_replication_symlink (call_frame_t *frame, xlator_t *this,
 
         changelog_set_usable_record_and_length (local, xtra_len, 4);
 
-        //changelog_replication_assign_term (priv, local);
-
         frame->local = local;
         ret = 0;
 
@@ -472,11 +412,8 @@ changelog_replication_mknod (call_frame_t *frame,
         void              *uuid_req = NULL;
         size_t             xtra_len = 0;
         changelog_opt_t   *co       = NULL;
-        changelog_priv_t  *priv     = NULL;
         changelog_local_t *local    = NULL;
 
-        priv = this->private;
-
         ret = dict_get_ptr (xdata, "gfid-req", &uuid_req);
         if (ret) {
                 gf_log (this->name, GF_LOG_DEBUG,
@@ -511,8 +448,6 @@ changelog_replication_mknod (call_frame_t *frame,
 
         changelog_set_usable_record_and_length (local, xtra_len, 4);
 
-        //changelog_replication_assign_term (priv, local);
-
         frame->local = local;
         ret = 0;
 
@@ -532,11 +467,8 @@ changelog_replication_create (call_frame_t *frame, xlator_t *this,
         void              *uuid_req = NULL;
         size_t             xtra_len = 0;
         changelog_opt_t   *co       = NULL;
-        changelog_priv_t  *priv     = NULL;
         changelog_local_t *local    = NULL;
 
-        priv = this->private;
-
         ret = dict_get_ptr (xdata, "gfid-req", &uuid_req);
         if (ret) {
                 gf_log (this->name, GF_LOG_DEBUG,
@@ -571,8 +503,6 @@ changelog_replication_create (call_frame_t *frame, xlator_t *this,
 
         changelog_set_usable_record_and_length (local, xtra_len, 4);
 
-        //changelog_replication_assign_term (priv, local);
-
         frame->local = local;
         ret = 0;
 
@@ -591,11 +521,8 @@ changelog_replication_fsetattr (call_frame_t *frame,
         int                ret      = -1;
         size_t             xtra_len = 0;
         changelog_opt_t   *co       = NULL;
-        changelog_priv_t  *priv     = NULL;
         changelog_local_t *local    = NULL;
 
-        priv = this->private;
-
         /* 
 + FOP + GFID */
         CHANGELOG_INIT_NOCHECK (this, local, NULL, fd->inode->gfid, 3);
         if (!local)
@@ -618,8 +545,6 @@ changelog_replication_fsetattr (call_frame_t *frame,
 
         changelog_set_usable_record_and_length (local, xtra_len, 3);
 
-        //changelog_replication_assign_term (priv, local);
-
         frame->local = local;
         ret = 0;
 
@@ -637,11 +562,8 @@ changelog_replication_setattr (call_frame_t *frame,
         int                ret      = -1;
         size_t             xtra_len = 0;
         changelog_opt_t   *co       = NULL;
-        changelog_priv_t  *priv     = NULL;
         changelog_local_t *local    = NULL;
 
-        priv = this->private;
-
         /* 
 + FOP + GFID */
         CHANGELOG_INIT_NOCHECK (this, local, NULL, loc->inode->gfid, 3);
         if (!local)
@@ -664,8 +586,6 @@ changelog_replication_setattr (call_frame_t *frame,
 
         changelog_set_usable_record_and_length (local, xtra_len, 3);
 
-        //changelog_replication_assign_term (priv, local);
-
         frame->local = local;
         ret = 0;
 
@@ -682,12 +602,9 @@ changelog_replication_fremovexattr (call_frame_t *frame, xlator_t *this,
         int                ret      = -1;
         size_t             xtra_len = 0;
         changelog_opt_t   *co       = NULL;
-        changelog_priv_t  *priv     = NULL;
         changelog_local_t *local    = NULL;
         int32_t            xattr_op;
 
-        priv = this->private;
-
         /* 
 + FOP + GFID */
         CHANGELOG_INIT_NOCHECK (this, local, NULL, fd->inode->gfid, 3);
         if (!local)
@@ -717,8 +634,6 @@ changelog_replication_fremovexattr (call_frame_t *frame, xlator_t *this,
 
         changelog_set_usable_record_and_length (local, xtra_len, 3);
 
-        //changelog_replication_assign_term (priv, local);
-
         frame->local = local;
         ret = 0;
 
@@ -735,12 +650,9 @@ changelog_replication_removexattr (call_frame_t *frame, xlator_t *this,
         int                ret      = -1;
         size_t             xtra_len = 0;
         changelog_opt_t   *co       = NULL;
-        changelog_priv_t  *priv     = NULL;
         changelog_local_t *local    = NULL;
         int32_t            xattr_op;
 
-        priv = this->private;
-
         CHANGELOG_INIT_NOCHECK (this, local, NULL, loc->inode->gfid, 3);
         if (!local)
                 goto out;
@@ -769,8 +681,6 @@ changelog_replication_removexattr (call_frame_t *frame, xlator_t *this,
 
         changelog_set_usable_record_and_length (local, xtra_len, 3);
 
-        //changelog_replication_assign_term (priv, local);
-
         frame->local = local;
         ret = 0;
 
@@ -788,12 +698,9 @@ changelog_replication_setxattr (call_frame_t *frame,
         int                ret      = -1;
         size_t             xtra_len = 0;
         changelog_opt_t   *co       = NULL;
-        changelog_priv_t  *priv     = NULL;
         changelog_local_t *local    = NULL;
         int32_t            xattr_op;
 
-        priv = this->private;
-
         /* 
 + FOP + GFID */
         CHANGELOG_INIT_NOCHECK (this, local, NULL, loc->inode->gfid, 3);
         if (!local)
@@ -823,8 +730,6 @@ changelog_replication_setxattr (call_frame_t *frame,
 
         changelog_set_usable_record_and_length (local, xtra_len, 3);
 
-        //changelog_replication_assign_term (priv, local);
-
         frame->local = local;
         ret = 0;
 
@@ -842,12 +747,9 @@ changelog_replication_fsetxattr (call_frame_t *frame,
         int                ret      = -1;
         size_t             xtra_len = 0;
         changelog_opt_t   *co       = NULL;
-        changelog_priv_t  *priv     = NULL;
         changelog_local_t *local    = NULL;
         int32_t            xattr_op;
 
-        priv = this->private;
-
         /* 
 + FOP + GFID */
         CHANGELOG_INIT_NOCHECK (this, local, NULL, fd->inode->gfid, 3);
         if (!local)
@@ -878,8 +780,6 @@ changelog_replication_fsetxattr (call_frame_t *frame,
 
         changelog_set_usable_record_and_length (local, xtra_len, 3);
 
-        //changelog_replication_assign_term (priv, local);
-
         frame->local = local;
         ret = 0;
 
@@ -897,11 +797,8 @@ changelog_replication_truncate (call_frame_t *frame,
         int                ret      = -1;
         size_t             xtra_len = 0;
         changelog_opt_t   *co       = NULL;
-        changelog_priv_t  *priv     = NULL;
         changelog_local_t *local    = NULL;
 
-        priv = this->private;
-
         /* 
 + FOP + GFID + Offset */
         CHANGELOG_INIT_NOCHECK (this, local, NULL, loc->inode->gfid, 4);
         if (!local)
@@ -927,8 +824,6 @@ changelog_replication_truncate (call_frame_t *frame,
 
         changelog_set_usable_record_and_length (local, xtra_len, 4);
 
-        //changelog_replication_assign_term (priv, local);
-
         frame->local = local;
         ret = 0;
 
@@ -946,11 +841,8 @@ changelog_replication_ftruncate (call_frame_t *frame,
         int                ret      = -1;
         size_t             xtra_len = 0;
         changelog_opt_t   *co       = NULL;
-        changelog_priv_t  *priv     = NULL;
         changelog_local_t *local    = NULL;
 
-        priv = this->private;
-
         /* 
 + FOP + GFID + Offset */
         CHANGELOG_INIT_NOCHECK (this, local, NULL, fd->inode->gfid, 4);
         if (!local)
@@ -976,8 +868,6 @@ changelog_replication_ftruncate (call_frame_t *frame,
 
         changelog_set_usable_record_and_length (local, xtra_len, 4);
 
-        //changelog_replication_assign_term (priv, local);
-
         frame->local = local;
         ret = 0;
 
@@ -996,11 +886,8 @@ changelog_replication_writev (call_frame_t *frame,
         int                ret      = -1;
         size_t             xtra_len = 0;
         changelog_opt_t   *co       = NULL;
-        changelog_priv_t  *priv     = NULL;
         changelog_local_t *local    = NULL;
 
-        priv = this->private;
-
         /* 
 + FOP + GFID + Offset + Length */
         CHANGELOG_INIT_NOCHECK (this, local, NULL, fd->inode->gfid, 5);
         if (!local)
@@ -1030,8 +917,6 @@ changelog_replication_writev (call_frame_t *frame,
 
         changelog_set_usable_record_and_length (local, xtra_len, 5);
 
-        //changelog_replication_assign_term (priv, local);
-
         frame->local = local;
         ret = 0;
 
-- 
cgit