summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/cluster/dht')
-rw-r--r--xlators/cluster/dht/src/dht-common.c184
-rw-r--r--xlators/cluster/dht/src/dht-linkfile.c14
-rw-r--r--xlators/cluster/dht/src/dht-rename.c14
-rw-r--r--xlators/cluster/dht/src/dht-selfheal.c3
-rw-r--r--xlators/cluster/dht/src/nufa.c12
5 files changed, 185 insertions, 42 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index d5d6f4c3e2f..49af12101b7 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -79,7 +79,8 @@ dht_lookup_selfheal_cbk (call_frame_t *frame, void *cookie,
int
dht_lookup_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno,
- inode_t *inode, struct stat *stbuf, dict_t *xattr)
+ inode_t *inode, struct stat *stbuf, dict_t *xattr,
+ struct stat *postparent)
{
dht_conf_t *conf = NULL;
dht_local_t *local = NULL;
@@ -190,7 +191,8 @@ selfheal:
int
dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno,
- inode_t *inode, struct stat *stbuf, dict_t *xattr)
+ inode_t *inode, struct stat *stbuf, dict_t *xattr,
+ struct stat *postparent)
{
dht_local_t *local = NULL;
int this_call_cnt = 0;
@@ -308,7 +310,8 @@ int
dht_lookup_linkfile_create_cbk (call_frame_t *frame, void *cookie,
xlator_t *this,
int32_t op_ret, int32_t op_errno,
- inode_t *inode, struct stat *stbuf)
+ inode_t *inode, struct stat *stbuf,
+ struct stat *preparent, struct stat *postparent)
{
dht_local_t *local = NULL;
xlator_t *cached_subvol = NULL;
@@ -345,7 +348,8 @@ unwind:
int
dht_lookup_everywhere_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
- inode_t *inode, struct stat *buf, dict_t *xattr)
+ inode_t *inode, struct stat *buf, dict_t *xattr,
+ struct stat *postparent)
{
dht_conf_t *conf = NULL;
dht_local_t *local = NULL;
@@ -521,7 +525,8 @@ dht_lookup_everywhere (call_frame_t *frame, xlator_t *this, loc_t *loc)
int
dht_lookup_linkfile_cbk (call_frame_t *frame, void *cookie,
xlator_t *this, int op_ret, int op_errno,
- inode_t *inode, struct stat *stbuf, dict_t *xattr)
+ inode_t *inode, struct stat *stbuf, dict_t *xattr,
+ struct stat *postparent)
{
call_frame_t *prev = NULL;
dht_local_t *local = NULL;
@@ -622,7 +627,8 @@ dht_lookup_directory (call_frame_t *frame, xlator_t *this, loc_t *loc)
int
dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno,
- inode_t *inode, struct stat *stbuf, dict_t *xattr)
+ inode_t *inode, struct stat *stbuf, dict_t *xattr,
+ struct stat *postparent)
{
dht_layout_t *layout = NULL;
char is_linkfile = 0;
@@ -853,6 +859,48 @@ err:
int
+dht_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int op_ret, int op_errno, struct stat *prebuf,
+ struct stat *postbuf)
+{
+ dht_local_t *local = NULL;
+ int this_call_cnt = 0;
+ call_frame_t *prev = NULL;
+
+
+ local = frame->local;
+ prev = cookie;
+
+ LOCK (&frame->lock);
+ {
+ if (op_ret == -1) {
+ local->op_errno = op_errno;
+ gf_log (this->name, GF_LOG_DEBUG,
+ "subvolume %s returned -1 (%s)",
+ prev->this->name, strerror (op_errno));
+ goto unlock;
+ }
+
+ dht_stat_merge (this, &local->stbuf, prebuf, prev->this);
+
+ if (local->inode)
+ local->stbuf.st_ino = local->inode->ino;
+ local->op_ret = 0;
+ }
+unlock:
+ UNLOCK (&frame->lock);
+
+ this_call_cnt = dht_frame_return (frame);
+ if (is_last_call (this_call_cnt))
+ DHT_STACK_UNWIND (frame, local->op_ret, local->op_errno,
+ &local->stbuf);
+
+ return 0;
+}
+
+
+
+int
dht_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno, struct stat *stbuf)
{
@@ -1031,7 +1079,7 @@ dht_truncate (call_frame_t *frame, xlator_t *this,
local->inode = inode_ref (loc->inode);
local->call_cnt = 1;
- STACK_WIND (frame, dht_attr_cbk,
+ STACK_WIND (frame, dht_truncate_cbk,
subvol, subvol->fops->truncate,
loc, offset);
@@ -1077,7 +1125,7 @@ dht_ftruncate (call_frame_t *frame, xlator_t *this,
local->inode = inode_ref (fd->inode);
local->call_cnt = 1;
- STACK_WIND (frame, dht_attr_cbk,
+ STACK_WIND (frame, dht_truncate_cbk,
subvol, subvol->fops->ftruncate,
fd, offset);
@@ -1092,6 +1140,78 @@ err:
int
+dht_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int op_ret, int op_errno, struct stat *preparent,
+ struct stat *postparent)
+{
+ dht_local_t *local = NULL;
+ int this_call_cnt = 0;
+ call_frame_t *prev = NULL;
+
+
+ local = frame->local;
+ prev = cookie;
+
+ LOCK (&frame->lock);
+ {
+ if (op_ret == -1) {
+ local->op_errno = op_errno;
+ gf_log (this->name, GF_LOG_DEBUG,
+ "subvolume %s returned -1 (%s)",
+ prev->this->name, strerror (op_errno));
+ goto unlock;
+ }
+
+ local->op_ret = 0;
+ }
+unlock:
+ UNLOCK (&frame->lock);
+
+ this_call_cnt = dht_frame_return (frame);
+ if (is_last_call (this_call_cnt))
+ DHT_STACK_UNWIND (frame, local->op_ret, local->op_errno);
+
+ return 0;
+}
+
+
+int
+dht_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret,
+ int op_errno, struct stat *prebuf, struct stat *postbuf)
+{
+ dht_local_t *local = NULL;
+ int this_call_cnt = 0;
+ call_frame_t *prev = NULL;
+
+
+ local = frame->local;
+ prev = cookie;
+
+ LOCK (&frame->lock);
+ {
+ if (op_ret == -1) {
+ local->op_errno = op_errno;
+ gf_log (this->name, GF_LOG_DEBUG,
+ "subvolume %s returned -1 (%s)",
+ prev->this->name, strerror (op_errno));
+ goto unlock;
+ }
+
+ local->op_ret = 0;
+ }
+unlock:
+ UNLOCK (&frame->lock);
+
+ this_call_cnt = dht_frame_return (frame);
+ if (is_last_call (this_call_cnt))
+ DHT_STACK_UNWIND (frame, local->op_ret, local->op_errno);
+
+ return 0;
+}
+
+
+
+int
dht_err_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno)
{
@@ -1175,9 +1295,9 @@ err:
int
dht_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno, const char *path)
+ int op_ret, int op_errno, const char *path, struct stat *sbuf)
{
- DHT_STACK_UNWIND (frame, op_ret, op_errno, path);
+ DHT_STACK_UNWIND (frame, op_ret, op_errno, path, sbuf);
return 0;
}
@@ -1397,7 +1517,7 @@ unlock:
int
dht_open (call_frame_t *frame, xlator_t *this,
- loc_t *loc, int flags, fd_t *fd)
+ loc_t *loc, int flags, fd_t *fd, int wbflags)
{
xlator_t *subvol = NULL;
int ret = -1;
@@ -1438,7 +1558,7 @@ dht_open (call_frame_t *frame, xlator_t *this,
STACK_WIND (frame, dht_fd_cbk,
subvol, subvol->fops->open,
- loc, flags, fd);
+ loc, flags, fd, wbflags);
return 0;
@@ -1499,9 +1619,10 @@ err:
int
dht_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno, struct stat *stbuf)
+ int op_ret, int op_errno, struct stat *prebuf,
+ struct stat *postbuf)
{
- DHT_STACK_UNWIND (frame, op_ret, op_errno, stbuf);
+ DHT_STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf);
return 0;
}
@@ -1616,7 +1737,7 @@ dht_fsync (call_frame_t *frame, xlator_t *this,
}
local->call_cnt = 1;
- STACK_WIND (frame, dht_err_cbk,
+ STACK_WIND (frame, dht_fsync_cbk,
subvol, subvol->fops->fsync,
fd, datasync);
@@ -2010,7 +2131,8 @@ err:
int
dht_newfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno,
- inode_t *inode, struct stat *stbuf)
+ inode_t *inode, struct stat *stbuf, struct stat *preparent,
+ struct stat *postparent)
{
call_frame_t *prev = NULL;
dht_layout_t *layout = NULL;
@@ -2052,7 +2174,8 @@ int
dht_mknod_linkfile_create_cbk (call_frame_t *frame, void *cookie,
xlator_t *this,
int32_t op_ret, int32_t op_errno,
- inode_t *inode, struct stat *stbuf)
+ inode_t *inode, struct stat *stbuf,
+ struct stat *preparent, struct stat *postparent)
{
dht_local_t *local = NULL;
xlator_t *cached_subvol = NULL;
@@ -2235,11 +2358,11 @@ dht_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc)
if (hashed_subvol != cached_subvol)
local->call_cnt++;
- STACK_WIND (frame, dht_err_cbk,
+ STACK_WIND (frame, dht_unlink_cbk,
cached_subvol, cached_subvol->fops->unlink, loc);
if (hashed_subvol != cached_subvol)
- STACK_WIND (frame, dht_err_cbk,
+ STACK_WIND (frame, dht_unlink_cbk,
hashed_subvol, hashed_subvol->fops->unlink, loc);
return 0;
@@ -2255,7 +2378,8 @@ err:
int
dht_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno,
- inode_t *inode, struct stat *stbuf)
+ inode_t *inode, struct stat *stbuf, struct stat *preparent,
+ struct stat *postparent)
{
call_frame_t *prev = NULL;
dht_layout_t *layout = NULL;
@@ -2289,7 +2413,8 @@ out:
int
dht_link_linkfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno,
- inode_t *inode, struct stat *stbuf)
+ inode_t *inode, struct stat *stbuf,
+ struct stat *preparent, struct stat *postparent)
{
dht_local_t *local = NULL;
xlator_t *srcvol = NULL;
@@ -2393,7 +2518,8 @@ err:
int
dht_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno,
- fd_t *fd, inode_t *inode, struct stat *stbuf)
+ fd_t *fd, inode_t *inode, struct stat *stbuf,
+ struct stat *preparent, struct stat *postparent)
{
call_frame_t *prev = NULL;
dht_layout_t *layout = NULL;
@@ -2435,7 +2561,8 @@ int
dht_create_linkfile_create_cbk (call_frame_t *frame, void *cookie,
xlator_t *this,
int32_t op_ret, int32_t op_errno,
- inode_t *inode, struct stat *stbuf)
+ inode_t *inode, struct stat *stbuf,
+ struct stat *preparent, struct stat *postparent)
{
dht_local_t *local = NULL;
xlator_t *cached_subvol = NULL;
@@ -2570,7 +2697,8 @@ dht_mkdir_selfheal_cbk (call_frame_t *frame, void *cookie,
int
dht_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno, inode_t *inode, struct stat *stbuf)
+ int op_ret, int op_errno, inode_t *inode, struct stat *stbuf,
+ struct stat *preparent, struct stat *postparent)
{
dht_local_t *local = NULL;
int this_call_cnt = 0;
@@ -2618,8 +2746,9 @@ unlock:
int
dht_mkdir_hashed_cbk (call_frame_t *frame, void *cookie,
- xlator_t *this, int op_ret, int op_errno,
- inode_t *inode, struct stat *stbuf)
+ xlator_t *this, int op_ret, int op_errno,
+ inode_t *inode, struct stat *stbuf,
+ struct stat *preparent, struct stat *postparent)
{
dht_local_t *local = NULL;
int ret = -1;
@@ -2764,7 +2893,8 @@ dht_rmdir_selfheal_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
dht_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno)
+ int op_ret, int op_errno, struct stat *preparent,
+ struct stat *postparent)
{
uint64_t tmp_layout = 0;
dht_local_t *local = NULL;
diff --git a/xlators/cluster/dht/src/dht-linkfile.c b/xlators/cluster/dht/src/dht-linkfile.c
index 213d3f2bf72..d28f7beca09 100644
--- a/xlators/cluster/dht/src/dht-linkfile.c
+++ b/xlators/cluster/dht/src/dht-linkfile.c
@@ -40,7 +40,7 @@ dht_linkfile_xattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
local = frame->local;
local->linkfile.linkfile_cbk (frame, cookie, this, op_ret, op_errno,
local->linkfile.inode,
- &local->linkfile.stbuf);
+ &local->linkfile.stbuf, NULL, NULL);
return 0;
}
@@ -48,8 +48,9 @@ dht_linkfile_xattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
dht_linkfile_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno,
- inode_t *inode, struct stat *stbuf)
+ int op_ret, int op_errno, inode_t *inode,
+ struct stat *stbuf, struct stat *preparent,
+ struct stat *postparent)
{
dht_local_t *local = NULL;
call_frame_t *prev = NULL;
@@ -104,8 +105,8 @@ err:
str_data = NULL;
}
- local->linkfile.linkfile_cbk (frame, cookie, this,
- op_ret, op_errno, inode, stbuf);
+ local->linkfile.linkfile_cbk (frame, cookie, this, op_ret, op_errno,
+ inode, stbuf, preparent, postparent);
return 0;
}
@@ -132,7 +133,8 @@ dht_linkfile_create (call_frame_t *frame, fop_mknod_cbk_t linkfile_cbk,
int
dht_linkfile_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno)
+ int32_t op_ret, int32_t op_errno,
+ struct stat *preparent, struct stat *postparent)
{
dht_local_t *local = NULL;
call_frame_t *prev = NULL;
diff --git a/xlators/cluster/dht/src/dht-rename.c b/xlators/cluster/dht/src/dht-rename.c
index 6c34dabad1e..f91d1983d69 100644
--- a/xlators/cluster/dht/src/dht-rename.c
+++ b/xlators/cluster/dht/src/dht-rename.c
@@ -33,7 +33,9 @@
int
dht_rename_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct stat *stbuf)
+ int32_t op_ret, int32_t op_errno, struct stat *stbuf,
+ struct stat *preoldparent, struct stat *postoldparent,
+ struct stat *prenewparent, struct stat *postnewparent)
{
dht_local_t *local = NULL;
int this_call_cnt = 0;
@@ -213,7 +215,8 @@ err:
int
dht_rename_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno)
+ int32_t op_ret, int32_t op_errno, struct stat *preparent,
+ struct stat *postparent)
{
dht_local_t *local = NULL;
call_frame_t *prev = NULL;
@@ -240,7 +243,9 @@ dht_rename_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
dht_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct stat *stbuf)
+ int32_t op_ret, int32_t op_errno, struct stat *stbuf,
+ struct stat *preoldparent, struct stat *postoldparent,
+ struct stat *prenewparent, struct stat *postnewparent)
{
dht_local_t *local = NULL;
call_frame_t *prev = NULL;
@@ -369,7 +374,8 @@ dht_do_rename (call_frame_t *frame)
int
dht_rename_links_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
- inode_t *inode, struct stat *stbuf)
+ inode_t *inode, struct stat *stbuf,
+ struct stat *preparent, struct stat *postparent)
{
dht_local_t *local = NULL;
call_frame_t *prev = NULL;
diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c
index df8b2047b2b..d3b36363ee3 100644
--- a/xlators/cluster/dht/src/dht-selfheal.c
+++ b/xlators/cluster/dht/src/dht-selfheal.c
@@ -196,7 +196,8 @@ dht_selfheal_dir_xattr (call_frame_t *frame, loc_t *loc, dht_layout_t *layout)
int
dht_selfheal_dir_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno,
- inode_t *inode, struct stat *stbuf)
+ inode_t *inode, struct stat *stbuf,
+ struct stat *preparent, struct stat *postparent)
{
dht_local_t *local = NULL;
dht_layout_t *layout = NULL;
diff --git a/xlators/cluster/dht/src/nufa.c b/xlators/cluster/dht/src/nufa.c
index 6be7206bfb5..17516a122c3 100644
--- a/xlators/cluster/dht/src/nufa.c
+++ b/xlators/cluster/dht/src/nufa.c
@@ -30,7 +30,8 @@
int
nufa_local_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno,
- inode_t *inode, struct stat *stbuf, dict_t *xattr)
+ inode_t *inode, struct stat *stbuf, dict_t *xattr,
+ struct stat *postparent)
{
dht_layout_t *layout = NULL;
xlator_t *subvol = NULL;
@@ -268,7 +269,9 @@ err:
int
nufa_create_linkfile_create_cbk (call_frame_t *frame, void *cookie,
xlator_t *this, int op_ret, int op_errno,
- inode_t *inode, struct stat *stbuf)
+ inode_t *inode, struct stat *stbuf,
+ struct stat *preparent,
+ struct stat *postparent)
{
dht_local_t *local = NULL;
call_frame_t *prev = NULL;
@@ -374,8 +377,9 @@ err:
int
nufa_mknod_linkfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno,
- inode_t *inode, struct stat *stbuf)
+ int op_ret, int op_errno, inode_t *inode,
+ struct stat *stbuf, struct stat *preparent,
+ struct stat *postparent)
{
dht_local_t *local = NULL;
call_frame_t *prev = NULL;