|
|
7c2869 |
From 07d47befe41ed54c0340e297e7f1ce9bf87bc3e6 Mon Sep 17 00:00:00 2001
|
|
|
7c2869 |
From: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
7c2869 |
Date: Fri, 2 Mar 2018 12:37:42 +0530
|
|
|
7c2869 |
Subject: [PATCH 671/675] cluster/afr: Remove unused code paths
|
|
|
7c2869 |
|
|
|
7c2869 |
Removed
|
|
|
7c2869 |
1) afr-v1 self-heal locks related code which is not used anymore
|
|
|
7c2869 |
2) transaction has some data types that are not needed, so removed them
|
|
|
7c2869 |
3) Never used lock tracing available in afr as gluster's network tracing does
|
|
|
7c2869 |
the job. So removed that as well.
|
|
|
7c2869 |
4) Changelog is always enabled and afr is always used with locks, so
|
|
|
7c2869 |
__changelog_enabled, afr_lock_server_count etc functions can be deleted.
|
|
|
7c2869 |
5) transaction.fop/done/resume always call the same functions, so no need
|
|
|
7c2869 |
to have these variables.
|
|
|
7c2869 |
|
|
|
7c2869 |
> BUG: 1549606
|
|
|
7c2869 |
|
|
|
7c2869 |
Change-Id: Ie33a3c8f9ddbe6741f0950d961af3d4daf497a8a
|
|
|
7c2869 |
Upstream-patch: https://review.gluster.org/19661
|
|
|
7c2869 |
BUG: 1583733
|
|
|
7c2869 |
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
7c2869 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/140576
|
|
|
7c2869 |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
7c2869 |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
7c2869 |
---
|
|
|
7c2869 |
xlators/cluster/afr/src/afr-common.c | 10 +-
|
|
|
7c2869 |
xlators/cluster/afr/src/afr-dir-write.c | 18 +-
|
|
|
7c2869 |
xlators/cluster/afr/src/afr-inode-write.c | 39 +--
|
|
|
7c2869 |
xlators/cluster/afr/src/afr-lk-common.c | 508 +-----------------------------
|
|
|
7c2869 |
xlators/cluster/afr/src/afr-transaction.c | 137 +-------
|
|
|
7c2869 |
xlators/cluster/afr/src/afr-transaction.h | 2 -
|
|
|
7c2869 |
xlators/cluster/afr/src/afr.c | 35 +-
|
|
|
7c2869 |
xlators/cluster/afr/src/afr.h | 52 +--
|
|
|
7c2869 |
xlators/cluster/afr/src/pump.c | 3 -
|
|
|
7c2869 |
9 files changed, 41 insertions(+), 763 deletions(-)
|
|
|
7c2869 |
|
|
|
7c2869 |
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
|
|
|
7c2869 |
index bffa71b..708182a 100644
|
|
|
7c2869 |
--- a/xlators/cluster/afr/src/afr-common.c
|
|
|
7c2869 |
+++ b/xlators/cluster/afr/src/afr-common.c
|
|
|
7c2869 |
@@ -4294,9 +4294,6 @@ afr_priv_dump (xlator_t *this)
|
|
|
7c2869 |
gf_proc_dump_write("data_self_heal", "%s", priv->data_self_heal);
|
|
|
7c2869 |
gf_proc_dump_write("metadata_self_heal", "%d", priv->metadata_self_heal);
|
|
|
7c2869 |
gf_proc_dump_write("entry_self_heal", "%d", priv->entry_self_heal);
|
|
|
7c2869 |
- gf_proc_dump_write("data_change_log", "%d", priv->data_change_log);
|
|
|
7c2869 |
- gf_proc_dump_write("metadata_change_log", "%d", priv->metadata_change_log);
|
|
|
7c2869 |
- gf_proc_dump_write("entry-change_log", "%d", priv->entry_change_log);
|
|
|
7c2869 |
gf_proc_dump_write("read_child", "%d", priv->read_child);
|
|
|
7c2869 |
gf_proc_dump_write("favorite_child", "%d", priv->favorite_child);
|
|
|
7c2869 |
gf_proc_dump_write("wait_count", "%u", priv->wait_count);
|
|
|
7c2869 |
@@ -4753,8 +4750,7 @@ out:
|
|
|
7c2869 |
}
|
|
|
7c2869 |
|
|
|
7c2869 |
int
|
|
|
7c2869 |
-afr_internal_lock_init (afr_internal_lock_t *lk, size_t child_count,
|
|
|
7c2869 |
- transaction_lk_type_t lk_type)
|
|
|
7c2869 |
+afr_internal_lock_init (afr_internal_lock_t *lk, size_t child_count)
|
|
|
7c2869 |
{
|
|
|
7c2869 |
int ret = -ENOMEM;
|
|
|
7c2869 |
|
|
|
7c2869 |
@@ -4770,7 +4766,6 @@ afr_internal_lock_init (afr_internal_lock_t *lk, size_t child_count,
|
|
|
7c2869 |
|
|
|
7c2869 |
lk->lock_op_ret = -1;
|
|
|
7c2869 |
lk->lock_op_errno = EUCLEAN;
|
|
|
7c2869 |
- lk->transaction_lk_type = lk_type;
|
|
|
7c2869 |
|
|
|
7c2869 |
ret = 0;
|
|
|
7c2869 |
out:
|
|
|
7c2869 |
@@ -4837,8 +4832,7 @@ afr_transaction_local_init (afr_local_t *local, xlator_t *this)
|
|
|
7c2869 |
afr_private_t *priv = NULL;
|
|
|
7c2869 |
|
|
|
7c2869 |
priv = this->private;
|
|
|
7c2869 |
- ret = afr_internal_lock_init (&local->internal_lock, priv->child_count,
|
|
|
7c2869 |
- AFR_TRANSACTION_LK);
|
|
|
7c2869 |
+ ret = afr_internal_lock_init (&local->internal_lock, priv->child_count);
|
|
|
7c2869 |
if (ret < 0)
|
|
|
7c2869 |
goto out;
|
|
|
7c2869 |
|
|
|
7c2869 |
diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c
|
|
|
7c2869 |
index 9099b8c..408c7de 100644
|
|
|
7c2869 |
--- a/xlators/cluster/afr/src/afr-dir-write.c
|
|
|
7c2869 |
+++ b/xlators/cluster/afr/src/afr-dir-write.c
|
|
|
7c2869 |
@@ -267,7 +267,7 @@ __afr_dir_write_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7c2869 |
|
|
|
7c2869 |
afr_mark_entry_pending_changelog (frame, this);
|
|
|
7c2869 |
|
|
|
7c2869 |
- local->transaction.resume (frame, this);
|
|
|
7c2869 |
+ afr_transaction_resume (frame, this);
|
|
|
7c2869 |
}
|
|
|
7c2869 |
|
|
|
7c2869 |
return 0;
|
|
|
7c2869 |
@@ -496,8 +496,6 @@ afr_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
|
|
|
7c2869 |
goto out;
|
|
|
7c2869 |
|
|
|
7c2869 |
local->transaction.wind = afr_create_wind;
|
|
|
7c2869 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
7c2869 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
7c2869 |
local->transaction.unwind = afr_create_unwind;
|
|
|
7c2869 |
|
|
|
7c2869 |
ret = afr_build_parent_loc (&local->transaction.parent_loc, loc,
|
|
|
7c2869 |
@@ -626,8 +624,6 @@ afr_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
|
|
|
7c2869 |
goto out;
|
|
|
7c2869 |
|
|
|
7c2869 |
local->transaction.wind = afr_mknod_wind;
|
|
|
7c2869 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
7c2869 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
7c2869 |
local->transaction.unwind = afr_mknod_unwind;
|
|
|
7c2869 |
|
|
|
7c2869 |
ret = afr_build_parent_loc (&local->transaction.parent_loc, loc,
|
|
|
7c2869 |
@@ -762,8 +758,6 @@ afr_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
|
|
|
7c2869 |
|
|
|
7c2869 |
local->op = GF_FOP_MKDIR;
|
|
|
7c2869 |
local->transaction.wind = afr_mkdir_wind;
|
|
|
7c2869 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
7c2869 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
7c2869 |
local->transaction.unwind = afr_mkdir_unwind;
|
|
|
7c2869 |
|
|
|
7c2869 |
ret = afr_build_parent_loc (&local->transaction.parent_loc, loc,
|
|
|
7c2869 |
@@ -891,8 +885,6 @@ afr_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc,
|
|
|
7c2869 |
local->op = GF_FOP_LINK;
|
|
|
7c2869 |
|
|
|
7c2869 |
local->transaction.wind = afr_link_wind;
|
|
|
7c2869 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
7c2869 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
7c2869 |
local->transaction.unwind = afr_link_unwind;
|
|
|
7c2869 |
|
|
|
7c2869 |
ret = afr_build_parent_loc (&local->transaction.parent_loc, newloc,
|
|
|
7c2869 |
@@ -1021,8 +1013,6 @@ afr_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath,
|
|
|
7c2869 |
|
|
|
7c2869 |
local->op = GF_FOP_SYMLINK;
|
|
|
7c2869 |
local->transaction.wind = afr_symlink_wind;
|
|
|
7c2869 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
7c2869 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
7c2869 |
local->transaction.unwind = afr_symlink_unwind;
|
|
|
7c2869 |
|
|
|
7c2869 |
ret = afr_build_parent_loc (&local->transaction.parent_loc, loc,
|
|
|
7c2869 |
@@ -1156,8 +1146,6 @@ afr_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc,
|
|
|
7c2869 |
|
|
|
7c2869 |
local->op = GF_FOP_RENAME;
|
|
|
7c2869 |
local->transaction.wind = afr_rename_wind;
|
|
|
7c2869 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
7c2869 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
7c2869 |
local->transaction.unwind = afr_rename_unwind;
|
|
|
7c2869 |
|
|
|
7c2869 |
ret = afr_build_parent_loc (&local->transaction.parent_loc, oldloc,
|
|
|
7c2869 |
@@ -1308,8 +1296,6 @@ afr_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag,
|
|
|
7c2869 |
|
|
|
7c2869 |
local->op = GF_FOP_UNLINK;
|
|
|
7c2869 |
local->transaction.wind = afr_unlink_wind;
|
|
|
7c2869 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
7c2869 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
7c2869 |
local->transaction.unwind = afr_unlink_unwind;
|
|
|
7c2869 |
|
|
|
7c2869 |
ret = afr_build_parent_loc (&local->transaction.parent_loc, loc,
|
|
|
7c2869 |
@@ -1436,8 +1422,6 @@ afr_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags,
|
|
|
7c2869 |
|
|
|
7c2869 |
local->op = GF_FOP_RMDIR;
|
|
|
7c2869 |
local->transaction.wind = afr_rmdir_wind;
|
|
|
7c2869 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
7c2869 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
7c2869 |
local->transaction.unwind = afr_rmdir_unwind;
|
|
|
7c2869 |
|
|
|
7c2869 |
ret = afr_build_parent_loc (&local->transaction.parent_loc, loc,
|
|
|
7c2869 |
diff --git a/xlators/cluster/afr/src/afr-inode-write.c b/xlators/cluster/afr/src/afr-inode-write.c
|
|
|
7c2869 |
index c740599..e0f6541 100644
|
|
|
7c2869 |
--- a/xlators/cluster/afr/src/afr-inode-write.c
|
|
|
7c2869 |
+++ b/xlators/cluster/afr/src/afr-inode-write.c
|
|
|
7c2869 |
@@ -207,7 +207,7 @@ __afr_inode_write_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7c2869 |
local->transaction.unwind (frame, this);
|
|
|
7c2869 |
}
|
|
|
7c2869 |
|
|
|
7c2869 |
- local->transaction.resume (frame, this);
|
|
|
7c2869 |
+ afr_transaction_resume (frame, this);
|
|
|
7c2869 |
}
|
|
|
7c2869 |
|
|
|
7c2869 |
return 0;
|
|
|
7c2869 |
@@ -357,14 +357,11 @@ afr_writev_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7c2869 |
int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
|
|
|
7c2869 |
struct iatt *postbuf, dict_t *xdata)
|
|
|
7c2869 |
{
|
|
|
7c2869 |
- afr_local_t *local = NULL;
|
|
|
7c2869 |
call_frame_t *fop_frame = NULL;
|
|
|
7c2869 |
int child_index = (long) cookie;
|
|
|
7c2869 |
int call_count = -1;
|
|
|
7c2869 |
int ret = 0;
|
|
|
7c2869 |
|
|
|
7c2869 |
- local = frame->local;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
afr_inode_write_fill (frame, this, child_index, op_ret, op_errno,
|
|
|
7c2869 |
prebuf, postbuf, xdata);
|
|
|
7c2869 |
|
|
|
7c2869 |
@@ -375,7 +372,7 @@ afr_writev_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7c2869 |
|
|
|
7c2869 |
if (!afr_txn_nothing_failed (frame, this)) {
|
|
|
7c2869 |
//Don't unwind until post-op is complete
|
|
|
7c2869 |
- local->transaction.resume (frame, this);
|
|
|
7c2869 |
+ afr_transaction_resume (frame, this);
|
|
|
7c2869 |
} else {
|
|
|
7c2869 |
/*
|
|
|
7c2869 |
* Generally inode-write fops do transaction.unwind then
|
|
|
7c2869 |
@@ -390,7 +387,7 @@ afr_writev_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7c2869 |
|
|
|
7c2869 |
fop_frame = afr_transaction_detach_fop_frame (frame);
|
|
|
7c2869 |
afr_writev_copy_outvars (frame, fop_frame);
|
|
|
7c2869 |
- local->transaction.resume (frame, this);
|
|
|
7c2869 |
+ afr_transaction_resume (frame, this);
|
|
|
7c2869 |
afr_writev_unwind (fop_frame, this);
|
|
|
7c2869 |
}
|
|
|
7c2869 |
}
|
|
|
7c2869 |
@@ -463,8 +460,6 @@ afr_do_writev (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
local->op = GF_FOP_WRITE;
|
|
|
7c2869 |
|
|
|
7c2869 |
local->transaction.wind = afr_writev_wind;
|
|
|
7c2869 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
7c2869 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
7c2869 |
local->transaction.unwind = afr_transaction_writev_unwind;
|
|
|
7c2869 |
|
|
|
7c2869 |
local->transaction.main_frame = frame;
|
|
|
7c2869 |
@@ -650,8 +645,6 @@ afr_truncate (call_frame_t *frame, xlator_t *this,
|
|
|
7c2869 |
goto out;
|
|
|
7c2869 |
|
|
|
7c2869 |
local->transaction.wind = afr_truncate_wind;
|
|
|
7c2869 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
7c2869 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
7c2869 |
local->transaction.unwind = afr_truncate_unwind;
|
|
|
7c2869 |
|
|
|
7c2869 |
loc_copy (&local->loc, loc);
|
|
|
7c2869 |
@@ -774,8 +767,6 @@ afr_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
|
|
|
7c2869 |
local->op = GF_FOP_FTRUNCATE;
|
|
|
7c2869 |
|
|
|
7c2869 |
local->transaction.wind = afr_ftruncate_wind;
|
|
|
7c2869 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
7c2869 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
7c2869 |
local->transaction.unwind = afr_ftruncate_unwind;
|
|
|
7c2869 |
|
|
|
7c2869 |
local->transaction.main_frame = frame;
|
|
|
7c2869 |
@@ -882,8 +873,6 @@ afr_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, struct iatt *buf,
|
|
|
7c2869 |
goto out;
|
|
|
7c2869 |
|
|
|
7c2869 |
local->transaction.wind = afr_setattr_wind;
|
|
|
7c2869 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
7c2869 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
7c2869 |
local->transaction.unwind = afr_setattr_unwind;
|
|
|
7c2869 |
|
|
|
7c2869 |
loc_copy (&local->loc, loc);
|
|
|
7c2869 |
@@ -987,8 +976,6 @@ afr_fsetattr (call_frame_t *frame, xlator_t *this,
|
|
|
7c2869 |
goto out;
|
|
|
7c2869 |
|
|
|
7c2869 |
local->transaction.wind = afr_fsetattr_wind;
|
|
|
7c2869 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
7c2869 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
7c2869 |
local->transaction.unwind = afr_fsetattr_unwind;
|
|
|
7c2869 |
|
|
|
7c2869 |
local->fd = fd_ref (fd);
|
|
|
7c2869 |
@@ -1629,8 +1616,6 @@ afr_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
|
|
|
7c2869 |
goto out;
|
|
|
7c2869 |
|
|
|
7c2869 |
local->transaction.wind = afr_setxattr_wind;
|
|
|
7c2869 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
7c2869 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
7c2869 |
local->transaction.unwind = afr_setxattr_unwind;
|
|
|
7c2869 |
|
|
|
7c2869 |
loc_copy (&local->loc, loc);
|
|
|
7c2869 |
@@ -1741,8 +1726,6 @@ afr_fsetxattr (call_frame_t *frame, xlator_t *this,
|
|
|
7c2869 |
goto out;
|
|
|
7c2869 |
|
|
|
7c2869 |
local->transaction.wind = afr_fsetxattr_wind;
|
|
|
7c2869 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
7c2869 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
7c2869 |
local->transaction.unwind = afr_fsetxattr_unwind;
|
|
|
7c2869 |
|
|
|
7c2869 |
local->fd = fd_ref (fd);
|
|
|
7c2869 |
@@ -1854,8 +1837,6 @@ afr_removexattr (call_frame_t *frame, xlator_t *this,
|
|
|
7c2869 |
goto out;
|
|
|
7c2869 |
|
|
|
7c2869 |
local->transaction.wind = afr_removexattr_wind;
|
|
|
7c2869 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
7c2869 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
7c2869 |
local->transaction.unwind = afr_removexattr_unwind;
|
|
|
7c2869 |
|
|
|
7c2869 |
loc_copy (&local->loc, loc);
|
|
|
7c2869 |
@@ -1961,8 +1942,6 @@ afr_fremovexattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
|
|
|
7c2869 |
goto out;
|
|
|
7c2869 |
|
|
|
7c2869 |
local->transaction.wind = afr_fremovexattr_wind;
|
|
|
7c2869 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
7c2869 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
7c2869 |
local->transaction.unwind = afr_fremovexattr_unwind;
|
|
|
7c2869 |
|
|
|
7c2869 |
local->fd = fd_ref (fd);
|
|
|
7c2869 |
@@ -2074,8 +2053,6 @@ afr_fallocate (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode,
|
|
|
7c2869 |
local->op = GF_FOP_FALLOCATE;
|
|
|
7c2869 |
|
|
|
7c2869 |
local->transaction.wind = afr_fallocate_wind;
|
|
|
7c2869 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
7c2869 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
7c2869 |
local->transaction.unwind = afr_fallocate_unwind;
|
|
|
7c2869 |
|
|
|
7c2869 |
local->transaction.main_frame = frame;
|
|
|
7c2869 |
@@ -2186,8 +2163,6 @@ afr_discard (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
|
|
|
7c2869 |
local->op = GF_FOP_DISCARD;
|
|
|
7c2869 |
|
|
|
7c2869 |
local->transaction.wind = afr_discard_wind;
|
|
|
7c2869 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
7c2869 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
7c2869 |
local->transaction.unwind = afr_discard_unwind;
|
|
|
7c2869 |
|
|
|
7c2869 |
local->transaction.main_frame = frame;
|
|
|
7c2869 |
@@ -2295,8 +2270,6 @@ afr_zerofill (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
|
|
|
7c2869 |
local->op = GF_FOP_ZEROFILL;
|
|
|
7c2869 |
|
|
|
7c2869 |
local->transaction.wind = afr_zerofill_wind;
|
|
|
7c2869 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
7c2869 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
7c2869 |
local->transaction.unwind = afr_zerofill_unwind;
|
|
|
7c2869 |
|
|
|
7c2869 |
local->transaction.main_frame = frame;
|
|
|
7c2869 |
@@ -2389,8 +2362,6 @@ afr_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc,
|
|
|
7c2869 |
local->xdata_req = dict_ref (xdata);
|
|
|
7c2869 |
|
|
|
7c2869 |
local->transaction.wind = afr_xattrop_wind;
|
|
|
7c2869 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
7c2869 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
7c2869 |
local->transaction.unwind = afr_xattrop_unwind;
|
|
|
7c2869 |
|
|
|
7c2869 |
loc_copy (&local->loc, loc);
|
|
|
7c2869 |
@@ -2483,8 +2454,6 @@ afr_fxattrop (call_frame_t *frame, xlator_t *this, fd_t *fd,
|
|
|
7c2869 |
local->xdata_req = dict_ref (xdata);
|
|
|
7c2869 |
|
|
|
7c2869 |
local->transaction.wind = afr_fxattrop_wind;
|
|
|
7c2869 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
7c2869 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
7c2869 |
local->transaction.unwind = afr_fxattrop_unwind;
|
|
|
7c2869 |
|
|
|
7c2869 |
local->fd = fd_ref (fd);
|
|
|
7c2869 |
@@ -2596,8 +2565,6 @@ afr_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t datasync,
|
|
|
7c2869 |
}
|
|
|
7c2869 |
|
|
|
7c2869 |
local->transaction.wind = afr_fsync_wind;
|
|
|
7c2869 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
7c2869 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
7c2869 |
local->transaction.unwind = afr_fsync_unwind;
|
|
|
7c2869 |
|
|
|
7c2869 |
local->transaction.main_frame = frame;
|
|
|
7c2869 |
diff --git a/xlators/cluster/afr/src/afr-lk-common.c b/xlators/cluster/afr/src/afr-lk-common.c
|
|
|
7c2869 |
index 6019454..38cc87b 100644
|
|
|
7c2869 |
--- a/xlators/cluster/afr/src/afr-lk-common.c
|
|
|
7c2869 |
+++ b/xlators/cluster/afr/src/afr-lk-common.c
|
|
|
7c2869 |
@@ -23,38 +23,6 @@
|
|
|
7c2869 |
#define LOCKED_YES 0x1 /* for DATA, METADATA, ENTRY and higher_path */
|
|
|
7c2869 |
#define LOCKED_LOWER 0x2 /* for lower path */
|
|
|
7c2869 |
|
|
|
7c2869 |
-#define AFR_TRACE_INODELK_IN(frame, this, params ...) \
|
|
|
7c2869 |
- do { \
|
|
|
7c2869 |
- afr_private_t *_priv = this->private; \
|
|
|
7c2869 |
- if (!_priv->inodelk_trace) \
|
|
|
7c2869 |
- break; \
|
|
|
7c2869 |
- afr_trace_inodelk_in (frame, this, params); \
|
|
|
7c2869 |
- } while (0);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-#define AFR_TRACE_INODELK_OUT(frame, this, params ...) \
|
|
|
7c2869 |
- do { \
|
|
|
7c2869 |
- afr_private_t *_priv = this->private; \
|
|
|
7c2869 |
- if (!_priv->inodelk_trace) \
|
|
|
7c2869 |
- break; \
|
|
|
7c2869 |
- afr_trace_inodelk_out (frame, this, params); \
|
|
|
7c2869 |
- } while (0);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-#define AFR_TRACE_ENTRYLK_IN(frame, this, params ...) \
|
|
|
7c2869 |
- do { \
|
|
|
7c2869 |
- afr_private_t *_priv = this->private; \
|
|
|
7c2869 |
- if (!_priv->entrylk_trace) \
|
|
|
7c2869 |
- break; \
|
|
|
7c2869 |
- afr_trace_entrylk_in (frame, this, params); \
|
|
|
7c2869 |
- } while (0);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-#define AFR_TRACE_ENTRYLK_OUT(frame, this, params ...) \
|
|
|
7c2869 |
- do { \
|
|
|
7c2869 |
- afr_private_t *_priv = this->private; \
|
|
|
7c2869 |
- if (!_priv->entrylk_trace) \
|
|
|
7c2869 |
- break; \
|
|
|
7c2869 |
- afr_trace_entrylk_out (frame, this, params); \
|
|
|
7c2869 |
- } while (0);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
int
|
|
|
7c2869 |
afr_entry_lockee_cmp (const void *l1, const void *l2)
|
|
|
7c2869 |
{
|
|
|
7c2869 |
@@ -119,28 +87,6 @@ afr_set_lk_owner (call_frame_t *frame, xlator_t *this, void *lk_owner)
|
|
|
7c2869 |
set_lk_owner_from_ptr (&frame->root->lk_owner, lk_owner);
|
|
|
7c2869 |
}
|
|
|
7c2869 |
|
|
|
7c2869 |
-static int
|
|
|
7c2869 |
-is_afr_lock_selfheal (afr_local_t *local)
|
|
|
7c2869 |
-{
|
|
|
7c2869 |
- afr_internal_lock_t *int_lock = NULL;
|
|
|
7c2869 |
- int ret = -1;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- int_lock = &local->internal_lock;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- switch (int_lock->selfheal_lk_type) {
|
|
|
7c2869 |
- case AFR_DATA_SELF_HEAL_LK:
|
|
|
7c2869 |
- case AFR_METADATA_SELF_HEAL_LK:
|
|
|
7c2869 |
- ret = 1;
|
|
|
7c2869 |
- break;
|
|
|
7c2869 |
- case AFR_ENTRY_SELF_HEAL_LK:
|
|
|
7c2869 |
- ret = 0;
|
|
|
7c2869 |
- break;
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- return ret;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-}
|
|
|
7c2869 |
-
|
|
|
7c2869 |
int32_t
|
|
|
7c2869 |
internal_lock_count (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
{
|
|
|
7c2869 |
@@ -160,315 +106,12 @@ internal_lock_count (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
return call_count;
|
|
|
7c2869 |
}
|
|
|
7c2869 |
|
|
|
7c2869 |
-static void
|
|
|
7c2869 |
-afr_print_inodelk (char *str, int size, int cmd,
|
|
|
7c2869 |
- struct gf_flock *flock, gf_lkowner_t *owner)
|
|
|
7c2869 |
-{
|
|
|
7c2869 |
- char *cmd_str = NULL;
|
|
|
7c2869 |
- char *type_str = NULL;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- switch (cmd) {
|
|
|
7c2869 |
-#if F_GETLK != F_GETLK64
|
|
|
7c2869 |
- case F_GETLK64:
|
|
|
7c2869 |
-#endif
|
|
|
7c2869 |
- case F_GETLK:
|
|
|
7c2869 |
- cmd_str = "GETLK";
|
|
|
7c2869 |
- break;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-#if F_SETLK != F_SETLK64
|
|
|
7c2869 |
- case F_SETLK64:
|
|
|
7c2869 |
-#endif
|
|
|
7c2869 |
- case F_SETLK:
|
|
|
7c2869 |
- cmd_str = "SETLK";
|
|
|
7c2869 |
- break;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-#if F_SETLKW != F_SETLKW64
|
|
|
7c2869 |
- case F_SETLKW64:
|
|
|
7c2869 |
-#endif
|
|
|
7c2869 |
- case F_SETLKW:
|
|
|
7c2869 |
- cmd_str = "SETLKW";
|
|
|
7c2869 |
- break;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- default:
|
|
|
7c2869 |
- cmd_str = "<null>";
|
|
|
7c2869 |
- break;
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- switch (flock->l_type) {
|
|
|
7c2869 |
- case F_RDLCK:
|
|
|
7c2869 |
- type_str = "READ";
|
|
|
7c2869 |
- break;
|
|
|
7c2869 |
- case F_WRLCK:
|
|
|
7c2869 |
- type_str = "WRITE";
|
|
|
7c2869 |
- break;
|
|
|
7c2869 |
- case F_UNLCK:
|
|
|
7c2869 |
- type_str = "UNLOCK";
|
|
|
7c2869 |
- break;
|
|
|
7c2869 |
- default:
|
|
|
7c2869 |
- type_str = "UNKNOWN";
|
|
|
7c2869 |
- break;
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- snprintf (str, size, "lock=INODELK, cmd=%s, type=%s, "
|
|
|
7c2869 |
- "start=%llu, len=%llu, pid=%llu, lk-owner=%s",
|
|
|
7c2869 |
- cmd_str, type_str, (unsigned long long) flock->l_start,
|
|
|
7c2869 |
- (unsigned long long) flock->l_len,
|
|
|
7c2869 |
- (unsigned long long) flock->l_pid,
|
|
|
7c2869 |
- lkowner_utoa (owner));
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-}
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-static void
|
|
|
7c2869 |
-afr_print_lockee (char *str, int size, loc_t *loc, fd_t *fd,
|
|
|
7c2869 |
- int child_index)
|
|
|
7c2869 |
-{
|
|
|
7c2869 |
- snprintf (str, size, "path=%s, fd=%p, child=%d",
|
|
|
7c2869 |
- loc->path ? loc->path : "<nul>",
|
|
|
7c2869 |
- fd ? fd : NULL,
|
|
|
7c2869 |
- child_index);
|
|
|
7c2869 |
-}
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-void
|
|
|
7c2869 |
-afr_print_entrylk (char *str, int size, const char *basename,
|
|
|
7c2869 |
- gf_lkowner_t *owner)
|
|
|
7c2869 |
-{
|
|
|
7c2869 |
- snprintf (str, size, "Basename=%s, lk-owner=%s",
|
|
|
7c2869 |
- basename ? basename : "<nul>",
|
|
|
7c2869 |
- lkowner_utoa (owner));
|
|
|
7c2869 |
-}
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-static void
|
|
|
7c2869 |
-afr_print_verdict (int op_ret, int op_errno, char *str)
|
|
|
7c2869 |
-{
|
|
|
7c2869 |
- if (op_ret < 0) {
|
|
|
7c2869 |
- if (op_errno == EAGAIN)
|
|
|
7c2869 |
- strcpy (str, "EAGAIN");
|
|
|
7c2869 |
- else
|
|
|
7c2869 |
- strcpy (str, "FAILED");
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
- else
|
|
|
7c2869 |
- strcpy (str, "GRANTED");
|
|
|
7c2869 |
-}
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-static void
|
|
|
7c2869 |
-afr_set_lock_call_type (afr_lock_call_type_t lock_call_type,
|
|
|
7c2869 |
- char *lock_call_type_str,
|
|
|
7c2869 |
- afr_internal_lock_t *int_lock)
|
|
|
7c2869 |
-{
|
|
|
7c2869 |
- switch (lock_call_type) {
|
|
|
7c2869 |
- case AFR_INODELK_TRANSACTION:
|
|
|
7c2869 |
- if (int_lock->transaction_lk_type == AFR_TRANSACTION_LK)
|
|
|
7c2869 |
- strcpy (lock_call_type_str, "AFR_INODELK_TRANSACTION");
|
|
|
7c2869 |
- else
|
|
|
7c2869 |
- strcpy (lock_call_type_str, "AFR_INODELK_SELFHEAL");
|
|
|
7c2869 |
- break;
|
|
|
7c2869 |
- case AFR_INODELK_NB_TRANSACTION:
|
|
|
7c2869 |
- if (int_lock->transaction_lk_type == AFR_TRANSACTION_LK)
|
|
|
7c2869 |
- strcpy (lock_call_type_str, "AFR_INODELK_NB_TRANSACTION");
|
|
|
7c2869 |
- else
|
|
|
7c2869 |
- strcpy (lock_call_type_str, "AFR_INODELK_NB_SELFHEAL");
|
|
|
7c2869 |
- break;
|
|
|
7c2869 |
- case AFR_ENTRYLK_TRANSACTION:
|
|
|
7c2869 |
- if (int_lock->transaction_lk_type == AFR_TRANSACTION_LK)
|
|
|
7c2869 |
- strcpy (lock_call_type_str, "AFR_ENTRYLK_TRANSACTION");
|
|
|
7c2869 |
- else
|
|
|
7c2869 |
- strcpy (lock_call_type_str, "AFR_ENTRYLK_SELFHEAL");
|
|
|
7c2869 |
- break;
|
|
|
7c2869 |
- case AFR_ENTRYLK_NB_TRANSACTION:
|
|
|
7c2869 |
- if (int_lock->transaction_lk_type == AFR_TRANSACTION_LK)
|
|
|
7c2869 |
- strcpy (lock_call_type_str, "AFR_ENTRYLK_NB_TRANSACTION");
|
|
|
7c2869 |
- else
|
|
|
7c2869 |
- strcpy (lock_call_type_str, "AFR_ENTRYLK_NB_SELFHEAL");
|
|
|
7c2869 |
- break;
|
|
|
7c2869 |
- default:
|
|
|
7c2869 |
- strcpy (lock_call_type_str, "UNKNOWN");
|
|
|
7c2869 |
- break;
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-}
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-static void
|
|
|
7c2869 |
-afr_trace_inodelk_out (call_frame_t *frame, xlator_t *this,
|
|
|
7c2869 |
- afr_lock_call_type_t lock_call_type,
|
|
|
7c2869 |
- afr_lock_op_type_t lk_op_type, struct gf_flock *flock,
|
|
|
7c2869 |
- int op_ret, int op_errno, int32_t child_index)
|
|
|
7c2869 |
-{
|
|
|
7c2869 |
- afr_internal_lock_t *int_lock = NULL;
|
|
|
7c2869 |
- afr_local_t *local = NULL;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- char lockee[256];
|
|
|
7c2869 |
- char lock_call_type_str[256];
|
|
|
7c2869 |
- char verdict[16];
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- local = frame->local;
|
|
|
7c2869 |
- int_lock = &local->internal_lock;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- afr_print_lockee (lockee, 256, &local->loc, local->fd, child_index);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- afr_set_lock_call_type (lock_call_type, lock_call_type_str, int_lock);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- afr_print_verdict (op_ret, op_errno, verdict);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- gf_msg (this->name, GF_LOG_INFO, 0, AFR_MSG_LOCK_INFO,
|
|
|
7c2869 |
- "[%s %s] [%s] lk-owner=%s Lockee={%s} Number={%llu}",
|
|
|
7c2869 |
- lock_call_type_str,
|
|
|
7c2869 |
- lk_op_type == AFR_LOCK_OP ? "LOCK REPLY" : "UNLOCK REPLY",
|
|
|
7c2869 |
- verdict, lkowner_utoa (&frame->root->lk_owner), lockee,
|
|
|
7c2869 |
- (unsigned long long) int_lock->lock_number);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-}
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-static void
|
|
|
7c2869 |
-afr_trace_inodelk_in (call_frame_t *frame, xlator_t *this,
|
|
|
7c2869 |
- afr_lock_call_type_t lock_call_type,
|
|
|
7c2869 |
- afr_lock_op_type_t lk_op_type, struct gf_flock *flock,
|
|
|
7c2869 |
- int32_t cmd, int32_t child_index)
|
|
|
7c2869 |
-{
|
|
|
7c2869 |
- afr_local_t *local = NULL;
|
|
|
7c2869 |
- afr_internal_lock_t *int_lock = NULL;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- char lock[256];
|
|
|
7c2869 |
- char lockee[256];
|
|
|
7c2869 |
- char lock_call_type_str[256];
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- local = frame->local;
|
|
|
7c2869 |
- int_lock = &local->internal_lock;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- afr_print_inodelk (lock, 256, cmd, flock, &frame->root->lk_owner);
|
|
|
7c2869 |
- afr_print_lockee (lockee, 256, &local->loc, local->fd, child_index);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- afr_set_lock_call_type (lock_call_type, lock_call_type_str, int_lock);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- gf_msg (this->name, GF_LOG_INFO, 0, AFR_MSG_LOCK_INFO,
|
|
|
7c2869 |
- "[%s %s] Lock={%s} Lockee={%s} Number={%llu}",
|
|
|
7c2869 |
- lock_call_type_str,
|
|
|
7c2869 |
- lk_op_type == AFR_LOCK_OP ? "LOCK REQUEST" : "UNLOCK REQUEST",
|
|
|
7c2869 |
- lock, lockee,
|
|
|
7c2869 |
- (unsigned long long) int_lock->lock_number);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-}
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-static void
|
|
|
7c2869 |
-afr_trace_entrylk_in (call_frame_t *frame, xlator_t *this,
|
|
|
7c2869 |
- afr_lock_call_type_t lock_call_type,
|
|
|
7c2869 |
- afr_lock_op_type_t lk_op_type, const char *basename,
|
|
|
7c2869 |
- int32_t cookie)
|
|
|
7c2869 |
-{
|
|
|
7c2869 |
- afr_local_t *local = NULL;
|
|
|
7c2869 |
- afr_internal_lock_t *int_lock = NULL;
|
|
|
7c2869 |
- afr_private_t *priv = NULL;
|
|
|
7c2869 |
- int child_index = 0;
|
|
|
7c2869 |
- int lockee_no = 0;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- char lock[256];
|
|
|
7c2869 |
- char lockee[256];
|
|
|
7c2869 |
- char lock_call_type_str[256];
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- local = frame->local;
|
|
|
7c2869 |
- int_lock = &local->internal_lock;
|
|
|
7c2869 |
- priv = this->private;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- if (!priv->entrylk_trace) {
|
|
|
7c2869 |
- return;
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
- lockee_no = cookie / priv->child_count;
|
|
|
7c2869 |
- child_index = cookie % priv->child_count;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- afr_print_entrylk (lock, 256, basename, &frame->root->lk_owner);
|
|
|
7c2869 |
- afr_print_lockee (lockee, 256, &int_lock->lockee[lockee_no].loc, local->fd,
|
|
|
7c2869 |
- child_index);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- afr_set_lock_call_type (lock_call_type, lock_call_type_str, int_lock);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- gf_msg (this->name, GF_LOG_INFO, 0, AFR_MSG_LOCK_INFO,
|
|
|
7c2869 |
- "[%s %s] Lock={%s} Lockee={%s} Number={%llu}, Cookie={%d}",
|
|
|
7c2869 |
- lock_call_type_str,
|
|
|
7c2869 |
- lk_op_type == AFR_LOCK_OP ? "LOCK REQUEST" : "UNLOCK REQUEST",
|
|
|
7c2869 |
- lock, lockee,
|
|
|
7c2869 |
- (unsigned long long) int_lock->lock_number,
|
|
|
7c2869 |
- cookie);
|
|
|
7c2869 |
-}
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-static void
|
|
|
7c2869 |
-afr_trace_entrylk_out (call_frame_t *frame, xlator_t *this,
|
|
|
7c2869 |
- afr_lock_call_type_t lock_call_type,
|
|
|
7c2869 |
- afr_lock_op_type_t lk_op_type, const char *basename,
|
|
|
7c2869 |
- int op_ret, int op_errno, int32_t cookie)
|
|
|
7c2869 |
-{
|
|
|
7c2869 |
- afr_internal_lock_t *int_lock = NULL;
|
|
|
7c2869 |
- afr_local_t *local = NULL;
|
|
|
7c2869 |
- afr_private_t *priv = NULL;
|
|
|
7c2869 |
- int lockee_no = 0;
|
|
|
7c2869 |
- int child_index = 0;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- char lock[256];
|
|
|
7c2869 |
- char lockee[256];
|
|
|
7c2869 |
- char lock_call_type_str[256];
|
|
|
7c2869 |
- char verdict[16];
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- local = frame->local;
|
|
|
7c2869 |
- int_lock = &local->internal_lock;
|
|
|
7c2869 |
- priv = this->private;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- if (!priv->entrylk_trace) {
|
|
|
7c2869 |
- return;
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
- lockee_no = cookie / priv->child_count;
|
|
|
7c2869 |
- child_index = cookie % priv->child_count;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- afr_print_entrylk (lock, 256, basename, &frame->root->lk_owner);
|
|
|
7c2869 |
- afr_print_lockee (lockee, 256, &int_lock->lockee[lockee_no].loc, local->fd,
|
|
|
7c2869 |
- child_index);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- afr_set_lock_call_type (lock_call_type, lock_call_type_str, int_lock);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- afr_print_verdict (op_ret, op_errno, verdict);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- gf_msg (this->name, GF_LOG_INFO, 0, AFR_MSG_LOCK_INFO,
|
|
|
7c2869 |
- "[%s %s] [%s] Lock={%s} Lockee={%s} Number={%llu} Cookie={%d}",
|
|
|
7c2869 |
- lock_call_type_str,
|
|
|
7c2869 |
- lk_op_type == AFR_LOCK_OP ? "LOCK REPLY" : "UNLOCK REPLY",
|
|
|
7c2869 |
- verdict,
|
|
|
7c2869 |
- lock, lockee,
|
|
|
7c2869 |
- (unsigned long long) int_lock->lock_number,
|
|
|
7c2869 |
- cookie);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-}
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-static int
|
|
|
7c2869 |
-transaction_lk_op (afr_local_t *local)
|
|
|
7c2869 |
-{
|
|
|
7c2869 |
- afr_internal_lock_t *int_lock = NULL;
|
|
|
7c2869 |
- int ret = -1;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- int_lock = &local->internal_lock;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- if (int_lock->transaction_lk_type == AFR_TRANSACTION_LK) {
|
|
|
7c2869 |
- gf_msg_debug (THIS->name, 0,
|
|
|
7c2869 |
- "lk op is for a transaction");
|
|
|
7c2869 |
- ret = 1;
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
- else if (int_lock->transaction_lk_type == AFR_SELFHEAL_LK) {
|
|
|
7c2869 |
- gf_msg_debug (THIS->name, 0,
|
|
|
7c2869 |
- "lk op is for a self heal");
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- ret = 0;
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- if (ret == -1)
|
|
|
7c2869 |
- gf_msg_debug (THIS->name, 0,
|
|
|
7c2869 |
- "lk op is not set");
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- return ret;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-}
|
|
|
7c2869 |
-
|
|
|
7c2869 |
int
|
|
|
7c2869 |
-afr_is_inodelk_transaction(afr_local_t *local)
|
|
|
7c2869 |
+afr_is_inodelk_transaction(afr_transaction_type type)
|
|
|
7c2869 |
{
|
|
|
7c2869 |
int ret = 0;
|
|
|
7c2869 |
|
|
|
7c2869 |
- switch (local->transaction.type) {
|
|
|
7c2869 |
+ switch (type) {
|
|
|
7c2869 |
case AFR_DATA_TRANSACTION:
|
|
|
7c2869 |
case AFR_METADATA_TRANSACTION:
|
|
|
7c2869 |
ret = 1;
|
|
|
7c2869 |
@@ -661,10 +304,6 @@ afr_unlock_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7c2869 |
local = frame->local;
|
|
|
7c2869 |
int_lock = &local->internal_lock;
|
|
|
7c2869 |
|
|
|
7c2869 |
- AFR_TRACE_INODELK_OUT (frame, this, AFR_INODELK_TRANSACTION,
|
|
|
7c2869 |
- AFR_UNLOCK_OP, NULL, op_ret,
|
|
|
7c2869 |
- op_errno, child_index);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
priv = this->private;
|
|
|
7c2869 |
|
|
|
7c2869 |
if (op_ret < 0 && op_errno != ENOTCONN && op_errno != EBADFD) {
|
|
|
7c2869 |
@@ -761,11 +400,6 @@ afr_unlock_inodelk (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
|
|
|
7c2869 |
flock_use = &full_flock;
|
|
|
7c2869 |
wind:
|
|
|
7c2869 |
- AFR_TRACE_INODELK_IN (frame, this,
|
|
|
7c2869 |
- AFR_INODELK_TRANSACTION,
|
|
|
7c2869 |
- AFR_UNLOCK_OP, flock_use, F_SETLK,
|
|
|
7c2869 |
- i);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
STACK_WIND_COOKIE (frame, afr_unlock_inodelk_cbk,
|
|
|
7c2869 |
(void *) (long)i,
|
|
|
7c2869 |
priv->children[i],
|
|
|
7c2869 |
@@ -777,9 +411,6 @@ afr_unlock_inodelk (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
break;
|
|
|
7c2869 |
|
|
|
7c2869 |
} else {
|
|
|
7c2869 |
- AFR_TRACE_INODELK_IN (frame, this,
|
|
|
7c2869 |
- AFR_INODELK_TRANSACTION,
|
|
|
7c2869 |
- AFR_UNLOCK_OP, &flock, F_SETLK, i);
|
|
|
7c2869 |
|
|
|
7c2869 |
STACK_WIND_COOKIE (frame, afr_unlock_inodelk_cbk,
|
|
|
7c2869 |
(void *) (long)i,
|
|
|
7c2869 |
@@ -813,11 +444,6 @@ afr_unlock_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7c2869 |
local = frame->local;
|
|
|
7c2869 |
int_lock = &local->internal_lock;
|
|
|
7c2869 |
|
|
|
7c2869 |
- AFR_TRACE_ENTRYLK_OUT (frame, this, AFR_ENTRYLK_TRANSACTION,
|
|
|
7c2869 |
- AFR_UNLOCK_OP,
|
|
|
7c2869 |
- int_lock->lockee[lockee_no].basename, op_ret,
|
|
|
7c2869 |
- op_errno, (int) ((long)cookie));
|
|
|
7c2869 |
-
|
|
|
7c2869 |
if (op_ret < 0) {
|
|
|
7c2869 |
gf_msg (this->name, GF_LOG_ERROR, op_errno,
|
|
|
7c2869 |
AFR_MSG_ENTRY_UNLOCK_FAIL,
|
|
|
7c2869 |
@@ -863,10 +489,6 @@ afr_unlock_entrylk (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
lockee_no = i / copies;
|
|
|
7c2869 |
index = i % copies;
|
|
|
7c2869 |
if (int_lock->lockee[lockee_no].locked_nodes[index] & LOCKED_YES) {
|
|
|
7c2869 |
- AFR_TRACE_ENTRYLK_IN (frame, this, AFR_ENTRYLK_NB_TRANSACTION,
|
|
|
7c2869 |
- AFR_UNLOCK_OP,
|
|
|
7c2869 |
- int_lock->lockee[lockee_no].basename,
|
|
|
7c2869 |
- i);
|
|
|
7c2869 |
|
|
|
7c2869 |
STACK_WIND_COOKIE (frame, afr_unlock_entrylk_cbk,
|
|
|
7c2869 |
(void *) (long) i,
|
|
|
7c2869 |
@@ -951,10 +573,6 @@ static int32_t
|
|
|
7c2869 |
afr_blocking_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7c2869 |
int32_t op_ret, int32_t op_errno, dict_t *xdata)
|
|
|
7c2869 |
{
|
|
|
7c2869 |
- AFR_TRACE_INODELK_OUT (frame, this, AFR_INODELK_TRANSACTION,
|
|
|
7c2869 |
- AFR_LOCK_OP, NULL, op_ret,
|
|
|
7c2869 |
- op_errno, (long) cookie);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
afr_lock_cbk (frame, cookie, this, op_ret, op_errno, xdata);
|
|
|
7c2869 |
return 0;
|
|
|
7c2869 |
|
|
|
7c2869 |
@@ -964,10 +582,6 @@ static int32_t
|
|
|
7c2869 |
afr_blocking_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7c2869 |
int32_t op_ret, int32_t op_errno, dict_t *xdata)
|
|
|
7c2869 |
{
|
|
|
7c2869 |
- AFR_TRACE_ENTRYLK_OUT (frame, this, AFR_ENTRYLK_TRANSACTION,
|
|
|
7c2869 |
- AFR_LOCK_OP, NULL, op_ret,
|
|
|
7c2869 |
- op_errno, (long)cookie);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
afr_lock_cbk (frame, cookie, this, op_ret, op_errno, xdata);
|
|
|
7c2869 |
return 0;
|
|
|
7c2869 |
}
|
|
|
7c2869 |
@@ -1005,27 +619,11 @@ afr_copy_locked_nodes (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
}
|
|
|
7c2869 |
|
|
|
7c2869 |
static gf_boolean_t
|
|
|
7c2869 |
-afr_is_entrylk (afr_internal_lock_t *int_lock,
|
|
|
7c2869 |
- afr_transaction_type trans_type)
|
|
|
7c2869 |
+afr_is_entrylk (afr_transaction_type trans_type)
|
|
|
7c2869 |
{
|
|
|
7c2869 |
- gf_boolean_t is_entrylk = _gf_false;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- if ((int_lock->transaction_lk_type == AFR_SELFHEAL_LK) &&
|
|
|
7c2869 |
- int_lock->selfheal_lk_type == AFR_ENTRY_SELF_HEAL_LK) {
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- is_entrylk = _gf_true;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- } else if ((int_lock->transaction_lk_type == AFR_TRANSACTION_LK) &&
|
|
|
7c2869 |
- (trans_type == AFR_ENTRY_TRANSACTION ||
|
|
|
7c2869 |
- trans_type == AFR_ENTRY_RENAME_TRANSACTION)) {
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- is_entrylk = _gf_true;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- } else {
|
|
|
7c2869 |
- is_entrylk = _gf_false;
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- return is_entrylk;
|
|
|
7c2869 |
+ if (afr_is_inodelk_transaction (trans_type))
|
|
|
7c2869 |
+ return _gf_false;
|
|
|
7c2869 |
+ return _gf_true;
|
|
|
7c2869 |
}
|
|
|
7c2869 |
|
|
|
7c2869 |
static gf_boolean_t
|
|
|
7c2869 |
@@ -1080,7 +678,7 @@ is_blocking_locks_count_sufficient (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
priv = this->private;
|
|
|
7c2869 |
int_lock = &local->internal_lock;
|
|
|
7c2869 |
lockee_count = int_lock->lockee_count;
|
|
|
7c2869 |
- is_entrylk = afr_is_entrylk (int_lock, local->transaction.type);
|
|
|
7c2869 |
+ is_entrylk = afr_is_entrylk (local->transaction.type);
|
|
|
7c2869 |
|
|
|
7c2869 |
if (!is_entrylk) {
|
|
|
7c2869 |
if (int_lock->lock_count == 0) {
|
|
|
7c2869 |
@@ -1138,7 +736,7 @@ afr_lock_blocking (call_frame_t *frame, xlator_t *this, int cookie)
|
|
|
7c2869 |
priv = this->private;
|
|
|
7c2869 |
child_index = cookie % priv->child_count;
|
|
|
7c2869 |
lockee_no = cookie / priv->child_count;
|
|
|
7c2869 |
- is_entrylk = afr_is_entrylk (int_lock, local->transaction.type);
|
|
|
7c2869 |
+ is_entrylk = afr_is_entrylk (local->transaction.type);
|
|
|
7c2869 |
|
|
|
7c2869 |
|
|
|
7c2869 |
if (!is_entrylk) {
|
|
|
7c2869 |
@@ -1205,10 +803,6 @@ afr_lock_blocking (call_frame_t *frame, xlator_t *this, int cookie)
|
|
|
7c2869 |
case AFR_METADATA_TRANSACTION:
|
|
|
7c2869 |
|
|
|
7c2869 |
if (local->fd) {
|
|
|
7c2869 |
- AFR_TRACE_INODELK_IN (frame, this,
|
|
|
7c2869 |
- AFR_INODELK_TRANSACTION,
|
|
|
7c2869 |
- AFR_LOCK_OP, &flock, F_SETLKW,
|
|
|
7c2869 |
- child_index);
|
|
|
7c2869 |
|
|
|
7c2869 |
STACK_WIND_COOKIE (frame, afr_blocking_inodelk_cbk,
|
|
|
7c2869 |
(void *) (long) child_index,
|
|
|
7c2869 |
@@ -1218,10 +812,6 @@ afr_lock_blocking (call_frame_t *frame, xlator_t *this, int cookie)
|
|
|
7c2869 |
F_SETLKW, &flock, NULL);
|
|
|
7c2869 |
|
|
|
7c2869 |
} else {
|
|
|
7c2869 |
- AFR_TRACE_INODELK_IN (frame, this,
|
|
|
7c2869 |
- AFR_INODELK_TRANSACTION,
|
|
|
7c2869 |
- AFR_LOCK_OP, &flock, F_SETLKW,
|
|
|
7c2869 |
- child_index);
|
|
|
7c2869 |
|
|
|
7c2869 |
STACK_WIND_COOKIE (frame, afr_blocking_inodelk_cbk,
|
|
|
7c2869 |
(void *) (long) child_index,
|
|
|
7c2869 |
@@ -1239,10 +829,6 @@ afr_lock_blocking (call_frame_t *frame, xlator_t *this, int cookie)
|
|
|
7c2869 |
*and 'fd-less' children */
|
|
|
7c2869 |
|
|
|
7c2869 |
if (local->fd) {
|
|
|
7c2869 |
- AFR_TRACE_ENTRYLK_IN (frame, this, AFR_ENTRYLK_TRANSACTION,
|
|
|
7c2869 |
- AFR_LOCK_OP,
|
|
|
7c2869 |
- int_lock->lockee[lockee_no].basename,
|
|
|
7c2869 |
- cookie);
|
|
|
7c2869 |
|
|
|
7c2869 |
STACK_WIND_COOKIE (frame, afr_blocking_entrylk_cbk,
|
|
|
7c2869 |
(void *) (long) cookie,
|
|
|
7c2869 |
@@ -1252,10 +838,6 @@ afr_lock_blocking (call_frame_t *frame, xlator_t *this, int cookie)
|
|
|
7c2869 |
int_lock->lockee[lockee_no].basename,
|
|
|
7c2869 |
ENTRYLK_LOCK, ENTRYLK_WRLCK, NULL);
|
|
|
7c2869 |
} else {
|
|
|
7c2869 |
- AFR_TRACE_ENTRYLK_IN (frame, this,
|
|
|
7c2869 |
- AFR_ENTRYLK_TRANSACTION,
|
|
|
7c2869 |
- AFR_LOCK_OP, local->transaction.basename,
|
|
|
7c2869 |
- child_index);
|
|
|
7c2869 |
|
|
|
7c2869 |
STACK_WIND_COOKIE (frame, afr_blocking_entrylk_cbk,
|
|
|
7c2869 |
(void *) (long) cookie,
|
|
|
7c2869 |
@@ -1328,10 +910,6 @@ afr_nonblocking_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7c2869 |
local = frame->local;
|
|
|
7c2869 |
int_lock = &local->internal_lock;
|
|
|
7c2869 |
|
|
|
7c2869 |
- AFR_TRACE_ENTRYLK_OUT (frame, this, AFR_ENTRYLK_TRANSACTION,
|
|
|
7c2869 |
- AFR_LOCK_OP,
|
|
|
7c2869 |
- int_lock->lockee[lockee_no].basename, op_ret,
|
|
|
7c2869 |
- op_errno, (long) cookie);
|
|
|
7c2869 |
|
|
|
7c2869 |
LOCK (&frame->lock);
|
|
|
7c2869 |
{
|
|
|
7c2869 |
@@ -1441,10 +1019,6 @@ afr_nonblocking_entrylk (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
index = i%copies;
|
|
|
7c2869 |
lockee_no = i/copies;
|
|
|
7c2869 |
if (local->child_up[index]) {
|
|
|
7c2869 |
- AFR_TRACE_ENTRYLK_IN (frame, this, AFR_ENTRYLK_NB_TRANSACTION,
|
|
|
7c2869 |
- AFR_LOCK_OP,
|
|
|
7c2869 |
- int_lock->lockee[lockee_no].basename,
|
|
|
7c2869 |
- i);
|
|
|
7c2869 |
|
|
|
7c2869 |
STACK_WIND_COOKIE (frame, afr_nonblocking_entrylk_cbk,
|
|
|
7c2869 |
(void *) (long) i,
|
|
|
7c2869 |
@@ -1467,10 +1041,6 @@ afr_nonblocking_entrylk (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
index = i%copies;
|
|
|
7c2869 |
lockee_no = i/copies;
|
|
|
7c2869 |
if (local->child_up[index]) {
|
|
|
7c2869 |
- AFR_TRACE_ENTRYLK_IN (frame, this, AFR_ENTRYLK_NB_TRANSACTION,
|
|
|
7c2869 |
- AFR_LOCK_OP,
|
|
|
7c2869 |
- int_lock->lockee[lockee_no].basename,
|
|
|
7c2869 |
- i);
|
|
|
7c2869 |
|
|
|
7c2869 |
STACK_WIND_COOKIE (frame, afr_nonblocking_entrylk_cbk,
|
|
|
7c2869 |
(void *) (long) i,
|
|
|
7c2869 |
@@ -1506,10 +1076,6 @@ afr_nonblocking_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7c2869 |
int_lock = &local->internal_lock;
|
|
|
7c2869 |
inodelk = afr_get_inodelk (int_lock, int_lock->domain);
|
|
|
7c2869 |
|
|
|
7c2869 |
- AFR_TRACE_INODELK_OUT (frame, this, AFR_INODELK_NB_TRANSACTION,
|
|
|
7c2869 |
- AFR_LOCK_OP, NULL, op_ret,
|
|
|
7c2869 |
- op_errno, (long) cookie);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
if (local->fd)
|
|
|
7c2869 |
fd_ctx = afr_fd_ctx_get (local->fd, this);
|
|
|
7c2869 |
|
|
|
7c2869 |
@@ -1671,9 +1237,6 @@ afr_nonblocking_inodelk (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
}
|
|
|
7c2869 |
flock_use = &full_flock;
|
|
|
7c2869 |
wind:
|
|
|
7c2869 |
- AFR_TRACE_INODELK_IN (frame, this,
|
|
|
7c2869 |
- AFR_INODELK_NB_TRANSACTION,
|
|
|
7c2869 |
- AFR_LOCK_OP, flock_use, F_SETLK, i);
|
|
|
7c2869 |
|
|
|
7c2869 |
STACK_WIND_COOKIE (frame, afr_nonblocking_inodelk_cbk,
|
|
|
7c2869 |
(void *) (long) i,
|
|
|
7c2869 |
@@ -1693,9 +1256,6 @@ afr_nonblocking_inodelk (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
for (i = 0; i < priv->child_count; i++) {
|
|
|
7c2869 |
if (!local->child_up[i])
|
|
|
7c2869 |
continue;
|
|
|
7c2869 |
- AFR_TRACE_INODELK_IN (frame, this,
|
|
|
7c2869 |
- AFR_INODELK_NB_TRANSACTION,
|
|
|
7c2869 |
- AFR_LOCK_OP, &flock, F_SETLK, i);
|
|
|
7c2869 |
|
|
|
7c2869 |
STACK_WIND_COOKIE (frame, afr_nonblocking_inodelk_cbk,
|
|
|
7c2869 |
(void *) (long) i,
|
|
|
7c2869 |
@@ -1719,54 +1279,10 @@ afr_unlock (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
|
|
|
7c2869 |
local = frame->local;
|
|
|
7c2869 |
|
|
|
7c2869 |
- if (transaction_lk_op (local)) {
|
|
|
7c2869 |
- if (afr_is_inodelk_transaction(local))
|
|
|
7c2869 |
- afr_unlock_inodelk (frame, this);
|
|
|
7c2869 |
- else
|
|
|
7c2869 |
- afr_unlock_entrylk (frame, this);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- } else {
|
|
|
7c2869 |
- if (is_afr_lock_selfheal (local))
|
|
|
7c2869 |
- afr_unlock_inodelk (frame, this);
|
|
|
7c2869 |
- else
|
|
|
7c2869 |
- afr_unlock_entrylk (frame, this);
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
+ if (afr_is_inodelk_transaction(local->transaction.type))
|
|
|
7c2869 |
+ afr_unlock_inodelk (frame, this);
|
|
|
7c2869 |
+ else
|
|
|
7c2869 |
+ afr_unlock_entrylk (frame, this);
|
|
|
7c2869 |
|
|
|
7c2869 |
return 0;
|
|
|
7c2869 |
}
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-int
|
|
|
7c2869 |
-afr_lk_transfer_datalock (call_frame_t *dst, call_frame_t *src, char *dom,
|
|
|
7c2869 |
- unsigned int child_count)
|
|
|
7c2869 |
-{
|
|
|
7c2869 |
- afr_local_t *dst_local = NULL;
|
|
|
7c2869 |
- afr_local_t *src_local = NULL;
|
|
|
7c2869 |
- afr_internal_lock_t *dst_lock = NULL;
|
|
|
7c2869 |
- afr_internal_lock_t *src_lock = NULL;
|
|
|
7c2869 |
- afr_inodelk_t *dst_inodelk = NULL;
|
|
|
7c2869 |
- afr_inodelk_t *src_inodelk = NULL;
|
|
|
7c2869 |
- int ret = -1;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- src_local = src->local;
|
|
|
7c2869 |
- src_lock = &src_local->internal_lock;
|
|
|
7c2869 |
- src_inodelk = afr_get_inodelk (src_lock, dom);
|
|
|
7c2869 |
- dst_local = dst->local;
|
|
|
7c2869 |
- dst_lock = &dst_local->internal_lock;
|
|
|
7c2869 |
- dst_inodelk = afr_get_inodelk (dst_lock, dom);
|
|
|
7c2869 |
- if (!dst_inodelk || !src_inodelk)
|
|
|
7c2869 |
- goto out;
|
|
|
7c2869 |
- if (src_inodelk->locked_nodes) {
|
|
|
7c2869 |
- memcpy (dst_inodelk->locked_nodes, src_inodelk->locked_nodes,
|
|
|
7c2869 |
- sizeof (*dst_inodelk->locked_nodes) * child_count);
|
|
|
7c2869 |
- memset (src_inodelk->locked_nodes, 0,
|
|
|
7c2869 |
- sizeof (*src_inodelk->locked_nodes) * child_count);
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- dst_lock->transaction_lk_type = src_lock->transaction_lk_type;
|
|
|
7c2869 |
- dst_lock->selfheal_lk_type = src_lock->selfheal_lk_type;
|
|
|
7c2869 |
- dst_inodelk->lock_count = src_inodelk->lock_count;
|
|
|
7c2869 |
- src_inodelk->lock_count = 0;
|
|
|
7c2869 |
- ret = 0;
|
|
|
7c2869 |
-out:
|
|
|
7c2869 |
- return ret;
|
|
|
7c2869 |
-}
|
|
|
7c2869 |
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
|
|
|
7c2869 |
index 6672816..46a65a7 100644
|
|
|
7c2869 |
--- a/xlators/cluster/afr/src/afr-transaction.c
|
|
|
7c2869 |
+++ b/xlators/cluster/afr/src/afr-transaction.c
|
|
|
7c2869 |
@@ -133,7 +133,7 @@ afr_needs_changelog_update (afr_local_t *local)
|
|
|
7c2869 |
}
|
|
|
7c2869 |
|
|
|
7c2869 |
int
|
|
|
7c2869 |
-__afr_txn_write_fop (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
+afr_transaction_fop (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
{
|
|
|
7c2869 |
afr_local_t *local = NULL;
|
|
|
7c2869 |
afr_private_t *priv = NULL;
|
|
|
7c2869 |
@@ -150,7 +150,7 @@ __afr_txn_write_fop (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
priv->child_count);
|
|
|
7c2869 |
|
|
|
7c2869 |
if (call_count == 0) {
|
|
|
7c2869 |
- local->transaction.resume (frame, this);
|
|
|
7c2869 |
+ afr_transaction_resume (frame, this);
|
|
|
7c2869 |
return 0;
|
|
|
7c2869 |
}
|
|
|
7c2869 |
|
|
|
7c2869 |
@@ -170,7 +170,7 @@ __afr_txn_write_fop (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
|
|
|
7c2869 |
|
|
|
7c2869 |
int
|
|
|
7c2869 |
-__afr_txn_write_done (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
+afr_transaction_done (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
{
|
|
|
7c2869 |
afr_local_t *local = NULL;
|
|
|
7c2869 |
afr_private_t *priv = NULL;
|
|
|
7c2869 |
@@ -351,13 +351,13 @@ afr_txn_arbitrate_fop (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
/* If arbiter is the only source, do not proceed. */
|
|
|
7c2869 |
if (pre_op_sources_count < 2 &&
|
|
|
7c2869 |
local->transaction.pre_op_sources[ARBITER_BRICK_INDEX]) {
|
|
|
7c2869 |
- local->internal_lock.lock_cbk = local->transaction.done;
|
|
|
7c2869 |
+ local->internal_lock.lock_cbk = afr_transaction_done;
|
|
|
7c2869 |
local->op_ret = -1;
|
|
|
7c2869 |
local->op_errno = ENOTCONN;
|
|
|
7c2869 |
afr_restore_lk_owner (frame);
|
|
|
7c2869 |
afr_unlock (frame, this);
|
|
|
7c2869 |
} else {
|
|
|
7c2869 |
- local->transaction.fop (frame, this);
|
|
|
7c2869 |
+ afr_transaction_fop (frame, this);
|
|
|
7c2869 |
}
|
|
|
7c2869 |
|
|
|
7c2869 |
return;
|
|
|
7c2869 |
@@ -400,75 +400,12 @@ afr_transaction_perform_fop (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
if (priv->arbiter_count == 1) {
|
|
|
7c2869 |
afr_txn_arbitrate_fop (frame, this);
|
|
|
7c2869 |
} else {
|
|
|
7c2869 |
- local->transaction.fop (frame, this);
|
|
|
7c2869 |
+ afr_transaction_fop (frame, this);
|
|
|
7c2869 |
}
|
|
|
7c2869 |
|
|
|
7c2869 |
return 0;
|
|
|
7c2869 |
}
|
|
|
7c2869 |
|
|
|
7c2869 |
-static int
|
|
|
7c2869 |
-__changelog_enabled (afr_private_t *priv, afr_transaction_type type)
|
|
|
7c2869 |
-{
|
|
|
7c2869 |
- int ret = 0;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- switch (type) {
|
|
|
7c2869 |
- case AFR_DATA_TRANSACTION:
|
|
|
7c2869 |
- if (priv->data_change_log)
|
|
|
7c2869 |
- ret = 1;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- break;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- case AFR_METADATA_TRANSACTION:
|
|
|
7c2869 |
- if (priv->metadata_change_log)
|
|
|
7c2869 |
- ret = 1;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- break;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- case AFR_ENTRY_TRANSACTION:
|
|
|
7c2869 |
- case AFR_ENTRY_RENAME_TRANSACTION:
|
|
|
7c2869 |
- if (priv->entry_change_log)
|
|
|
7c2869 |
- ret = 1;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- break;
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- return ret;
|
|
|
7c2869 |
-}
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-static int
|
|
|
7c2869 |
-__fop_changelog_needed (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
-{
|
|
|
7c2869 |
- afr_private_t * priv = NULL;
|
|
|
7c2869 |
- afr_local_t * local = NULL;
|
|
|
7c2869 |
- int op_ret = 0;
|
|
|
7c2869 |
- afr_transaction_type type = -1;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- priv = this->private;
|
|
|
7c2869 |
- local = frame->local;
|
|
|
7c2869 |
- type = local->transaction.type;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- if (__changelog_enabled (priv, type)) {
|
|
|
7c2869 |
- switch (local->op) {
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- case GF_FOP_WRITE:
|
|
|
7c2869 |
- case GF_FOP_FTRUNCATE:
|
|
|
7c2869 |
- op_ret = 1;
|
|
|
7c2869 |
- break;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- case GF_FOP_FLUSH:
|
|
|
7c2869 |
- op_ret = 0;
|
|
|
7c2869 |
- break;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- default:
|
|
|
7c2869 |
- op_ret = 1;
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- return op_ret;
|
|
|
7c2869 |
-}
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-
|
|
|
7c2869 |
int
|
|
|
7c2869 |
afr_set_pending_dict (afr_private_t *priv, dict_t *xattr, int **pending)
|
|
|
7c2869 |
{
|
|
|
7c2869 |
@@ -489,29 +426,6 @@ afr_set_pending_dict (afr_private_t *priv, dict_t *xattr, int **pending)
|
|
|
7c2869 |
return ret;
|
|
|
7c2869 |
}
|
|
|
7c2869 |
|
|
|
7c2869 |
-int
|
|
|
7c2869 |
-afr_lock_server_count (afr_private_t *priv, afr_transaction_type type)
|
|
|
7c2869 |
-{
|
|
|
7c2869 |
- int ret = 0;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- switch (type) {
|
|
|
7c2869 |
- case AFR_DATA_TRANSACTION:
|
|
|
7c2869 |
- ret = priv->child_count;
|
|
|
7c2869 |
- break;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- case AFR_METADATA_TRANSACTION:
|
|
|
7c2869 |
- ret = priv->child_count;
|
|
|
7c2869 |
- break;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- case AFR_ENTRY_TRANSACTION:
|
|
|
7c2869 |
- case AFR_ENTRY_RENAME_TRANSACTION:
|
|
|
7c2869 |
- ret = priv->child_count;
|
|
|
7c2869 |
- break;
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- return ret;
|
|
|
7c2869 |
-}
|
|
|
7c2869 |
-
|
|
|
7c2869 |
/* {{{ pending */
|
|
|
7c2869 |
|
|
|
7c2869 |
|
|
|
7c2869 |
@@ -519,11 +433,9 @@ int
|
|
|
7c2869 |
afr_changelog_post_op_done (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
{
|
|
|
7c2869 |
afr_local_t *local = NULL;
|
|
|
7c2869 |
- afr_private_t *priv = NULL;
|
|
|
7c2869 |
afr_internal_lock_t *int_lock = NULL;
|
|
|
7c2869 |
|
|
|
7c2869 |
local = frame->local;
|
|
|
7c2869 |
- priv = this->private;
|
|
|
7c2869 |
int_lock = &local->internal_lock;
|
|
|
7c2869 |
|
|
|
7c2869 |
if (local->transaction.resume_stub) {
|
|
|
7c2869 |
@@ -531,12 +443,8 @@ afr_changelog_post_op_done (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
local->transaction.resume_stub = NULL;
|
|
|
7c2869 |
}
|
|
|
7c2869 |
|
|
|
7c2869 |
- if (afr_lock_server_count (priv, local->transaction.type) == 0) {
|
|
|
7c2869 |
- local->transaction.done (frame, this);
|
|
|
7c2869 |
- } else {
|
|
|
7c2869 |
- int_lock->lock_cbk = local->transaction.done;
|
|
|
7c2869 |
- afr_unlock (frame, this);
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
+ int_lock->lock_cbk = afr_transaction_done;
|
|
|
7c2869 |
+ afr_unlock (frame, this);
|
|
|
7c2869 |
|
|
|
7c2869 |
return 0;
|
|
|
7c2869 |
}
|
|
|
7c2869 |
@@ -1479,7 +1387,7 @@ next:
|
|
|
7c2869 |
|
|
|
7c2869 |
return 0;
|
|
|
7c2869 |
err:
|
|
|
7c2869 |
- local->internal_lock.lock_cbk = local->transaction.done;
|
|
|
7c2869 |
+ local->internal_lock.lock_cbk = afr_transaction_done;
|
|
|
7c2869 |
local->op_ret = -1;
|
|
|
7c2869 |
local->op_errno = op_errno;
|
|
|
7c2869 |
|
|
|
7c2869 |
@@ -1505,7 +1413,7 @@ afr_post_blocking_inodelk_cbk (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
gf_msg (this->name, GF_LOG_INFO,
|
|
|
7c2869 |
0, AFR_MSG_BLOCKING_LKS_FAILED,
|
|
|
7c2869 |
"Blocking inodelks failed.");
|
|
|
7c2869 |
- local->transaction.done (frame, this);
|
|
|
7c2869 |
+ afr_transaction_done (frame, this);
|
|
|
7c2869 |
} else {
|
|
|
7c2869 |
|
|
|
7c2869 |
gf_msg_debug (this->name, 0,
|
|
|
7c2869 |
@@ -1556,7 +1464,7 @@ afr_post_blocking_entrylk_cbk (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
gf_msg (this->name, GF_LOG_INFO, 0,
|
|
|
7c2869 |
AFR_MSG_BLOCKING_LKS_FAILED,
|
|
|
7c2869 |
"Blocking entrylks failed.");
|
|
|
7c2869 |
- local->transaction.done (frame, this);
|
|
|
7c2869 |
+ afr_transaction_done (frame, this);
|
|
|
7c2869 |
} else {
|
|
|
7c2869 |
|
|
|
7c2869 |
gf_msg_debug (this->name, 0,
|
|
|
7c2869 |
@@ -1609,7 +1517,7 @@ afr_post_blocking_rename_cbk (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
AFR_MSG_BLOCKING_LKS_FAILED,
|
|
|
7c2869 |
"Blocking entrylks failed.");
|
|
|
7c2869 |
|
|
|
7c2869 |
- local->transaction.done (frame, this);
|
|
|
7c2869 |
+ afr_transaction_done (frame, this);
|
|
|
7c2869 |
} else {
|
|
|
7c2869 |
|
|
|
7c2869 |
gf_msg_debug (this->name, 0,
|
|
|
7c2869 |
@@ -1672,7 +1580,6 @@ afr_lock_rec (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
local = frame->local;
|
|
|
7c2869 |
int_lock = &local->internal_lock;
|
|
|
7c2869 |
|
|
|
7c2869 |
- int_lock->transaction_lk_type = AFR_TRANSACTION_LK;
|
|
|
7c2869 |
int_lock->domain = this->name;
|
|
|
7c2869 |
|
|
|
7c2869 |
switch (local->transaction.type) {
|
|
|
7c2869 |
@@ -1721,11 +1628,7 @@ afr_lock (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
int
|
|
|
7c2869 |
afr_internal_lock_finish (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
{
|
|
|
7c2869 |
- if (__fop_changelog_needed (frame, this)) {
|
|
|
7c2869 |
- afr_changelog_pre_op (frame, this);
|
|
|
7c2869 |
- } else {
|
|
|
7c2869 |
- afr_transaction_perform_fop (frame, this);
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
+ afr_changelog_pre_op (frame, this);
|
|
|
7c2869 |
|
|
|
7c2869 |
return 0;
|
|
|
7c2869 |
}
|
|
|
7c2869 |
@@ -2135,11 +2038,7 @@ afr_transaction_resume (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
with OP */
|
|
|
7c2869 |
afr_changelog_pre_op_update (frame, this);
|
|
|
7c2869 |
|
|
|
7c2869 |
- if (__fop_changelog_needed (frame, this)) {
|
|
|
7c2869 |
- afr_changelog_post_op (frame, this);
|
|
|
7c2869 |
- } else {
|
|
|
7c2869 |
- afr_changelog_post_op_done (frame, this);
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
+ afr_changelog_post_op (frame, this);
|
|
|
7c2869 |
|
|
|
7c2869 |
return 0;
|
|
|
7c2869 |
}
|
|
|
7c2869 |
@@ -2246,7 +2145,6 @@ void
|
|
|
7c2869 |
afr_transaction_start (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
{
|
|
|
7c2869 |
afr_local_t *local = frame->local;
|
|
|
7c2869 |
- afr_private_t *priv = this->private;
|
|
|
7c2869 |
fd_t *fd = NULL;
|
|
|
7c2869 |
|
|
|
7c2869 |
afr_transaction_eager_lock_init (local, this);
|
|
|
7c2869 |
@@ -2268,11 +2166,7 @@ afr_transaction_start (call_frame_t *frame, xlator_t *this)
|
|
|
7c2869 |
}
|
|
|
7c2869 |
}
|
|
|
7c2869 |
|
|
|
7c2869 |
- if (afr_lock_server_count (priv, local->transaction.type) == 0) {
|
|
|
7c2869 |
- afr_internal_lock_finish (frame, this);
|
|
|
7c2869 |
- } else {
|
|
|
7c2869 |
- afr_lock (frame, this);
|
|
|
7c2869 |
- }
|
|
|
7c2869 |
+ afr_lock (frame, this);
|
|
|
7c2869 |
}
|
|
|
7c2869 |
|
|
|
7c2869 |
int
|
|
|
7c2869 |
@@ -2304,7 +2198,6 @@ afr_transaction (call_frame_t *frame, xlator_t *this, afr_transaction_type type)
|
|
|
7c2869 |
local = frame->local;
|
|
|
7c2869 |
priv = this->private;
|
|
|
7c2869 |
|
|
|
7c2869 |
- local->transaction.resume = afr_transaction_resume;
|
|
|
7c2869 |
local->transaction.type = type;
|
|
|
7c2869 |
|
|
|
7c2869 |
ret = afr_transaction_local_init (local, this);
|
|
|
7c2869 |
diff --git a/xlators/cluster/afr/src/afr-transaction.h b/xlators/cluster/afr/src/afr-transaction.h
|
|
|
7c2869 |
index d01e144..ddcb1eb 100644
|
|
|
7c2869 |
--- a/xlators/cluster/afr/src/afr-transaction.h
|
|
|
7c2869 |
+++ b/xlators/cluster/afr/src/afr-transaction.h
|
|
|
7c2869 |
@@ -46,8 +46,6 @@ int afr_read_txn (call_frame_t *frame, xlator_t *this, inode_t *inode,
|
|
|
7c2869 |
|
|
|
7c2869 |
int afr_read_txn_continue (call_frame_t *frame, xlator_t *this, int subvol);
|
|
|
7c2869 |
|
|
|
7c2869 |
-int __afr_txn_write_fop (call_frame_t *frame, xlator_t *this);
|
|
|
7c2869 |
-int __afr_txn_write_done (call_frame_t *frame, xlator_t *this);
|
|
|
7c2869 |
call_frame_t *afr_transaction_detach_fop_frame (call_frame_t *frame);
|
|
|
7c2869 |
gf_boolean_t afr_has_quorum (unsigned char *subvols, xlator_t *this);
|
|
|
7c2869 |
gf_boolean_t afr_needs_changelog_update (afr_local_t *local);
|
|
|
7c2869 |
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
|
|
|
7c2869 |
index c0e9d9c..78b61b7 100644
|
|
|
7c2869 |
--- a/xlators/cluster/afr/src/afr.c
|
|
|
7c2869 |
+++ b/xlators/cluster/afr/src/afr.c
|
|
|
7c2869 |
@@ -171,15 +171,6 @@ reconfigure (xlator_t *this, dict_t *options)
|
|
|
7c2869 |
priv->data_self_heal_window_size, options,
|
|
|
7c2869 |
uint32, out);
|
|
|
7c2869 |
|
|
|
7c2869 |
- GF_OPTION_RECONF ("data-change-log", priv->data_change_log, options,
|
|
|
7c2869 |
- bool, out);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- GF_OPTION_RECONF ("metadata-change-log",
|
|
|
7c2869 |
- priv->metadata_change_log, options, bool, out);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- GF_OPTION_RECONF ("entry-change-log", priv->entry_change_log, options,
|
|
|
7c2869 |
- bool, out);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
GF_OPTION_RECONF ("data-self-heal-algorithm",
|
|
|
7c2869 |
priv->data_self_heal_algorithm, options, str, out);
|
|
|
7c2869 |
|
|
|
7c2869 |
@@ -403,20 +394,9 @@ init (xlator_t *this)
|
|
|
7c2869 |
|
|
|
7c2869 |
GF_OPTION_INIT ("entry-self-heal", priv->entry_self_heal, bool, out);
|
|
|
7c2869 |
|
|
|
7c2869 |
- GF_OPTION_INIT ("data-change-log", priv->data_change_log, bool, out);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- GF_OPTION_INIT ("metadata-change-log", priv->metadata_change_log, bool,
|
|
|
7c2869 |
- out);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- GF_OPTION_INIT ("entry-change-log", priv->entry_change_log, bool, out);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
GF_OPTION_INIT ("optimistic-change-log", priv->optimistic_change_log,
|
|
|
7c2869 |
bool, out);
|
|
|
7c2869 |
|
|
|
7c2869 |
- GF_OPTION_INIT ("inodelk-trace", priv->inodelk_trace, bool, out);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- GF_OPTION_INIT ("entrylk-trace", priv->entrylk_trace, bool, out);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
GF_OPTION_INIT ("pre-op-compat", priv->pre_op_compat, bool, out);
|
|
|
7c2869 |
GF_OPTION_INIT ("locking-scheme", priv->locking_scheme, str, out);
|
|
|
7c2869 |
GF_OPTION_INIT ("granular-entry-heal", priv->esh_granular, bool, out);
|
|
|
7c2869 |
@@ -730,23 +710,20 @@ struct volume_options options[] = {
|
|
|
7c2869 |
{ .key = {"data-change-log"},
|
|
|
7c2869 |
.type = GF_OPTION_TYPE_BOOL,
|
|
|
7c2869 |
.default_value = "on",
|
|
|
7c2869 |
- .description = "Data fops like write/truncate will not perform "
|
|
|
7c2869 |
- "pre/post fop changelog operations in afr transaction "
|
|
|
7c2869 |
- "if this option is disabled"
|
|
|
7c2869 |
+ .description = "This option exists only for backward compatibility "
|
|
|
7c2869 |
+ "and configuring it doesn't have any effect"
|
|
|
7c2869 |
},
|
|
|
7c2869 |
{ .key = {"metadata-change-log"},
|
|
|
7c2869 |
.type = GF_OPTION_TYPE_BOOL,
|
|
|
7c2869 |
.default_value = "on",
|
|
|
7c2869 |
- .description = "Metadata fops like setattr/setxattr will not perform "
|
|
|
7c2869 |
- "pre/post fop changelog operations in afr transaction "
|
|
|
7c2869 |
- "if this option is disabled"
|
|
|
7c2869 |
+ .description = "This option exists only for backward compatibility "
|
|
|
7c2869 |
+ "and configuring it doesn't have any effect"
|
|
|
7c2869 |
},
|
|
|
7c2869 |
{ .key = {"entry-change-log"},
|
|
|
7c2869 |
.type = GF_OPTION_TYPE_BOOL,
|
|
|
7c2869 |
.default_value = "on",
|
|
|
7c2869 |
- .description = "Entry fops like create/unlink will not perform "
|
|
|
7c2869 |
- "pre/post fop changelog operations in afr transaction "
|
|
|
7c2869 |
- "if this option is disabled"
|
|
|
7c2869 |
+ .description = "This option exists only for backward compatibility "
|
|
|
7c2869 |
+ "and configuring it doesn't have any effect"
|
|
|
7c2869 |
},
|
|
|
7c2869 |
{ .key = {"optimistic-change-log"},
|
|
|
7c2869 |
.type = GF_OPTION_TYPE_BOOL,
|
|
|
7c2869 |
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h
|
|
|
7c2869 |
index 58f881e..dec2a37 100644
|
|
|
7c2869 |
--- a/xlators/cluster/afr/src/afr.h
|
|
|
7c2869 |
+++ b/xlators/cluster/afr/src/afr.h
|
|
|
7c2869 |
@@ -105,10 +105,6 @@ typedef struct _afr_private {
|
|
|
7c2869 |
gf_boolean_t metadata_self_heal; /* on/off */
|
|
|
7c2869 |
gf_boolean_t entry_self_heal; /* on/off */
|
|
|
7c2869 |
|
|
|
7c2869 |
- gf_boolean_t data_change_log; /* on/off */
|
|
|
7c2869 |
- gf_boolean_t metadata_change_log; /* on/off */
|
|
|
7c2869 |
- gf_boolean_t entry_change_log; /* on/off */
|
|
|
7c2869 |
-
|
|
|
7c2869 |
gf_boolean_t metadata_splitbrain_forced_heal; /* on/off */
|
|
|
7c2869 |
int read_child; /* read-subvolume */
|
|
|
7c2869 |
unsigned int hash_mode; /* for when read_child is not set */
|
|
|
7c2869 |
@@ -118,9 +114,6 @@ typedef struct _afr_private {
|
|
|
7c2869 |
afr_favorite_child_policy fav_child_policy;/*Policy to use for automatic
|
|
|
7c2869 |
resolution of split-brains.*/
|
|
|
7c2869 |
|
|
|
7c2869 |
- gf_boolean_t inodelk_trace;
|
|
|
7c2869 |
- gf_boolean_t entrylk_trace;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
unsigned int wait_count; /* # of servers to wait for success */
|
|
|
7c2869 |
|
|
|
7c2869 |
gf_timer_t *timer; /* launched when parent up is received */
|
|
|
7c2869 |
@@ -174,33 +167,6 @@ typedef enum {
|
|
|
7c2869 |
AFR_ENTRY_RENAME_TRANSACTION, /* rename */
|
|
|
7c2869 |
} afr_transaction_type;
|
|
|
7c2869 |
|
|
|
7c2869 |
-typedef enum {
|
|
|
7c2869 |
- AFR_TRANSACTION_LK,
|
|
|
7c2869 |
- AFR_SELFHEAL_LK,
|
|
|
7c2869 |
-} transaction_lk_type_t;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-typedef enum {
|
|
|
7c2869 |
- AFR_LOCK_OP,
|
|
|
7c2869 |
- AFR_UNLOCK_OP,
|
|
|
7c2869 |
-} afr_lock_op_type_t;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-typedef enum {
|
|
|
7c2869 |
- AFR_DATA_SELF_HEAL_LK,
|
|
|
7c2869 |
- AFR_METADATA_SELF_HEAL_LK,
|
|
|
7c2869 |
- AFR_ENTRY_SELF_HEAL_LK,
|
|
|
7c2869 |
-}selfheal_lk_type_t;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-typedef enum {
|
|
|
7c2869 |
- AFR_INODELK_TRANSACTION,
|
|
|
7c2869 |
- AFR_INODELK_NB_TRANSACTION,
|
|
|
7c2869 |
- AFR_ENTRYLK_TRANSACTION,
|
|
|
7c2869 |
- AFR_ENTRYLK_NB_TRANSACTION,
|
|
|
7c2869 |
- AFR_INODELK_SELFHEAL,
|
|
|
7c2869 |
- AFR_INODELK_NB_SELFHEAL,
|
|
|
7c2869 |
- AFR_ENTRYLK_SELFHEAL,
|
|
|
7c2869 |
- AFR_ENTRYLK_NB_SELFHEAL,
|
|
|
7c2869 |
-} afr_lock_call_type_t;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
/*
|
|
|
7c2869 |
xattr format: trusted.afr.volume = [x y z]
|
|
|
7c2869 |
x - data pending
|
|
|
7c2869 |
@@ -273,9 +239,6 @@ typedef struct {
|
|
|
7c2869 |
unsigned char *locked_nodes;
|
|
|
7c2869 |
unsigned char *lower_locked_nodes;
|
|
|
7c2869 |
|
|
|
7c2869 |
- selfheal_lk_type_t selfheal_lk_type;
|
|
|
7c2869 |
- transaction_lk_type_t transaction_lk_type;
|
|
|
7c2869 |
-
|
|
|
7c2869 |
int32_t lock_count;
|
|
|
7c2869 |
int32_t entrylk_lock_count;
|
|
|
7c2869 |
|
|
|
7c2869 |
@@ -785,12 +748,6 @@ typedef struct _afr_local {
|
|
|
7c2869 |
|
|
|
7c2869 |
int (*wind) (call_frame_t *frame, xlator_t *this, int subvol);
|
|
|
7c2869 |
|
|
|
7c2869 |
- int (*fop) (call_frame_t *frame, xlator_t *this);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- int (*done) (call_frame_t *frame, xlator_t *this);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
- int (*resume) (call_frame_t *frame, xlator_t *this);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
int (*unwind) (call_frame_t *frame, xlator_t *this);
|
|
|
7c2869 |
|
|
|
7c2869 |
/* post-op hook */
|
|
|
7c2869 |
@@ -955,10 +912,6 @@ int
|
|
|
7c2869 |
afr_internal_lock_finish (call_frame_t *frame, xlator_t *this);
|
|
|
7c2869 |
|
|
|
7c2869 |
int
|
|
|
7c2869 |
-afr_lk_transfer_datalock (call_frame_t *dst, call_frame_t *src, char *dom,
|
|
|
7c2869 |
- unsigned int child_count);
|
|
|
7c2869 |
-
|
|
|
7c2869 |
-int
|
|
|
7c2869 |
__afr_fd_ctx_set (xlator_t *this, fd_t *fd);
|
|
|
7c2869 |
|
|
|
7c2869 |
afr_fd_ctx_t *
|
|
|
7c2869 |
@@ -1073,8 +1026,7 @@ int
|
|
|
7c2869 |
afr_local_init (afr_local_t *local, afr_private_t *priv, int32_t *op_errno);
|
|
|
7c2869 |
|
|
|
7c2869 |
int
|
|
|
7c2869 |
-afr_internal_lock_init (afr_internal_lock_t *lk, size_t child_count,
|
|
|
7c2869 |
- transaction_lk_type_t lk_type);
|
|
|
7c2869 |
+afr_internal_lock_init (afr_internal_lock_t *lk, size_t child_count);
|
|
|
7c2869 |
|
|
|
7c2869 |
int
|
|
|
7c2869 |
afr_higher_errno (int32_t old_errno, int32_t new_errno);
|
|
|
7c2869 |
@@ -1206,7 +1158,7 @@ void
|
|
|
7c2869 |
afr_update_uninodelk (afr_local_t *local, afr_internal_lock_t *int_lock,
|
|
|
7c2869 |
int32_t child_index);
|
|
|
7c2869 |
int
|
|
|
7c2869 |
-afr_is_inodelk_transaction(afr_local_t *local);
|
|
|
7c2869 |
+afr_is_inodelk_transaction(afr_transaction_type type);
|
|
|
7c2869 |
|
|
|
7c2869 |
afr_fd_ctx_t *
|
|
|
7c2869 |
__afr_fd_ctx_get (fd_t *fd, xlator_t *this);
|
|
|
7c2869 |
diff --git a/xlators/cluster/afr/src/pump.c b/xlators/cluster/afr/src/pump.c
|
|
|
7c2869 |
index d322a9d..06b2cc8 100644
|
|
|
7c2869 |
--- a/xlators/cluster/afr/src/pump.c
|
|
|
7c2869 |
+++ b/xlators/cluster/afr/src/pump.c
|
|
|
7c2869 |
@@ -2268,9 +2268,6 @@ init (xlator_t *this)
|
|
|
7c2869 |
|
|
|
7c2869 |
priv->data_self_heal_window_size = 16;
|
|
|
7c2869 |
|
|
|
7c2869 |
- priv->data_change_log = 1;
|
|
|
7c2869 |
- priv->metadata_change_log = 1;
|
|
|
7c2869 |
- priv->entry_change_log = 1;
|
|
|
7c2869 |
priv->use_afr_in_pump = 1;
|
|
|
7c2869 |
priv->sh_readdir_size = 65536;
|
|
|
7c2869 |
|
|
|
7c2869 |
--
|
|
|
7c2869 |
1.8.3.1
|
|
|
7c2869 |
|