|
|
e7a346 |
From a33f967c77ccf580db42a9f02708fa39f5d7f310 Mon Sep 17 00:00:00 2001
|
|
|
e7a346 |
From: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
e7a346 |
Date: Fri, 2 Mar 2018 12:37:42 +0530
|
|
|
e7a346 |
Subject: [PATCH 193/201] cluster/afr: Remove unused code paths
|
|
|
e7a346 |
|
|
|
e7a346 |
Removed
|
|
|
e7a346 |
1) afr-v1 self-heal locks related code which is not used anymore
|
|
|
e7a346 |
2) transaction has some data types that are not needed, so removed them
|
|
|
e7a346 |
3) Never used lock tracing available in afr as gluster's network tracing does
|
|
|
e7a346 |
the job. So removed that as well.
|
|
|
e7a346 |
4) Changelog is always enabled and afr is always used with locks, so
|
|
|
e7a346 |
__changelog_enabled, afr_lock_server_count etc functions can be deleted.
|
|
|
e7a346 |
5) transaction.fop/done/resume always call the same functions, so no need
|
|
|
e7a346 |
to have these variables.
|
|
|
e7a346 |
|
|
|
e7a346 |
> BUG: 1549606
|
|
|
e7a346 |
|
|
|
e7a346 |
Upstream-patch: https://review.gluster.org/19661
|
|
|
e7a346 |
BUG: 1491785
|
|
|
e7a346 |
Change-Id: I370c146fec2892d40e674d232a5d7256e003c7f1
|
|
|
e7a346 |
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
e7a346 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/131944
|
|
|
e7a346 |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
e7a346 |
---
|
|
|
e7a346 |
xlators/cluster/afr/src/afr-common.c | 10 +-
|
|
|
e7a346 |
xlators/cluster/afr/src/afr-dir-write.c | 18 +-
|
|
|
e7a346 |
xlators/cluster/afr/src/afr-inode-write.c | 39 +--
|
|
|
e7a346 |
xlators/cluster/afr/src/afr-lk-common.c | 508 +-----------------------------
|
|
|
e7a346 |
xlators/cluster/afr/src/afr-transaction.c | 137 +-------
|
|
|
e7a346 |
xlators/cluster/afr/src/afr-transaction.h | 2 -
|
|
|
e7a346 |
xlators/cluster/afr/src/afr.c | 35 +-
|
|
|
e7a346 |
xlators/cluster/afr/src/afr.h | 52 +--
|
|
|
e7a346 |
8 files changed, 41 insertions(+), 760 deletions(-)
|
|
|
e7a346 |
|
|
|
e7a346 |
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
|
|
|
e7a346 |
index 04c8613..06863b6 100644
|
|
|
e7a346 |
--- a/xlators/cluster/afr/src/afr-common.c
|
|
|
e7a346 |
+++ b/xlators/cluster/afr/src/afr-common.c
|
|
|
e7a346 |
@@ -4526,9 +4526,6 @@ afr_priv_dump (xlator_t *this)
|
|
|
e7a346 |
gf_proc_dump_write("data_self_heal", "%s", priv->data_self_heal);
|
|
|
e7a346 |
gf_proc_dump_write("metadata_self_heal", "%d", priv->metadata_self_heal);
|
|
|
e7a346 |
gf_proc_dump_write("entry_self_heal", "%d", priv->entry_self_heal);
|
|
|
e7a346 |
- gf_proc_dump_write("data_change_log", "%d", priv->data_change_log);
|
|
|
e7a346 |
- gf_proc_dump_write("metadata_change_log", "%d", priv->metadata_change_log);
|
|
|
e7a346 |
- gf_proc_dump_write("entry-change_log", "%d", priv->entry_change_log);
|
|
|
e7a346 |
gf_proc_dump_write("read_child", "%d", priv->read_child);
|
|
|
e7a346 |
gf_proc_dump_write("favorite_child", "%d", priv->favorite_child);
|
|
|
e7a346 |
gf_proc_dump_write("wait_count", "%u", priv->wait_count);
|
|
|
e7a346 |
@@ -5252,8 +5249,7 @@ out:
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
int
|
|
|
e7a346 |
-afr_internal_lock_init (afr_internal_lock_t *lk, size_t child_count,
|
|
|
e7a346 |
- transaction_lk_type_t lk_type)
|
|
|
e7a346 |
+afr_internal_lock_init (afr_internal_lock_t *lk, size_t child_count)
|
|
|
e7a346 |
{
|
|
|
e7a346 |
int ret = -ENOMEM;
|
|
|
e7a346 |
|
|
|
e7a346 |
@@ -5269,7 +5265,6 @@ afr_internal_lock_init (afr_internal_lock_t *lk, size_t child_count,
|
|
|
e7a346 |
|
|
|
e7a346 |
lk->lock_op_ret = -1;
|
|
|
e7a346 |
lk->lock_op_errno = EUCLEAN;
|
|
|
e7a346 |
- lk->transaction_lk_type = lk_type;
|
|
|
e7a346 |
|
|
|
e7a346 |
ret = 0;
|
|
|
e7a346 |
out:
|
|
|
e7a346 |
@@ -5336,8 +5331,7 @@ afr_transaction_local_init (afr_local_t *local, xlator_t *this)
|
|
|
e7a346 |
afr_private_t *priv = NULL;
|
|
|
e7a346 |
|
|
|
e7a346 |
priv = this->private;
|
|
|
e7a346 |
- ret = afr_internal_lock_init (&local->internal_lock, priv->child_count,
|
|
|
e7a346 |
- AFR_TRANSACTION_LK);
|
|
|
e7a346 |
+ ret = afr_internal_lock_init (&local->internal_lock, priv->child_count);
|
|
|
e7a346 |
if (ret < 0)
|
|
|
e7a346 |
goto out;
|
|
|
e7a346 |
|
|
|
e7a346 |
diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c
|
|
|
e7a346 |
index e088ed6..75889de 100644
|
|
|
e7a346 |
--- a/xlators/cluster/afr/src/afr-dir-write.c
|
|
|
e7a346 |
+++ b/xlators/cluster/afr/src/afr-dir-write.c
|
|
|
e7a346 |
@@ -267,7 +267,7 @@ __afr_dir_write_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
e7a346 |
|
|
|
e7a346 |
afr_mark_entry_pending_changelog (frame, this);
|
|
|
e7a346 |
|
|
|
e7a346 |
- local->transaction.resume (frame, this);
|
|
|
e7a346 |
+ afr_transaction_resume (frame, this);
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
return 0;
|
|
|
e7a346 |
@@ -496,8 +496,6 @@ afr_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
|
|
|
e7a346 |
goto out;
|
|
|
e7a346 |
|
|
|
e7a346 |
local->transaction.wind = afr_create_wind;
|
|
|
e7a346 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
e7a346 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
e7a346 |
local->transaction.unwind = afr_create_unwind;
|
|
|
e7a346 |
|
|
|
e7a346 |
ret = afr_build_parent_loc (&local->transaction.parent_loc, loc,
|
|
|
e7a346 |
@@ -626,8 +624,6 @@ afr_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
|
|
|
e7a346 |
goto out;
|
|
|
e7a346 |
|
|
|
e7a346 |
local->transaction.wind = afr_mknod_wind;
|
|
|
e7a346 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
e7a346 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
e7a346 |
local->transaction.unwind = afr_mknod_unwind;
|
|
|
e7a346 |
|
|
|
e7a346 |
ret = afr_build_parent_loc (&local->transaction.parent_loc, loc,
|
|
|
e7a346 |
@@ -762,8 +758,6 @@ afr_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
|
|
|
e7a346 |
|
|
|
e7a346 |
local->op = GF_FOP_MKDIR;
|
|
|
e7a346 |
local->transaction.wind = afr_mkdir_wind;
|
|
|
e7a346 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
e7a346 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
e7a346 |
local->transaction.unwind = afr_mkdir_unwind;
|
|
|
e7a346 |
|
|
|
e7a346 |
ret = afr_build_parent_loc (&local->transaction.parent_loc, loc,
|
|
|
e7a346 |
@@ -891,8 +885,6 @@ afr_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc,
|
|
|
e7a346 |
local->op = GF_FOP_LINK;
|
|
|
e7a346 |
|
|
|
e7a346 |
local->transaction.wind = afr_link_wind;
|
|
|
e7a346 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
e7a346 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
e7a346 |
local->transaction.unwind = afr_link_unwind;
|
|
|
e7a346 |
|
|
|
e7a346 |
ret = afr_build_parent_loc (&local->transaction.parent_loc, newloc,
|
|
|
e7a346 |
@@ -1021,8 +1013,6 @@ afr_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath,
|
|
|
e7a346 |
|
|
|
e7a346 |
local->op = GF_FOP_SYMLINK;
|
|
|
e7a346 |
local->transaction.wind = afr_symlink_wind;
|
|
|
e7a346 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
e7a346 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
e7a346 |
local->transaction.unwind = afr_symlink_unwind;
|
|
|
e7a346 |
|
|
|
e7a346 |
ret = afr_build_parent_loc (&local->transaction.parent_loc, loc,
|
|
|
e7a346 |
@@ -1156,8 +1146,6 @@ afr_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc,
|
|
|
e7a346 |
|
|
|
e7a346 |
local->op = GF_FOP_RENAME;
|
|
|
e7a346 |
local->transaction.wind = afr_rename_wind;
|
|
|
e7a346 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
e7a346 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
e7a346 |
local->transaction.unwind = afr_rename_unwind;
|
|
|
e7a346 |
|
|
|
e7a346 |
ret = afr_build_parent_loc (&local->transaction.parent_loc, oldloc,
|
|
|
e7a346 |
@@ -1308,8 +1296,6 @@ afr_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag,
|
|
|
e7a346 |
|
|
|
e7a346 |
local->op = GF_FOP_UNLINK;
|
|
|
e7a346 |
local->transaction.wind = afr_unlink_wind;
|
|
|
e7a346 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
e7a346 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
e7a346 |
local->transaction.unwind = afr_unlink_unwind;
|
|
|
e7a346 |
|
|
|
e7a346 |
ret = afr_build_parent_loc (&local->transaction.parent_loc, loc,
|
|
|
e7a346 |
@@ -1436,8 +1422,6 @@ afr_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags,
|
|
|
e7a346 |
|
|
|
e7a346 |
local->op = GF_FOP_RMDIR;
|
|
|
e7a346 |
local->transaction.wind = afr_rmdir_wind;
|
|
|
e7a346 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
e7a346 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
e7a346 |
local->transaction.unwind = afr_rmdir_unwind;
|
|
|
e7a346 |
|
|
|
e7a346 |
ret = afr_build_parent_loc (&local->transaction.parent_loc, loc,
|
|
|
e7a346 |
diff --git a/xlators/cluster/afr/src/afr-inode-write.c b/xlators/cluster/afr/src/afr-inode-write.c
|
|
|
e7a346 |
index 0e50443..2402bb2 100644
|
|
|
e7a346 |
--- a/xlators/cluster/afr/src/afr-inode-write.c
|
|
|
e7a346 |
+++ b/xlators/cluster/afr/src/afr-inode-write.c
|
|
|
e7a346 |
@@ -207,7 +207,7 @@ __afr_inode_write_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
e7a346 |
local->transaction.unwind (frame, this);
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
- local->transaction.resume (frame, this);
|
|
|
e7a346 |
+ afr_transaction_resume (frame, this);
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
return 0;
|
|
|
e7a346 |
@@ -357,13 +357,10 @@ afr_writev_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
e7a346 |
int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
|
|
|
e7a346 |
struct iatt *postbuf, dict_t *xdata)
|
|
|
e7a346 |
{
|
|
|
e7a346 |
- afr_local_t *local = NULL;
|
|
|
e7a346 |
call_frame_t *fop_frame = NULL;
|
|
|
e7a346 |
int child_index = (long) cookie;
|
|
|
e7a346 |
int call_count = -1;
|
|
|
e7a346 |
|
|
|
e7a346 |
- local = frame->local;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
afr_inode_write_fill (frame, this, child_index, op_ret, op_errno,
|
|
|
e7a346 |
prebuf, postbuf, xdata);
|
|
|
e7a346 |
|
|
|
e7a346 |
@@ -374,7 +371,7 @@ afr_writev_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
e7a346 |
|
|
|
e7a346 |
if (!afr_txn_nothing_failed (frame, this)) {
|
|
|
e7a346 |
//Don't unwind until post-op is complete
|
|
|
e7a346 |
- local->transaction.resume (frame, this);
|
|
|
e7a346 |
+ afr_transaction_resume (frame, this);
|
|
|
e7a346 |
} else {
|
|
|
e7a346 |
/*
|
|
|
e7a346 |
* Generally inode-write fops do transaction.unwind then
|
|
|
e7a346 |
@@ -389,7 +386,7 @@ afr_writev_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
e7a346 |
|
|
|
e7a346 |
fop_frame = afr_transaction_detach_fop_frame (frame);
|
|
|
e7a346 |
afr_writev_copy_outvars (frame, fop_frame);
|
|
|
e7a346 |
- local->transaction.resume (frame, this);
|
|
|
e7a346 |
+ afr_transaction_resume (frame, this);
|
|
|
e7a346 |
afr_writev_unwind (fop_frame, this);
|
|
|
e7a346 |
}
|
|
|
e7a346 |
}
|
|
|
e7a346 |
@@ -462,8 +459,6 @@ afr_do_writev (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
local->op = GF_FOP_WRITE;
|
|
|
e7a346 |
|
|
|
e7a346 |
local->transaction.wind = afr_writev_wind;
|
|
|
e7a346 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
e7a346 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
e7a346 |
local->transaction.unwind = afr_transaction_writev_unwind;
|
|
|
e7a346 |
|
|
|
e7a346 |
local->transaction.main_frame = frame;
|
|
|
e7a346 |
@@ -652,8 +647,6 @@ afr_truncate (call_frame_t *frame, xlator_t *this,
|
|
|
e7a346 |
goto out;
|
|
|
e7a346 |
|
|
|
e7a346 |
local->transaction.wind = afr_truncate_wind;
|
|
|
e7a346 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
e7a346 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
e7a346 |
local->transaction.unwind = afr_truncate_unwind;
|
|
|
e7a346 |
|
|
|
e7a346 |
loc_copy (&local->loc, loc);
|
|
|
e7a346 |
@@ -780,8 +773,6 @@ afr_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
|
|
|
e7a346 |
local->op = GF_FOP_FTRUNCATE;
|
|
|
e7a346 |
|
|
|
e7a346 |
local->transaction.wind = afr_ftruncate_wind;
|
|
|
e7a346 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
e7a346 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
e7a346 |
local->transaction.unwind = afr_ftruncate_unwind;
|
|
|
e7a346 |
|
|
|
e7a346 |
local->transaction.main_frame = frame;
|
|
|
e7a346 |
@@ -888,8 +879,6 @@ afr_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, struct iatt *buf,
|
|
|
e7a346 |
goto out;
|
|
|
e7a346 |
|
|
|
e7a346 |
local->transaction.wind = afr_setattr_wind;
|
|
|
e7a346 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
e7a346 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
e7a346 |
local->transaction.unwind = afr_setattr_unwind;
|
|
|
e7a346 |
|
|
|
e7a346 |
loc_copy (&local->loc, loc);
|
|
|
e7a346 |
@@ -995,8 +984,6 @@ afr_fsetattr (call_frame_t *frame, xlator_t *this,
|
|
|
e7a346 |
goto out;
|
|
|
e7a346 |
|
|
|
e7a346 |
local->transaction.wind = afr_fsetattr_wind;
|
|
|
e7a346 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
e7a346 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
e7a346 |
local->transaction.unwind = afr_fsetattr_unwind;
|
|
|
e7a346 |
|
|
|
e7a346 |
local->fd = fd_ref (fd);
|
|
|
e7a346 |
@@ -1639,8 +1626,6 @@ afr_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
|
|
|
e7a346 |
goto out;
|
|
|
e7a346 |
|
|
|
e7a346 |
local->transaction.wind = afr_setxattr_wind;
|
|
|
e7a346 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
e7a346 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
e7a346 |
local->transaction.unwind = afr_setxattr_unwind;
|
|
|
e7a346 |
|
|
|
e7a346 |
loc_copy (&local->loc, loc);
|
|
|
e7a346 |
@@ -1753,8 +1738,6 @@ afr_fsetxattr (call_frame_t *frame, xlator_t *this,
|
|
|
e7a346 |
goto out;
|
|
|
e7a346 |
|
|
|
e7a346 |
local->transaction.wind = afr_fsetxattr_wind;
|
|
|
e7a346 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
e7a346 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
e7a346 |
local->transaction.unwind = afr_fsetxattr_unwind;
|
|
|
e7a346 |
|
|
|
e7a346 |
local->fd = fd_ref (fd);
|
|
|
e7a346 |
@@ -1868,8 +1851,6 @@ afr_removexattr (call_frame_t *frame, xlator_t *this,
|
|
|
e7a346 |
goto out;
|
|
|
e7a346 |
|
|
|
e7a346 |
local->transaction.wind = afr_removexattr_wind;
|
|
|
e7a346 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
e7a346 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
e7a346 |
local->transaction.unwind = afr_removexattr_unwind;
|
|
|
e7a346 |
|
|
|
e7a346 |
loc_copy (&local->loc, loc);
|
|
|
e7a346 |
@@ -1977,8 +1958,6 @@ afr_fremovexattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
|
|
|
e7a346 |
goto out;
|
|
|
e7a346 |
|
|
|
e7a346 |
local->transaction.wind = afr_fremovexattr_wind;
|
|
|
e7a346 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
e7a346 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
e7a346 |
local->transaction.unwind = afr_fremovexattr_unwind;
|
|
|
e7a346 |
|
|
|
e7a346 |
local->fd = fd_ref (fd);
|
|
|
e7a346 |
@@ -2094,8 +2073,6 @@ afr_fallocate (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode,
|
|
|
e7a346 |
local->op = GF_FOP_FALLOCATE;
|
|
|
e7a346 |
|
|
|
e7a346 |
local->transaction.wind = afr_fallocate_wind;
|
|
|
e7a346 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
e7a346 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
e7a346 |
local->transaction.unwind = afr_fallocate_unwind;
|
|
|
e7a346 |
|
|
|
e7a346 |
local->transaction.main_frame = frame;
|
|
|
e7a346 |
@@ -2208,8 +2185,6 @@ afr_discard (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
|
|
|
e7a346 |
local->op = GF_FOP_DISCARD;
|
|
|
e7a346 |
|
|
|
e7a346 |
local->transaction.wind = afr_discard_wind;
|
|
|
e7a346 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
e7a346 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
e7a346 |
local->transaction.unwind = afr_discard_unwind;
|
|
|
e7a346 |
|
|
|
e7a346 |
local->transaction.main_frame = frame;
|
|
|
e7a346 |
@@ -2319,8 +2294,6 @@ afr_zerofill (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
|
|
|
e7a346 |
local->op = GF_FOP_ZEROFILL;
|
|
|
e7a346 |
|
|
|
e7a346 |
local->transaction.wind = afr_zerofill_wind;
|
|
|
e7a346 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
e7a346 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
e7a346 |
local->transaction.unwind = afr_zerofill_unwind;
|
|
|
e7a346 |
|
|
|
e7a346 |
local->transaction.main_frame = frame;
|
|
|
e7a346 |
@@ -2413,8 +2386,6 @@ afr_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc,
|
|
|
e7a346 |
local->xdata_req = dict_ref (xdata);
|
|
|
e7a346 |
|
|
|
e7a346 |
local->transaction.wind = afr_xattrop_wind;
|
|
|
e7a346 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
e7a346 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
e7a346 |
local->transaction.unwind = afr_xattrop_unwind;
|
|
|
e7a346 |
|
|
|
e7a346 |
loc_copy (&local->loc, loc);
|
|
|
e7a346 |
@@ -2509,8 +2480,6 @@ afr_fxattrop (call_frame_t *frame, xlator_t *this, fd_t *fd,
|
|
|
e7a346 |
local->xdata_req = dict_ref (xdata);
|
|
|
e7a346 |
|
|
|
e7a346 |
local->transaction.wind = afr_fxattrop_wind;
|
|
|
e7a346 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
e7a346 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
e7a346 |
local->transaction.unwind = afr_fxattrop_unwind;
|
|
|
e7a346 |
|
|
|
e7a346 |
local->fd = fd_ref (fd);
|
|
|
e7a346 |
@@ -2626,8 +2595,6 @@ afr_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t datasync,
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
local->transaction.wind = afr_fsync_wind;
|
|
|
e7a346 |
- local->transaction.fop = __afr_txn_write_fop;
|
|
|
e7a346 |
- local->transaction.done = __afr_txn_write_done;
|
|
|
e7a346 |
local->transaction.unwind = afr_fsync_unwind;
|
|
|
e7a346 |
|
|
|
e7a346 |
local->transaction.main_frame = frame;
|
|
|
e7a346 |
diff --git a/xlators/cluster/afr/src/afr-lk-common.c b/xlators/cluster/afr/src/afr-lk-common.c
|
|
|
e7a346 |
index f50c7b6..260815f 100644
|
|
|
e7a346 |
--- a/xlators/cluster/afr/src/afr-lk-common.c
|
|
|
e7a346 |
+++ b/xlators/cluster/afr/src/afr-lk-common.c
|
|
|
e7a346 |
@@ -23,38 +23,6 @@
|
|
|
e7a346 |
#define LOCKED_YES 0x1 /* for DATA, METADATA, ENTRY and higher_path */
|
|
|
e7a346 |
#define LOCKED_LOWER 0x2 /* for lower path */
|
|
|
e7a346 |
|
|
|
e7a346 |
-#define AFR_TRACE_INODELK_IN(frame, this, params ...) \
|
|
|
e7a346 |
- do { \
|
|
|
e7a346 |
- afr_private_t *_priv = this->private; \
|
|
|
e7a346 |
- if (!_priv->inodelk_trace) \
|
|
|
e7a346 |
- break; \
|
|
|
e7a346 |
- afr_trace_inodelk_in (frame, this, params); \
|
|
|
e7a346 |
- } while (0);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-#define AFR_TRACE_INODELK_OUT(frame, this, params ...) \
|
|
|
e7a346 |
- do { \
|
|
|
e7a346 |
- afr_private_t *_priv = this->private; \
|
|
|
e7a346 |
- if (!_priv->inodelk_trace) \
|
|
|
e7a346 |
- break; \
|
|
|
e7a346 |
- afr_trace_inodelk_out (frame, this, params); \
|
|
|
e7a346 |
- } while (0);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-#define AFR_TRACE_ENTRYLK_IN(frame, this, params ...) \
|
|
|
e7a346 |
- do { \
|
|
|
e7a346 |
- afr_private_t *_priv = this->private; \
|
|
|
e7a346 |
- if (!_priv->entrylk_trace) \
|
|
|
e7a346 |
- break; \
|
|
|
e7a346 |
- afr_trace_entrylk_in (frame, this, params); \
|
|
|
e7a346 |
- } while (0);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-#define AFR_TRACE_ENTRYLK_OUT(frame, this, params ...) \
|
|
|
e7a346 |
- do { \
|
|
|
e7a346 |
- afr_private_t *_priv = this->private; \
|
|
|
e7a346 |
- if (!_priv->entrylk_trace) \
|
|
|
e7a346 |
- break; \
|
|
|
e7a346 |
- afr_trace_entrylk_out (frame, this, params); \
|
|
|
e7a346 |
- } while (0);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
int
|
|
|
e7a346 |
afr_entry_lockee_cmp (const void *l1, const void *l2)
|
|
|
e7a346 |
{
|
|
|
e7a346 |
@@ -119,28 +87,6 @@ afr_set_lk_owner (call_frame_t *frame, xlator_t *this, void *lk_owner)
|
|
|
e7a346 |
set_lk_owner_from_ptr (&frame->root->lk_owner, lk_owner);
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
-static int
|
|
|
e7a346 |
-is_afr_lock_selfheal (afr_local_t *local)
|
|
|
e7a346 |
-{
|
|
|
e7a346 |
- afr_internal_lock_t *int_lock = NULL;
|
|
|
e7a346 |
- int ret = -1;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- int_lock = &local->internal_lock;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- switch (int_lock->selfheal_lk_type) {
|
|
|
e7a346 |
- case AFR_DATA_SELF_HEAL_LK:
|
|
|
e7a346 |
- case AFR_METADATA_SELF_HEAL_LK:
|
|
|
e7a346 |
- ret = 1;
|
|
|
e7a346 |
- break;
|
|
|
e7a346 |
- case AFR_ENTRY_SELF_HEAL_LK:
|
|
|
e7a346 |
- ret = 0;
|
|
|
e7a346 |
- break;
|
|
|
e7a346 |
- }
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- return ret;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-}
|
|
|
e7a346 |
-
|
|
|
e7a346 |
int32_t
|
|
|
e7a346 |
internal_lock_count (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
{
|
|
|
e7a346 |
@@ -160,315 +106,12 @@ internal_lock_count (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
return call_count;
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
-static void
|
|
|
e7a346 |
-afr_print_inodelk (char *str, int size, int cmd,
|
|
|
e7a346 |
- struct gf_flock *flock, gf_lkowner_t *owner)
|
|
|
e7a346 |
-{
|
|
|
e7a346 |
- char *cmd_str = NULL;
|
|
|
e7a346 |
- char *type_str = NULL;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- switch (cmd) {
|
|
|
e7a346 |
-#if F_GETLK != F_GETLK64
|
|
|
e7a346 |
- case F_GETLK64:
|
|
|
e7a346 |
-#endif
|
|
|
e7a346 |
- case F_GETLK:
|
|
|
e7a346 |
- cmd_str = "GETLK";
|
|
|
e7a346 |
- break;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-#if F_SETLK != F_SETLK64
|
|
|
e7a346 |
- case F_SETLK64:
|
|
|
e7a346 |
-#endif
|
|
|
e7a346 |
- case F_SETLK:
|
|
|
e7a346 |
- cmd_str = "SETLK";
|
|
|
e7a346 |
- break;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-#if F_SETLKW != F_SETLKW64
|
|
|
e7a346 |
- case F_SETLKW64:
|
|
|
e7a346 |
-#endif
|
|
|
e7a346 |
- case F_SETLKW:
|
|
|
e7a346 |
- cmd_str = "SETLKW";
|
|
|
e7a346 |
- break;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- default:
|
|
|
e7a346 |
- cmd_str = "<null>";
|
|
|
e7a346 |
- break;
|
|
|
e7a346 |
- }
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- switch (flock->l_type) {
|
|
|
e7a346 |
- case F_RDLCK:
|
|
|
e7a346 |
- type_str = "READ";
|
|
|
e7a346 |
- break;
|
|
|
e7a346 |
- case F_WRLCK:
|
|
|
e7a346 |
- type_str = "WRITE";
|
|
|
e7a346 |
- break;
|
|
|
e7a346 |
- case F_UNLCK:
|
|
|
e7a346 |
- type_str = "UNLOCK";
|
|
|
e7a346 |
- break;
|
|
|
e7a346 |
- default:
|
|
|
e7a346 |
- type_str = "UNKNOWN";
|
|
|
e7a346 |
- break;
|
|
|
e7a346 |
- }
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- snprintf (str, size, "lock=INODELK, cmd=%s, type=%s, "
|
|
|
e7a346 |
- "start=%llu, len=%llu, pid=%llu, lk-owner=%s",
|
|
|
e7a346 |
- cmd_str, type_str, (unsigned long long) flock->l_start,
|
|
|
e7a346 |
- (unsigned long long) flock->l_len,
|
|
|
e7a346 |
- (unsigned long long) flock->l_pid,
|
|
|
e7a346 |
- lkowner_utoa (owner));
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-}
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-static void
|
|
|
e7a346 |
-afr_print_lockee (char *str, int size, loc_t *loc, fd_t *fd,
|
|
|
e7a346 |
- int child_index)
|
|
|
e7a346 |
-{
|
|
|
e7a346 |
- snprintf (str, size, "path=%s, fd=%p, child=%d",
|
|
|
e7a346 |
- loc->path ? loc->path : "<nul>",
|
|
|
e7a346 |
- fd ? fd : NULL,
|
|
|
e7a346 |
- child_index);
|
|
|
e7a346 |
-}
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-void
|
|
|
e7a346 |
-afr_print_entrylk (char *str, int size, const char *basename,
|
|
|
e7a346 |
- gf_lkowner_t *owner)
|
|
|
e7a346 |
-{
|
|
|
e7a346 |
- snprintf (str, size, "Basename=%s, lk-owner=%s",
|
|
|
e7a346 |
- basename ? basename : "<nul>",
|
|
|
e7a346 |
- lkowner_utoa (owner));
|
|
|
e7a346 |
-}
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-static void
|
|
|
e7a346 |
-afr_print_verdict (int op_ret, int op_errno, char *str)
|
|
|
e7a346 |
-{
|
|
|
e7a346 |
- if (op_ret < 0) {
|
|
|
e7a346 |
- if (op_errno == EAGAIN)
|
|
|
e7a346 |
- strcpy (str, "EAGAIN");
|
|
|
e7a346 |
- else
|
|
|
e7a346 |
- strcpy (str, "FAILED");
|
|
|
e7a346 |
- }
|
|
|
e7a346 |
- else
|
|
|
e7a346 |
- strcpy (str, "GRANTED");
|
|
|
e7a346 |
-}
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-static void
|
|
|
e7a346 |
-afr_set_lock_call_type (afr_lock_call_type_t lock_call_type,
|
|
|
e7a346 |
- char *lock_call_type_str,
|
|
|
e7a346 |
- afr_internal_lock_t *int_lock)
|
|
|
e7a346 |
-{
|
|
|
e7a346 |
- switch (lock_call_type) {
|
|
|
e7a346 |
- case AFR_INODELK_TRANSACTION:
|
|
|
e7a346 |
- if (int_lock->transaction_lk_type == AFR_TRANSACTION_LK)
|
|
|
e7a346 |
- strcpy (lock_call_type_str, "AFR_INODELK_TRANSACTION");
|
|
|
e7a346 |
- else
|
|
|
e7a346 |
- strcpy (lock_call_type_str, "AFR_INODELK_SELFHEAL");
|
|
|
e7a346 |
- break;
|
|
|
e7a346 |
- case AFR_INODELK_NB_TRANSACTION:
|
|
|
e7a346 |
- if (int_lock->transaction_lk_type == AFR_TRANSACTION_LK)
|
|
|
e7a346 |
- strcpy (lock_call_type_str, "AFR_INODELK_NB_TRANSACTION");
|
|
|
e7a346 |
- else
|
|
|
e7a346 |
- strcpy (lock_call_type_str, "AFR_INODELK_NB_SELFHEAL");
|
|
|
e7a346 |
- break;
|
|
|
e7a346 |
- case AFR_ENTRYLK_TRANSACTION:
|
|
|
e7a346 |
- if (int_lock->transaction_lk_type == AFR_TRANSACTION_LK)
|
|
|
e7a346 |
- strcpy (lock_call_type_str, "AFR_ENTRYLK_TRANSACTION");
|
|
|
e7a346 |
- else
|
|
|
e7a346 |
- strcpy (lock_call_type_str, "AFR_ENTRYLK_SELFHEAL");
|
|
|
e7a346 |
- break;
|
|
|
e7a346 |
- case AFR_ENTRYLK_NB_TRANSACTION:
|
|
|
e7a346 |
- if (int_lock->transaction_lk_type == AFR_TRANSACTION_LK)
|
|
|
e7a346 |
- strcpy (lock_call_type_str, "AFR_ENTRYLK_NB_TRANSACTION");
|
|
|
e7a346 |
- else
|
|
|
e7a346 |
- strcpy (lock_call_type_str, "AFR_ENTRYLK_NB_SELFHEAL");
|
|
|
e7a346 |
- break;
|
|
|
e7a346 |
- default:
|
|
|
e7a346 |
- strcpy (lock_call_type_str, "UNKNOWN");
|
|
|
e7a346 |
- break;
|
|
|
e7a346 |
- }
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-}
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-static void
|
|
|
e7a346 |
-afr_trace_inodelk_out (call_frame_t *frame, xlator_t *this,
|
|
|
e7a346 |
- afr_lock_call_type_t lock_call_type,
|
|
|
e7a346 |
- afr_lock_op_type_t lk_op_type, struct gf_flock *flock,
|
|
|
e7a346 |
- int op_ret, int op_errno, int32_t child_index)
|
|
|
e7a346 |
-{
|
|
|
e7a346 |
- afr_internal_lock_t *int_lock = NULL;
|
|
|
e7a346 |
- afr_local_t *local = NULL;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- char lockee[256];
|
|
|
e7a346 |
- char lock_call_type_str[256];
|
|
|
e7a346 |
- char verdict[16];
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- local = frame->local;
|
|
|
e7a346 |
- int_lock = &local->internal_lock;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- afr_print_lockee (lockee, 256, &local->loc, local->fd, child_index);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- afr_set_lock_call_type (lock_call_type, lock_call_type_str, int_lock);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- afr_print_verdict (op_ret, op_errno, verdict);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- gf_msg (this->name, GF_LOG_INFO, 0, AFR_MSG_LOCK_INFO,
|
|
|
e7a346 |
- "[%s %s] [%s] lk-owner=%s Lockee={%s} Number={%llu}",
|
|
|
e7a346 |
- lock_call_type_str,
|
|
|
e7a346 |
- lk_op_type == AFR_LOCK_OP ? "LOCK REPLY" : "UNLOCK REPLY",
|
|
|
e7a346 |
- verdict, lkowner_utoa (&frame->root->lk_owner), lockee,
|
|
|
e7a346 |
- (unsigned long long) int_lock->lock_number);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-}
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-static void
|
|
|
e7a346 |
-afr_trace_inodelk_in (call_frame_t *frame, xlator_t *this,
|
|
|
e7a346 |
- afr_lock_call_type_t lock_call_type,
|
|
|
e7a346 |
- afr_lock_op_type_t lk_op_type, struct gf_flock *flock,
|
|
|
e7a346 |
- int32_t cmd, int32_t child_index)
|
|
|
e7a346 |
-{
|
|
|
e7a346 |
- afr_local_t *local = NULL;
|
|
|
e7a346 |
- afr_internal_lock_t *int_lock = NULL;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- char lock[256];
|
|
|
e7a346 |
- char lockee[256];
|
|
|
e7a346 |
- char lock_call_type_str[256];
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- local = frame->local;
|
|
|
e7a346 |
- int_lock = &local->internal_lock;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- afr_print_inodelk (lock, 256, cmd, flock, &frame->root->lk_owner);
|
|
|
e7a346 |
- afr_print_lockee (lockee, 256, &local->loc, local->fd, child_index);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- afr_set_lock_call_type (lock_call_type, lock_call_type_str, int_lock);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- gf_msg (this->name, GF_LOG_INFO, 0, AFR_MSG_LOCK_INFO,
|
|
|
e7a346 |
- "[%s %s] Lock={%s} Lockee={%s} Number={%llu}",
|
|
|
e7a346 |
- lock_call_type_str,
|
|
|
e7a346 |
- lk_op_type == AFR_LOCK_OP ? "LOCK REQUEST" : "UNLOCK REQUEST",
|
|
|
e7a346 |
- lock, lockee,
|
|
|
e7a346 |
- (unsigned long long) int_lock->lock_number);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-}
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-static void
|
|
|
e7a346 |
-afr_trace_entrylk_in (call_frame_t *frame, xlator_t *this,
|
|
|
e7a346 |
- afr_lock_call_type_t lock_call_type,
|
|
|
e7a346 |
- afr_lock_op_type_t lk_op_type, const char *basename,
|
|
|
e7a346 |
- int32_t cookie)
|
|
|
e7a346 |
-{
|
|
|
e7a346 |
- afr_local_t *local = NULL;
|
|
|
e7a346 |
- afr_internal_lock_t *int_lock = NULL;
|
|
|
e7a346 |
- afr_private_t *priv = NULL;
|
|
|
e7a346 |
- int child_index = 0;
|
|
|
e7a346 |
- int lockee_no = 0;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- char lock[256];
|
|
|
e7a346 |
- char lockee[256];
|
|
|
e7a346 |
- char lock_call_type_str[256];
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- local = frame->local;
|
|
|
e7a346 |
- int_lock = &local->internal_lock;
|
|
|
e7a346 |
- priv = this->private;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- if (!priv->entrylk_trace) {
|
|
|
e7a346 |
- return;
|
|
|
e7a346 |
- }
|
|
|
e7a346 |
- lockee_no = cookie / priv->child_count;
|
|
|
e7a346 |
- child_index = cookie % priv->child_count;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- afr_print_entrylk (lock, 256, basename, &frame->root->lk_owner);
|
|
|
e7a346 |
- afr_print_lockee (lockee, 256, &int_lock->lockee[lockee_no].loc, local->fd,
|
|
|
e7a346 |
- child_index);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- afr_set_lock_call_type (lock_call_type, lock_call_type_str, int_lock);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- gf_msg (this->name, GF_LOG_INFO, 0, AFR_MSG_LOCK_INFO,
|
|
|
e7a346 |
- "[%s %s] Lock={%s} Lockee={%s} Number={%llu}, Cookie={%d}",
|
|
|
e7a346 |
- lock_call_type_str,
|
|
|
e7a346 |
- lk_op_type == AFR_LOCK_OP ? "LOCK REQUEST" : "UNLOCK REQUEST",
|
|
|
e7a346 |
- lock, lockee,
|
|
|
e7a346 |
- (unsigned long long) int_lock->lock_number,
|
|
|
e7a346 |
- cookie);
|
|
|
e7a346 |
-}
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-static void
|
|
|
e7a346 |
-afr_trace_entrylk_out (call_frame_t *frame, xlator_t *this,
|
|
|
e7a346 |
- afr_lock_call_type_t lock_call_type,
|
|
|
e7a346 |
- afr_lock_op_type_t lk_op_type, const char *basename,
|
|
|
e7a346 |
- int op_ret, int op_errno, int32_t cookie)
|
|
|
e7a346 |
-{
|
|
|
e7a346 |
- afr_internal_lock_t *int_lock = NULL;
|
|
|
e7a346 |
- afr_local_t *local = NULL;
|
|
|
e7a346 |
- afr_private_t *priv = NULL;
|
|
|
e7a346 |
- int lockee_no = 0;
|
|
|
e7a346 |
- int child_index = 0;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- char lock[256];
|
|
|
e7a346 |
- char lockee[256];
|
|
|
e7a346 |
- char lock_call_type_str[256];
|
|
|
e7a346 |
- char verdict[16];
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- local = frame->local;
|
|
|
e7a346 |
- int_lock = &local->internal_lock;
|
|
|
e7a346 |
- priv = this->private;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- if (!priv->entrylk_trace) {
|
|
|
e7a346 |
- return;
|
|
|
e7a346 |
- }
|
|
|
e7a346 |
- lockee_no = cookie / priv->child_count;
|
|
|
e7a346 |
- child_index = cookie % priv->child_count;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- afr_print_entrylk (lock, 256, basename, &frame->root->lk_owner);
|
|
|
e7a346 |
- afr_print_lockee (lockee, 256, &int_lock->lockee[lockee_no].loc, local->fd,
|
|
|
e7a346 |
- child_index);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- afr_set_lock_call_type (lock_call_type, lock_call_type_str, int_lock);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- afr_print_verdict (op_ret, op_errno, verdict);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- gf_msg (this->name, GF_LOG_INFO, 0, AFR_MSG_LOCK_INFO,
|
|
|
e7a346 |
- "[%s %s] [%s] Lock={%s} Lockee={%s} Number={%llu} Cookie={%d}",
|
|
|
e7a346 |
- lock_call_type_str,
|
|
|
e7a346 |
- lk_op_type == AFR_LOCK_OP ? "LOCK REPLY" : "UNLOCK REPLY",
|
|
|
e7a346 |
- verdict,
|
|
|
e7a346 |
- lock, lockee,
|
|
|
e7a346 |
- (unsigned long long) int_lock->lock_number,
|
|
|
e7a346 |
- cookie);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-}
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-static int
|
|
|
e7a346 |
-transaction_lk_op (afr_local_t *local)
|
|
|
e7a346 |
-{
|
|
|
e7a346 |
- afr_internal_lock_t *int_lock = NULL;
|
|
|
e7a346 |
- int ret = -1;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- int_lock = &local->internal_lock;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- if (int_lock->transaction_lk_type == AFR_TRANSACTION_LK) {
|
|
|
e7a346 |
- gf_msg_debug (THIS->name, 0,
|
|
|
e7a346 |
- "lk op is for a transaction");
|
|
|
e7a346 |
- ret = 1;
|
|
|
e7a346 |
- }
|
|
|
e7a346 |
- else if (int_lock->transaction_lk_type == AFR_SELFHEAL_LK) {
|
|
|
e7a346 |
- gf_msg_debug (THIS->name, 0,
|
|
|
e7a346 |
- "lk op is for a self heal");
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- ret = 0;
|
|
|
e7a346 |
- }
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- if (ret == -1)
|
|
|
e7a346 |
- gf_msg_debug (THIS->name, 0,
|
|
|
e7a346 |
- "lk op is not set");
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- return ret;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-}
|
|
|
e7a346 |
-
|
|
|
e7a346 |
int
|
|
|
e7a346 |
-afr_is_inodelk_transaction(afr_local_t *local)
|
|
|
e7a346 |
+afr_is_inodelk_transaction(afr_transaction_type type)
|
|
|
e7a346 |
{
|
|
|
e7a346 |
int ret = 0;
|
|
|
e7a346 |
|
|
|
e7a346 |
- switch (local->transaction.type) {
|
|
|
e7a346 |
+ switch (type) {
|
|
|
e7a346 |
case AFR_DATA_TRANSACTION:
|
|
|
e7a346 |
case AFR_METADATA_TRANSACTION:
|
|
|
e7a346 |
ret = 1;
|
|
|
e7a346 |
@@ -664,10 +307,6 @@ afr_unlock_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
e7a346 |
local = frame->local;
|
|
|
e7a346 |
int_lock = &local->internal_lock;
|
|
|
e7a346 |
|
|
|
e7a346 |
- AFR_TRACE_INODELK_OUT (frame, this, AFR_INODELK_TRANSACTION,
|
|
|
e7a346 |
- AFR_UNLOCK_OP, NULL, op_ret,
|
|
|
e7a346 |
- op_errno, child_index);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
priv = this->private;
|
|
|
e7a346 |
|
|
|
e7a346 |
if (op_ret < 0 && op_errno != ENOTCONN && op_errno != EBADFD) {
|
|
|
e7a346 |
@@ -764,11 +403,6 @@ afr_unlock_inodelk (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
|
|
|
e7a346 |
flock_use = &full_flock;
|
|
|
e7a346 |
wind:
|
|
|
e7a346 |
- AFR_TRACE_INODELK_IN (frame, this,
|
|
|
e7a346 |
- AFR_INODELK_TRANSACTION,
|
|
|
e7a346 |
- AFR_UNLOCK_OP, flock_use, F_SETLK,
|
|
|
e7a346 |
- i);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
STACK_WIND_COOKIE (frame, afr_unlock_inodelk_cbk,
|
|
|
e7a346 |
(void *) (long)i,
|
|
|
e7a346 |
priv->children[i],
|
|
|
e7a346 |
@@ -780,9 +414,6 @@ afr_unlock_inodelk (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
break;
|
|
|
e7a346 |
|
|
|
e7a346 |
} else {
|
|
|
e7a346 |
- AFR_TRACE_INODELK_IN (frame, this,
|
|
|
e7a346 |
- AFR_INODELK_TRANSACTION,
|
|
|
e7a346 |
- AFR_UNLOCK_OP, &flock, F_SETLK, i);
|
|
|
e7a346 |
|
|
|
e7a346 |
STACK_WIND_COOKIE (frame, afr_unlock_inodelk_cbk,
|
|
|
e7a346 |
(void *) (long)i,
|
|
|
e7a346 |
@@ -816,11 +447,6 @@ afr_unlock_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
e7a346 |
local = frame->local;
|
|
|
e7a346 |
int_lock = &local->internal_lock;
|
|
|
e7a346 |
|
|
|
e7a346 |
- AFR_TRACE_ENTRYLK_OUT (frame, this, AFR_ENTRYLK_TRANSACTION,
|
|
|
e7a346 |
- AFR_UNLOCK_OP,
|
|
|
e7a346 |
- int_lock->lockee[lockee_no].basename, op_ret,
|
|
|
e7a346 |
- op_errno, (int) ((long)cookie));
|
|
|
e7a346 |
-
|
|
|
e7a346 |
if (op_ret < 0) {
|
|
|
e7a346 |
gf_msg (this->name, GF_LOG_ERROR, op_errno,
|
|
|
e7a346 |
AFR_MSG_ENTRY_UNLOCK_FAIL,
|
|
|
e7a346 |
@@ -866,10 +492,6 @@ afr_unlock_entrylk (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
lockee_no = i / copies;
|
|
|
e7a346 |
index = i % copies;
|
|
|
e7a346 |
if (int_lock->lockee[lockee_no].locked_nodes[index] & LOCKED_YES) {
|
|
|
e7a346 |
- AFR_TRACE_ENTRYLK_IN (frame, this, AFR_ENTRYLK_NB_TRANSACTION,
|
|
|
e7a346 |
- AFR_UNLOCK_OP,
|
|
|
e7a346 |
- int_lock->lockee[lockee_no].basename,
|
|
|
e7a346 |
- i);
|
|
|
e7a346 |
|
|
|
e7a346 |
STACK_WIND_COOKIE (frame, afr_unlock_entrylk_cbk,
|
|
|
e7a346 |
(void *) (long) i,
|
|
|
e7a346 |
@@ -963,10 +585,6 @@ static int32_t
|
|
|
e7a346 |
afr_blocking_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
e7a346 |
int32_t op_ret, int32_t op_errno, dict_t *xdata)
|
|
|
e7a346 |
{
|
|
|
e7a346 |
- AFR_TRACE_INODELK_OUT (frame, this, AFR_INODELK_TRANSACTION,
|
|
|
e7a346 |
- AFR_LOCK_OP, NULL, op_ret,
|
|
|
e7a346 |
- op_errno, (long) cookie);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
afr_lock_cbk (frame, cookie, this, op_ret, op_errno, xdata);
|
|
|
e7a346 |
return 0;
|
|
|
e7a346 |
|
|
|
e7a346 |
@@ -976,10 +594,6 @@ static int32_t
|
|
|
e7a346 |
afr_blocking_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
e7a346 |
int32_t op_ret, int32_t op_errno, dict_t *xdata)
|
|
|
e7a346 |
{
|
|
|
e7a346 |
- AFR_TRACE_ENTRYLK_OUT (frame, this, AFR_ENTRYLK_TRANSACTION,
|
|
|
e7a346 |
- AFR_LOCK_OP, NULL, op_ret,
|
|
|
e7a346 |
- op_errno, (long)cookie);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
afr_lock_cbk (frame, cookie, this, op_ret, op_errno, xdata);
|
|
|
e7a346 |
return 0;
|
|
|
e7a346 |
}
|
|
|
e7a346 |
@@ -1017,27 +631,11 @@ afr_copy_locked_nodes (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
static gf_boolean_t
|
|
|
e7a346 |
-afr_is_entrylk (afr_internal_lock_t *int_lock,
|
|
|
e7a346 |
- afr_transaction_type trans_type)
|
|
|
e7a346 |
+afr_is_entrylk (afr_transaction_type trans_type)
|
|
|
e7a346 |
{
|
|
|
e7a346 |
- gf_boolean_t is_entrylk = _gf_false;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- if ((int_lock->transaction_lk_type == AFR_SELFHEAL_LK) &&
|
|
|
e7a346 |
- int_lock->selfheal_lk_type == AFR_ENTRY_SELF_HEAL_LK) {
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- is_entrylk = _gf_true;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- } else if ((int_lock->transaction_lk_type == AFR_TRANSACTION_LK) &&
|
|
|
e7a346 |
- (trans_type == AFR_ENTRY_TRANSACTION ||
|
|
|
e7a346 |
- trans_type == AFR_ENTRY_RENAME_TRANSACTION)) {
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- is_entrylk = _gf_true;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- } else {
|
|
|
e7a346 |
- is_entrylk = _gf_false;
|
|
|
e7a346 |
- }
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- return is_entrylk;
|
|
|
e7a346 |
+ if (afr_is_inodelk_transaction (trans_type))
|
|
|
e7a346 |
+ return _gf_false;
|
|
|
e7a346 |
+ return _gf_true;
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
static gf_boolean_t
|
|
|
e7a346 |
@@ -1092,7 +690,7 @@ is_blocking_locks_count_sufficient (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
priv = this->private;
|
|
|
e7a346 |
int_lock = &local->internal_lock;
|
|
|
e7a346 |
lockee_count = int_lock->lockee_count;
|
|
|
e7a346 |
- is_entrylk = afr_is_entrylk (int_lock, local->transaction.type);
|
|
|
e7a346 |
+ is_entrylk = afr_is_entrylk (local->transaction.type);
|
|
|
e7a346 |
|
|
|
e7a346 |
if (!is_entrylk) {
|
|
|
e7a346 |
if (int_lock->lock_count == 0) {
|
|
|
e7a346 |
@@ -1150,7 +748,7 @@ afr_lock_blocking (call_frame_t *frame, xlator_t *this, int cookie)
|
|
|
e7a346 |
priv = this->private;
|
|
|
e7a346 |
child_index = cookie % priv->child_count;
|
|
|
e7a346 |
lockee_no = cookie / priv->child_count;
|
|
|
e7a346 |
- is_entrylk = afr_is_entrylk (int_lock, local->transaction.type);
|
|
|
e7a346 |
+ is_entrylk = afr_is_entrylk (local->transaction.type);
|
|
|
e7a346 |
|
|
|
e7a346 |
|
|
|
e7a346 |
if (!is_entrylk) {
|
|
|
e7a346 |
@@ -1217,10 +815,6 @@ afr_lock_blocking (call_frame_t *frame, xlator_t *this, int cookie)
|
|
|
e7a346 |
case AFR_METADATA_TRANSACTION:
|
|
|
e7a346 |
|
|
|
e7a346 |
if (local->fd) {
|
|
|
e7a346 |
- AFR_TRACE_INODELK_IN (frame, this,
|
|
|
e7a346 |
- AFR_INODELK_TRANSACTION,
|
|
|
e7a346 |
- AFR_LOCK_OP, &flock, F_SETLKW,
|
|
|
e7a346 |
- child_index);
|
|
|
e7a346 |
|
|
|
e7a346 |
STACK_WIND_COOKIE (frame, afr_blocking_inodelk_cbk,
|
|
|
e7a346 |
(void *) (long) child_index,
|
|
|
e7a346 |
@@ -1230,10 +824,6 @@ afr_lock_blocking (call_frame_t *frame, xlator_t *this, int cookie)
|
|
|
e7a346 |
F_SETLKW, &flock, NULL);
|
|
|
e7a346 |
|
|
|
e7a346 |
} else {
|
|
|
e7a346 |
- AFR_TRACE_INODELK_IN (frame, this,
|
|
|
e7a346 |
- AFR_INODELK_TRANSACTION,
|
|
|
e7a346 |
- AFR_LOCK_OP, &flock, F_SETLKW,
|
|
|
e7a346 |
- child_index);
|
|
|
e7a346 |
|
|
|
e7a346 |
STACK_WIND_COOKIE (frame, afr_blocking_inodelk_cbk,
|
|
|
e7a346 |
(void *) (long) child_index,
|
|
|
e7a346 |
@@ -1251,10 +841,6 @@ afr_lock_blocking (call_frame_t *frame, xlator_t *this, int cookie)
|
|
|
e7a346 |
*and 'fd-less' children */
|
|
|
e7a346 |
|
|
|
e7a346 |
if (local->fd) {
|
|
|
e7a346 |
- AFR_TRACE_ENTRYLK_IN (frame, this, AFR_ENTRYLK_TRANSACTION,
|
|
|
e7a346 |
- AFR_LOCK_OP,
|
|
|
e7a346 |
- int_lock->lockee[lockee_no].basename,
|
|
|
e7a346 |
- cookie);
|
|
|
e7a346 |
|
|
|
e7a346 |
STACK_WIND_COOKIE (frame, afr_blocking_entrylk_cbk,
|
|
|
e7a346 |
(void *) (long) cookie,
|
|
|
e7a346 |
@@ -1264,10 +850,6 @@ afr_lock_blocking (call_frame_t *frame, xlator_t *this, int cookie)
|
|
|
e7a346 |
int_lock->lockee[lockee_no].basename,
|
|
|
e7a346 |
ENTRYLK_LOCK, ENTRYLK_WRLCK, NULL);
|
|
|
e7a346 |
} else {
|
|
|
e7a346 |
- AFR_TRACE_ENTRYLK_IN (frame, this,
|
|
|
e7a346 |
- AFR_ENTRYLK_TRANSACTION,
|
|
|
e7a346 |
- AFR_LOCK_OP, local->transaction.basename,
|
|
|
e7a346 |
- child_index);
|
|
|
e7a346 |
|
|
|
e7a346 |
STACK_WIND_COOKIE (frame, afr_blocking_entrylk_cbk,
|
|
|
e7a346 |
(void *) (long) cookie,
|
|
|
e7a346 |
@@ -1340,10 +922,6 @@ afr_nonblocking_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
e7a346 |
local = frame->local;
|
|
|
e7a346 |
int_lock = &local->internal_lock;
|
|
|
e7a346 |
|
|
|
e7a346 |
- AFR_TRACE_ENTRYLK_OUT (frame, this, AFR_ENTRYLK_TRANSACTION,
|
|
|
e7a346 |
- AFR_LOCK_OP,
|
|
|
e7a346 |
- int_lock->lockee[lockee_no].basename, op_ret,
|
|
|
e7a346 |
- op_errno, (long) cookie);
|
|
|
e7a346 |
|
|
|
e7a346 |
LOCK (&frame->lock);
|
|
|
e7a346 |
{
|
|
|
e7a346 |
@@ -1453,10 +1031,6 @@ afr_nonblocking_entrylk (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
index = i%copies;
|
|
|
e7a346 |
lockee_no = i/copies;
|
|
|
e7a346 |
if (local->child_up[index]) {
|
|
|
e7a346 |
- AFR_TRACE_ENTRYLK_IN (frame, this, AFR_ENTRYLK_NB_TRANSACTION,
|
|
|
e7a346 |
- AFR_LOCK_OP,
|
|
|
e7a346 |
- int_lock->lockee[lockee_no].basename,
|
|
|
e7a346 |
- i);
|
|
|
e7a346 |
|
|
|
e7a346 |
STACK_WIND_COOKIE (frame, afr_nonblocking_entrylk_cbk,
|
|
|
e7a346 |
(void *) (long) i,
|
|
|
e7a346 |
@@ -1479,10 +1053,6 @@ afr_nonblocking_entrylk (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
index = i%copies;
|
|
|
e7a346 |
lockee_no = i/copies;
|
|
|
e7a346 |
if (local->child_up[index]) {
|
|
|
e7a346 |
- AFR_TRACE_ENTRYLK_IN (frame, this, AFR_ENTRYLK_NB_TRANSACTION,
|
|
|
e7a346 |
- AFR_LOCK_OP,
|
|
|
e7a346 |
- int_lock->lockee[lockee_no].basename,
|
|
|
e7a346 |
- i);
|
|
|
e7a346 |
|
|
|
e7a346 |
STACK_WIND_COOKIE (frame, afr_nonblocking_entrylk_cbk,
|
|
|
e7a346 |
(void *) (long) i,
|
|
|
e7a346 |
@@ -1517,10 +1087,6 @@ afr_nonblocking_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
e7a346 |
int_lock = &local->internal_lock;
|
|
|
e7a346 |
inodelk = afr_get_inodelk (int_lock, int_lock->domain);
|
|
|
e7a346 |
|
|
|
e7a346 |
- AFR_TRACE_INODELK_OUT (frame, this, AFR_INODELK_NB_TRANSACTION,
|
|
|
e7a346 |
- AFR_LOCK_OP, NULL, op_ret,
|
|
|
e7a346 |
- op_errno, (long) cookie);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
if (local->fd)
|
|
|
e7a346 |
fd_ctx = afr_fd_ctx_get (local->fd, this);
|
|
|
e7a346 |
|
|
|
e7a346 |
@@ -1691,9 +1257,6 @@ afr_nonblocking_inodelk (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
}
|
|
|
e7a346 |
flock_use = &full_flock;
|
|
|
e7a346 |
wind:
|
|
|
e7a346 |
- AFR_TRACE_INODELK_IN (frame, this,
|
|
|
e7a346 |
- AFR_INODELK_NB_TRANSACTION,
|
|
|
e7a346 |
- AFR_LOCK_OP, flock_use, F_SETLK, i);
|
|
|
e7a346 |
|
|
|
e7a346 |
STACK_WIND_COOKIE (frame, afr_nonblocking_inodelk_cbk,
|
|
|
e7a346 |
(void *) (long) i,
|
|
|
e7a346 |
@@ -1713,9 +1276,6 @@ afr_nonblocking_inodelk (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
for (i = 0; i < priv->child_count; i++) {
|
|
|
e7a346 |
if (!local->child_up[i])
|
|
|
e7a346 |
continue;
|
|
|
e7a346 |
- AFR_TRACE_INODELK_IN (frame, this,
|
|
|
e7a346 |
- AFR_INODELK_NB_TRANSACTION,
|
|
|
e7a346 |
- AFR_LOCK_OP, &flock, F_SETLK, i);
|
|
|
e7a346 |
|
|
|
e7a346 |
STACK_WIND_COOKIE (frame, afr_nonblocking_inodelk_cbk,
|
|
|
e7a346 |
(void *) (long) i,
|
|
|
e7a346 |
@@ -1739,54 +1299,10 @@ afr_unlock (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
|
|
|
e7a346 |
local = frame->local;
|
|
|
e7a346 |
|
|
|
e7a346 |
- if (transaction_lk_op (local)) {
|
|
|
e7a346 |
- if (afr_is_inodelk_transaction(local))
|
|
|
e7a346 |
- afr_unlock_inodelk (frame, this);
|
|
|
e7a346 |
- else
|
|
|
e7a346 |
- afr_unlock_entrylk (frame, this);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- } else {
|
|
|
e7a346 |
- if (is_afr_lock_selfheal (local))
|
|
|
e7a346 |
- afr_unlock_inodelk (frame, this);
|
|
|
e7a346 |
- else
|
|
|
e7a346 |
- afr_unlock_entrylk (frame, this);
|
|
|
e7a346 |
- }
|
|
|
e7a346 |
+ if (afr_is_inodelk_transaction(local->transaction.type))
|
|
|
e7a346 |
+ afr_unlock_inodelk (frame, this);
|
|
|
e7a346 |
+ else
|
|
|
e7a346 |
+ afr_unlock_entrylk (frame, this);
|
|
|
e7a346 |
|
|
|
e7a346 |
return 0;
|
|
|
e7a346 |
}
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-int
|
|
|
e7a346 |
-afr_lk_transfer_datalock (call_frame_t *dst, call_frame_t *src, char *dom,
|
|
|
e7a346 |
- unsigned int child_count)
|
|
|
e7a346 |
-{
|
|
|
e7a346 |
- afr_local_t *dst_local = NULL;
|
|
|
e7a346 |
- afr_local_t *src_local = NULL;
|
|
|
e7a346 |
- afr_internal_lock_t *dst_lock = NULL;
|
|
|
e7a346 |
- afr_internal_lock_t *src_lock = NULL;
|
|
|
e7a346 |
- afr_inodelk_t *dst_inodelk = NULL;
|
|
|
e7a346 |
- afr_inodelk_t *src_inodelk = NULL;
|
|
|
e7a346 |
- int ret = -1;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- src_local = src->local;
|
|
|
e7a346 |
- src_lock = &src_local->internal_lock;
|
|
|
e7a346 |
- src_inodelk = afr_get_inodelk (src_lock, dom);
|
|
|
e7a346 |
- dst_local = dst->local;
|
|
|
e7a346 |
- dst_lock = &dst_local->internal_lock;
|
|
|
e7a346 |
- dst_inodelk = afr_get_inodelk (dst_lock, dom);
|
|
|
e7a346 |
- if (!dst_inodelk || !src_inodelk)
|
|
|
e7a346 |
- goto out;
|
|
|
e7a346 |
- if (src_inodelk->locked_nodes) {
|
|
|
e7a346 |
- memcpy (dst_inodelk->locked_nodes, src_inodelk->locked_nodes,
|
|
|
e7a346 |
- sizeof (*dst_inodelk->locked_nodes) * child_count);
|
|
|
e7a346 |
- memset (src_inodelk->locked_nodes, 0,
|
|
|
e7a346 |
- sizeof (*src_inodelk->locked_nodes) * child_count);
|
|
|
e7a346 |
- }
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- dst_lock->transaction_lk_type = src_lock->transaction_lk_type;
|
|
|
e7a346 |
- dst_lock->selfheal_lk_type = src_lock->selfheal_lk_type;
|
|
|
e7a346 |
- dst_inodelk->lock_count = src_inodelk->lock_count;
|
|
|
e7a346 |
- src_inodelk->lock_count = 0;
|
|
|
e7a346 |
- ret = 0;
|
|
|
e7a346 |
-out:
|
|
|
e7a346 |
- return ret;
|
|
|
e7a346 |
-}
|
|
|
e7a346 |
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
|
|
|
e7a346 |
index 02fb10a..acbfe1a 100644
|
|
|
e7a346 |
--- a/xlators/cluster/afr/src/afr-transaction.c
|
|
|
e7a346 |
+++ b/xlators/cluster/afr/src/afr-transaction.c
|
|
|
e7a346 |
@@ -133,7 +133,7 @@ afr_needs_changelog_update (afr_local_t *local)
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
int
|
|
|
e7a346 |
-__afr_txn_write_fop (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
+afr_transaction_fop (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
{
|
|
|
e7a346 |
afr_local_t *local = NULL;
|
|
|
e7a346 |
afr_private_t *priv = NULL;
|
|
|
e7a346 |
@@ -150,7 +150,7 @@ __afr_txn_write_fop (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
priv->child_count);
|
|
|
e7a346 |
|
|
|
e7a346 |
if (call_count == 0) {
|
|
|
e7a346 |
- local->transaction.resume (frame, this);
|
|
|
e7a346 |
+ afr_transaction_resume (frame, this);
|
|
|
e7a346 |
return 0;
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
@@ -170,7 +170,7 @@ __afr_txn_write_fop (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
|
|
|
e7a346 |
|
|
|
e7a346 |
int
|
|
|
e7a346 |
-__afr_txn_write_done (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
+afr_transaction_done (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
{
|
|
|
e7a346 |
afr_local_t *local = NULL;
|
|
|
e7a346 |
afr_private_t *priv = NULL;
|
|
|
e7a346 |
@@ -345,13 +345,13 @@ afr_txn_arbitrate_fop (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
/* If arbiter is the only source, do not proceed. */
|
|
|
e7a346 |
if (pre_op_sources_count < 2 &&
|
|
|
e7a346 |
local->transaction.pre_op_sources[ARBITER_BRICK_INDEX]) {
|
|
|
e7a346 |
- local->internal_lock.lock_cbk = local->transaction.done;
|
|
|
e7a346 |
+ local->internal_lock.lock_cbk = afr_transaction_done;
|
|
|
e7a346 |
local->op_ret = -1;
|
|
|
e7a346 |
local->op_errno = ENOTCONN;
|
|
|
e7a346 |
afr_restore_lk_owner (frame);
|
|
|
e7a346 |
afr_unlock (frame, this);
|
|
|
e7a346 |
} else {
|
|
|
e7a346 |
- local->transaction.fop (frame, this);
|
|
|
e7a346 |
+ afr_transaction_fop (frame, this);
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
return;
|
|
|
e7a346 |
@@ -407,75 +407,12 @@ afr_transaction_perform_fop (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
if (priv->arbiter_count == 1) {
|
|
|
e7a346 |
afr_txn_arbitrate_fop (frame, this);
|
|
|
e7a346 |
} else {
|
|
|
e7a346 |
- local->transaction.fop (frame, this);
|
|
|
e7a346 |
+ afr_transaction_fop (frame, this);
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
return 0;
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
-static int
|
|
|
e7a346 |
-__changelog_enabled (afr_private_t *priv, afr_transaction_type type)
|
|
|
e7a346 |
-{
|
|
|
e7a346 |
- int ret = 0;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- switch (type) {
|
|
|
e7a346 |
- case AFR_DATA_TRANSACTION:
|
|
|
e7a346 |
- if (priv->data_change_log)
|
|
|
e7a346 |
- ret = 1;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- break;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- case AFR_METADATA_TRANSACTION:
|
|
|
e7a346 |
- if (priv->metadata_change_log)
|
|
|
e7a346 |
- ret = 1;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- break;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- case AFR_ENTRY_TRANSACTION:
|
|
|
e7a346 |
- case AFR_ENTRY_RENAME_TRANSACTION:
|
|
|
e7a346 |
- if (priv->entry_change_log)
|
|
|
e7a346 |
- ret = 1;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- break;
|
|
|
e7a346 |
- }
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- return ret;
|
|
|
e7a346 |
-}
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-static int
|
|
|
e7a346 |
-__fop_changelog_needed (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
-{
|
|
|
e7a346 |
- afr_private_t * priv = NULL;
|
|
|
e7a346 |
- afr_local_t * local = NULL;
|
|
|
e7a346 |
- int op_ret = 0;
|
|
|
e7a346 |
- afr_transaction_type type = -1;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- priv = this->private;
|
|
|
e7a346 |
- local = frame->local;
|
|
|
e7a346 |
- type = local->transaction.type;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- if (__changelog_enabled (priv, type)) {
|
|
|
e7a346 |
- switch (local->op) {
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- case GF_FOP_WRITE:
|
|
|
e7a346 |
- case GF_FOP_FTRUNCATE:
|
|
|
e7a346 |
- op_ret = 1;
|
|
|
e7a346 |
- break;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- case GF_FOP_FLUSH:
|
|
|
e7a346 |
- op_ret = 0;
|
|
|
e7a346 |
- break;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- default:
|
|
|
e7a346 |
- op_ret = 1;
|
|
|
e7a346 |
- }
|
|
|
e7a346 |
- }
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- return op_ret;
|
|
|
e7a346 |
-}
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-
|
|
|
e7a346 |
int
|
|
|
e7a346 |
afr_set_pending_dict (afr_private_t *priv, dict_t *xattr, int **pending)
|
|
|
e7a346 |
{
|
|
|
e7a346 |
@@ -496,29 +433,6 @@ afr_set_pending_dict (afr_private_t *priv, dict_t *xattr, int **pending)
|
|
|
e7a346 |
return ret;
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
-int
|
|
|
e7a346 |
-afr_lock_server_count (afr_private_t *priv, afr_transaction_type type)
|
|
|
e7a346 |
-{
|
|
|
e7a346 |
- int ret = 0;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- switch (type) {
|
|
|
e7a346 |
- case AFR_DATA_TRANSACTION:
|
|
|
e7a346 |
- ret = priv->child_count;
|
|
|
e7a346 |
- break;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- case AFR_METADATA_TRANSACTION:
|
|
|
e7a346 |
- ret = priv->child_count;
|
|
|
e7a346 |
- break;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- case AFR_ENTRY_TRANSACTION:
|
|
|
e7a346 |
- case AFR_ENTRY_RENAME_TRANSACTION:
|
|
|
e7a346 |
- ret = priv->child_count;
|
|
|
e7a346 |
- break;
|
|
|
e7a346 |
- }
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- return ret;
|
|
|
e7a346 |
-}
|
|
|
e7a346 |
-
|
|
|
e7a346 |
/* {{{ pending */
|
|
|
e7a346 |
|
|
|
e7a346 |
|
|
|
e7a346 |
@@ -552,11 +466,9 @@ int
|
|
|
e7a346 |
afr_changelog_post_op_done (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
{
|
|
|
e7a346 |
afr_local_t *local = NULL;
|
|
|
e7a346 |
- afr_private_t *priv = NULL;
|
|
|
e7a346 |
afr_internal_lock_t *int_lock = NULL;
|
|
|
e7a346 |
|
|
|
e7a346 |
local = frame->local;
|
|
|
e7a346 |
- priv = this->private;
|
|
|
e7a346 |
int_lock = &local->internal_lock;
|
|
|
e7a346 |
|
|
|
e7a346 |
/* Fail the FOP if post-op did not succeed on quorum no. of bricks. */
|
|
|
e7a346 |
@@ -567,12 +479,8 @@ afr_changelog_post_op_done (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
local->transaction.resume_stub = NULL;
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
- if (afr_lock_server_count (priv, local->transaction.type) == 0) {
|
|
|
e7a346 |
- local->transaction.done (frame, this);
|
|
|
e7a346 |
- } else {
|
|
|
e7a346 |
- int_lock->lock_cbk = local->transaction.done;
|
|
|
e7a346 |
- afr_unlock (frame, this);
|
|
|
e7a346 |
- }
|
|
|
e7a346 |
+ int_lock->lock_cbk = afr_transaction_done;
|
|
|
e7a346 |
+ afr_unlock (frame, this);
|
|
|
e7a346 |
|
|
|
e7a346 |
return 0;
|
|
|
e7a346 |
}
|
|
|
e7a346 |
@@ -1496,7 +1404,7 @@ next:
|
|
|
e7a346 |
|
|
|
e7a346 |
return 0;
|
|
|
e7a346 |
err:
|
|
|
e7a346 |
- local->internal_lock.lock_cbk = local->transaction.done;
|
|
|
e7a346 |
+ local->internal_lock.lock_cbk = afr_transaction_done;
|
|
|
e7a346 |
local->op_ret = -1;
|
|
|
e7a346 |
local->op_errno = op_errno;
|
|
|
e7a346 |
|
|
|
e7a346 |
@@ -1522,7 +1430,7 @@ afr_post_blocking_inodelk_cbk (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
gf_msg (this->name, GF_LOG_INFO,
|
|
|
e7a346 |
0, AFR_MSG_BLOCKING_LKS_FAILED,
|
|
|
e7a346 |
"Blocking inodelks failed.");
|
|
|
e7a346 |
- local->transaction.done (frame, this);
|
|
|
e7a346 |
+ afr_transaction_done (frame, this);
|
|
|
e7a346 |
} else {
|
|
|
e7a346 |
|
|
|
e7a346 |
gf_msg_debug (this->name, 0,
|
|
|
e7a346 |
@@ -1573,7 +1481,7 @@ afr_post_blocking_entrylk_cbk (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
gf_msg (this->name, GF_LOG_INFO, 0,
|
|
|
e7a346 |
AFR_MSG_BLOCKING_LKS_FAILED,
|
|
|
e7a346 |
"Blocking entrylks failed.");
|
|
|
e7a346 |
- local->transaction.done (frame, this);
|
|
|
e7a346 |
+ afr_transaction_done (frame, this);
|
|
|
e7a346 |
} else {
|
|
|
e7a346 |
|
|
|
e7a346 |
gf_msg_debug (this->name, 0,
|
|
|
e7a346 |
@@ -1626,7 +1534,7 @@ afr_post_blocking_rename_cbk (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
AFR_MSG_BLOCKING_LKS_FAILED,
|
|
|
e7a346 |
"Blocking entrylks failed.");
|
|
|
e7a346 |
|
|
|
e7a346 |
- local->transaction.done (frame, this);
|
|
|
e7a346 |
+ afr_transaction_done (frame, this);
|
|
|
e7a346 |
} else {
|
|
|
e7a346 |
|
|
|
e7a346 |
gf_msg_debug (this->name, 0,
|
|
|
e7a346 |
@@ -1689,7 +1597,6 @@ afr_lock_rec (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
local = frame->local;
|
|
|
e7a346 |
int_lock = &local->internal_lock;
|
|
|
e7a346 |
|
|
|
e7a346 |
- int_lock->transaction_lk_type = AFR_TRANSACTION_LK;
|
|
|
e7a346 |
int_lock->domain = this->name;
|
|
|
e7a346 |
|
|
|
e7a346 |
switch (local->transaction.type) {
|
|
|
e7a346 |
@@ -1738,11 +1645,7 @@ afr_lock (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
int
|
|
|
e7a346 |
afr_internal_lock_finish (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
{
|
|
|
e7a346 |
- if (__fop_changelog_needed (frame, this)) {
|
|
|
e7a346 |
- afr_changelog_pre_op (frame, this);
|
|
|
e7a346 |
- } else {
|
|
|
e7a346 |
- afr_transaction_perform_fop (frame, this);
|
|
|
e7a346 |
- }
|
|
|
e7a346 |
+ afr_changelog_pre_op (frame, this);
|
|
|
e7a346 |
|
|
|
e7a346 |
return 0;
|
|
|
e7a346 |
}
|
|
|
e7a346 |
@@ -2152,11 +2055,7 @@ afr_transaction_resume (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
with OP */
|
|
|
e7a346 |
afr_changelog_pre_op_update (frame, this);
|
|
|
e7a346 |
|
|
|
e7a346 |
- if (__fop_changelog_needed (frame, this)) {
|
|
|
e7a346 |
- afr_changelog_post_op (frame, this);
|
|
|
e7a346 |
- } else {
|
|
|
e7a346 |
- afr_changelog_post_op_done (frame, this);
|
|
|
e7a346 |
- }
|
|
|
e7a346 |
+ afr_changelog_post_op (frame, this);
|
|
|
e7a346 |
|
|
|
e7a346 |
return 0;
|
|
|
e7a346 |
}
|
|
|
e7a346 |
@@ -2263,7 +2162,6 @@ void
|
|
|
e7a346 |
afr_transaction_start (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
{
|
|
|
e7a346 |
afr_local_t *local = frame->local;
|
|
|
e7a346 |
- afr_private_t *priv = this->private;
|
|
|
e7a346 |
fd_t *fd = NULL;
|
|
|
e7a346 |
|
|
|
e7a346 |
afr_transaction_eager_lock_init (local, this);
|
|
|
e7a346 |
@@ -2285,11 +2183,7 @@ afr_transaction_start (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
}
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
- if (afr_lock_server_count (priv, local->transaction.type) == 0) {
|
|
|
e7a346 |
- afr_internal_lock_finish (frame, this);
|
|
|
e7a346 |
- } else {
|
|
|
e7a346 |
- afr_lock (frame, this);
|
|
|
e7a346 |
- }
|
|
|
e7a346 |
+ afr_lock (frame, this);
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
int
|
|
|
e7a346 |
@@ -2321,7 +2215,6 @@ afr_transaction (call_frame_t *frame, xlator_t *this, afr_transaction_type type)
|
|
|
e7a346 |
local = frame->local;
|
|
|
e7a346 |
priv = this->private;
|
|
|
e7a346 |
|
|
|
e7a346 |
- local->transaction.resume = afr_transaction_resume;
|
|
|
e7a346 |
local->transaction.type = type;
|
|
|
e7a346 |
|
|
|
e7a346 |
if (!afr_is_consistent_io_possible (local, priv, &ret)) {
|
|
|
e7a346 |
diff --git a/xlators/cluster/afr/src/afr-transaction.h b/xlators/cluster/afr/src/afr-transaction.h
|
|
|
e7a346 |
index d01e144..ddcb1eb 100644
|
|
|
e7a346 |
--- a/xlators/cluster/afr/src/afr-transaction.h
|
|
|
e7a346 |
+++ b/xlators/cluster/afr/src/afr-transaction.h
|
|
|
e7a346 |
@@ -46,8 +46,6 @@ int afr_read_txn (call_frame_t *frame, xlator_t *this, inode_t *inode,
|
|
|
e7a346 |
|
|
|
e7a346 |
int afr_read_txn_continue (call_frame_t *frame, xlator_t *this, int subvol);
|
|
|
e7a346 |
|
|
|
e7a346 |
-int __afr_txn_write_fop (call_frame_t *frame, xlator_t *this);
|
|
|
e7a346 |
-int __afr_txn_write_done (call_frame_t *frame, xlator_t *this);
|
|
|
e7a346 |
call_frame_t *afr_transaction_detach_fop_frame (call_frame_t *frame);
|
|
|
e7a346 |
gf_boolean_t afr_has_quorum (unsigned char *subvols, xlator_t *this);
|
|
|
e7a346 |
gf_boolean_t afr_needs_changelog_update (afr_local_t *local);
|
|
|
e7a346 |
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
|
|
|
e7a346 |
index 9ed0481..dec6e60 100644
|
|
|
e7a346 |
--- a/xlators/cluster/afr/src/afr.c
|
|
|
e7a346 |
+++ b/xlators/cluster/afr/src/afr.c
|
|
|
e7a346 |
@@ -168,15 +168,6 @@ reconfigure (xlator_t *this, dict_t *options)
|
|
|
e7a346 |
priv->data_self_heal_window_size, options,
|
|
|
e7a346 |
uint32, out);
|
|
|
e7a346 |
|
|
|
e7a346 |
- GF_OPTION_RECONF ("data-change-log", priv->data_change_log, options,
|
|
|
e7a346 |
- bool, out);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- GF_OPTION_RECONF ("metadata-change-log",
|
|
|
e7a346 |
- priv->metadata_change_log, options, bool, out);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- GF_OPTION_RECONF ("entry-change-log", priv->entry_change_log, options,
|
|
|
e7a346 |
- bool, out);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
GF_OPTION_RECONF ("data-self-heal-algorithm",
|
|
|
e7a346 |
priv->data_self_heal_algorithm, options, str, out);
|
|
|
e7a346 |
|
|
|
e7a346 |
@@ -516,20 +507,9 @@ init (xlator_t *this)
|
|
|
e7a346 |
|
|
|
e7a346 |
GF_OPTION_INIT ("iam-nfs-daemon", priv->nfsd.iamnfsd, bool, out);
|
|
|
e7a346 |
|
|
|
e7a346 |
- GF_OPTION_INIT ("data-change-log", priv->data_change_log, bool, out);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- GF_OPTION_INIT ("metadata-change-log", priv->metadata_change_log, bool,
|
|
|
e7a346 |
- out);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- GF_OPTION_INIT ("entry-change-log", priv->entry_change_log, bool, out);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
GF_OPTION_INIT ("optimistic-change-log", priv->optimistic_change_log,
|
|
|
e7a346 |
bool, out);
|
|
|
e7a346 |
|
|
|
e7a346 |
- GF_OPTION_INIT ("inodelk-trace", priv->inodelk_trace, bool, out);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- GF_OPTION_INIT ("entrylk-trace", priv->entrylk_trace, bool, out);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
GF_OPTION_INIT ("pre-op-compat", priv->pre_op_compat, bool, out);
|
|
|
e7a346 |
GF_OPTION_INIT ("locking-scheme", priv->locking_scheme, str, out);
|
|
|
e7a346 |
GF_OPTION_INIT ("full-lock", priv->full_lock, bool, out);
|
|
|
e7a346 |
@@ -878,23 +858,20 @@ struct volume_options options[] = {
|
|
|
e7a346 |
{ .key = {"data-change-log"},
|
|
|
e7a346 |
.type = GF_OPTION_TYPE_BOOL,
|
|
|
e7a346 |
.default_value = "on",
|
|
|
e7a346 |
- .description = "Data fops like write/truncate will not perform "
|
|
|
e7a346 |
- "pre/post fop changelog operations in afr transaction "
|
|
|
e7a346 |
- "if this option is disabled"
|
|
|
e7a346 |
+ .description = "This option exists only for backward compatibility "
|
|
|
e7a346 |
+ "and configuring it doesn't have any effect"
|
|
|
e7a346 |
},
|
|
|
e7a346 |
{ .key = {"metadata-change-log"},
|
|
|
e7a346 |
.type = GF_OPTION_TYPE_BOOL,
|
|
|
e7a346 |
.default_value = "on",
|
|
|
e7a346 |
- .description = "Metadata fops like setattr/setxattr will not perform "
|
|
|
e7a346 |
- "pre/post fop changelog operations in afr transaction "
|
|
|
e7a346 |
- "if this option is disabled"
|
|
|
e7a346 |
+ .description = "This option exists only for backward compatibility "
|
|
|
e7a346 |
+ "and configuring it doesn't have any effect"
|
|
|
e7a346 |
},
|
|
|
e7a346 |
{ .key = {"entry-change-log"},
|
|
|
e7a346 |
.type = GF_OPTION_TYPE_BOOL,
|
|
|
e7a346 |
.default_value = "on",
|
|
|
e7a346 |
- .description = "Entry fops like create/unlink will not perform "
|
|
|
e7a346 |
- "pre/post fop changelog operations in afr transaction "
|
|
|
e7a346 |
- "if this option is disabled"
|
|
|
e7a346 |
+ .description = "This option exists only for backward compatibility "
|
|
|
e7a346 |
+ "and configuring it doesn't have any effect"
|
|
|
e7a346 |
},
|
|
|
e7a346 |
{ .key = {"optimistic-change-log"},
|
|
|
e7a346 |
.type = GF_OPTION_TYPE_BOOL,
|
|
|
e7a346 |
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h
|
|
|
e7a346 |
index a5b0d3b..5ff57c0 100644
|
|
|
e7a346 |
--- a/xlators/cluster/afr/src/afr.h
|
|
|
e7a346 |
+++ b/xlators/cluster/afr/src/afr.h
|
|
|
e7a346 |
@@ -110,10 +110,6 @@ typedef struct _afr_private {
|
|
|
e7a346 |
gf_boolean_t metadata_self_heal; /* on/off */
|
|
|
e7a346 |
gf_boolean_t entry_self_heal; /* on/off */
|
|
|
e7a346 |
|
|
|
e7a346 |
- gf_boolean_t data_change_log; /* on/off */
|
|
|
e7a346 |
- gf_boolean_t metadata_change_log; /* on/off */
|
|
|
e7a346 |
- gf_boolean_t entry_change_log; /* on/off */
|
|
|
e7a346 |
-
|
|
|
e7a346 |
gf_boolean_t metadata_splitbrain_forced_heal; /* on/off */
|
|
|
e7a346 |
int read_child; /* read-subvolume */
|
|
|
e7a346 |
unsigned int hash_mode; /* for when read_child is not set */
|
|
|
e7a346 |
@@ -123,9 +119,6 @@ typedef struct _afr_private {
|
|
|
e7a346 |
afr_favorite_child_policy fav_child_policy;/*Policy to use for automatic
|
|
|
e7a346 |
resolution of split-brains.*/
|
|
|
e7a346 |
|
|
|
e7a346 |
- gf_boolean_t inodelk_trace;
|
|
|
e7a346 |
- gf_boolean_t entrylk_trace;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
unsigned int wait_count; /* # of servers to wait for success */
|
|
|
e7a346 |
|
|
|
e7a346 |
gf_timer_t *timer; /* launched when parent up is received */
|
|
|
e7a346 |
@@ -187,33 +180,6 @@ typedef enum {
|
|
|
e7a346 |
AFR_ENTRY_RENAME_TRANSACTION, /* rename */
|
|
|
e7a346 |
} afr_transaction_type;
|
|
|
e7a346 |
|
|
|
e7a346 |
-typedef enum {
|
|
|
e7a346 |
- AFR_TRANSACTION_LK,
|
|
|
e7a346 |
- AFR_SELFHEAL_LK,
|
|
|
e7a346 |
-} transaction_lk_type_t;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-typedef enum {
|
|
|
e7a346 |
- AFR_LOCK_OP,
|
|
|
e7a346 |
- AFR_UNLOCK_OP,
|
|
|
e7a346 |
-} afr_lock_op_type_t;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-typedef enum {
|
|
|
e7a346 |
- AFR_DATA_SELF_HEAL_LK,
|
|
|
e7a346 |
- AFR_METADATA_SELF_HEAL_LK,
|
|
|
e7a346 |
- AFR_ENTRY_SELF_HEAL_LK,
|
|
|
e7a346 |
-}selfheal_lk_type_t;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-typedef enum {
|
|
|
e7a346 |
- AFR_INODELK_TRANSACTION,
|
|
|
e7a346 |
- AFR_INODELK_NB_TRANSACTION,
|
|
|
e7a346 |
- AFR_ENTRYLK_TRANSACTION,
|
|
|
e7a346 |
- AFR_ENTRYLK_NB_TRANSACTION,
|
|
|
e7a346 |
- AFR_INODELK_SELFHEAL,
|
|
|
e7a346 |
- AFR_INODELK_NB_SELFHEAL,
|
|
|
e7a346 |
- AFR_ENTRYLK_SELFHEAL,
|
|
|
e7a346 |
- AFR_ENTRYLK_NB_SELFHEAL,
|
|
|
e7a346 |
-} afr_lock_call_type_t;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
/*
|
|
|
e7a346 |
xattr format: trusted.afr.volume = [x y z]
|
|
|
e7a346 |
x - data pending
|
|
|
e7a346 |
@@ -286,9 +252,6 @@ typedef struct {
|
|
|
e7a346 |
unsigned char *locked_nodes;
|
|
|
e7a346 |
unsigned char *lower_locked_nodes;
|
|
|
e7a346 |
|
|
|
e7a346 |
- selfheal_lk_type_t selfheal_lk_type;
|
|
|
e7a346 |
- transaction_lk_type_t transaction_lk_type;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
int32_t lock_count;
|
|
|
e7a346 |
int32_t entrylk_lock_count;
|
|
|
e7a346 |
|
|
|
e7a346 |
@@ -809,12 +772,6 @@ typedef struct _afr_local {
|
|
|
e7a346 |
|
|
|
e7a346 |
int (*wind) (call_frame_t *frame, xlator_t *this, int subvol);
|
|
|
e7a346 |
|
|
|
e7a346 |
- int (*fop) (call_frame_t *frame, xlator_t *this);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- int (*done) (call_frame_t *frame, xlator_t *this);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- int (*resume) (call_frame_t *frame, xlator_t *this);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
int (*unwind) (call_frame_t *frame, xlator_t *this);
|
|
|
e7a346 |
|
|
|
e7a346 |
/* post-op hook */
|
|
|
e7a346 |
@@ -973,10 +930,6 @@ int
|
|
|
e7a346 |
afr_internal_lock_finish (call_frame_t *frame, xlator_t *this);
|
|
|
e7a346 |
|
|
|
e7a346 |
int
|
|
|
e7a346 |
-afr_lk_transfer_datalock (call_frame_t *dst, call_frame_t *src, char *dom,
|
|
|
e7a346 |
- unsigned int child_count);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
-int
|
|
|
e7a346 |
__afr_fd_ctx_set (xlator_t *this, fd_t *fd);
|
|
|
e7a346 |
|
|
|
e7a346 |
afr_fd_ctx_t *
|
|
|
e7a346 |
@@ -1100,8 +1053,7 @@ int
|
|
|
e7a346 |
afr_local_init (afr_local_t *local, afr_private_t *priv, int32_t *op_errno);
|
|
|
e7a346 |
|
|
|
e7a346 |
int
|
|
|
e7a346 |
-afr_internal_lock_init (afr_internal_lock_t *lk, size_t child_count,
|
|
|
e7a346 |
- transaction_lk_type_t lk_type);
|
|
|
e7a346 |
+afr_internal_lock_init (afr_internal_lock_t *lk, size_t child_count);
|
|
|
e7a346 |
|
|
|
e7a346 |
int
|
|
|
e7a346 |
afr_higher_errno (int32_t old_errno, int32_t new_errno);
|
|
|
e7a346 |
@@ -1246,7 +1198,7 @@ void
|
|
|
e7a346 |
afr_update_uninodelk (afr_local_t *local, afr_internal_lock_t *int_lock,
|
|
|
e7a346 |
int32_t child_index);
|
|
|
e7a346 |
int
|
|
|
e7a346 |
-afr_is_inodelk_transaction(afr_local_t *local);
|
|
|
e7a346 |
+afr_is_inodelk_transaction(afr_transaction_type type);
|
|
|
e7a346 |
|
|
|
e7a346 |
afr_fd_ctx_t *
|
|
|
e7a346 |
__afr_fd_ctx_get (fd_t *fd, xlator_t *this);
|
|
|
e7a346 |
--
|
|
|
e7a346 |
1.8.3.1
|
|
|
e7a346 |
|