summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/afr/src/afr-dir-read.c100
-rw-r--r--xlators/cluster/afr/src/afr-dir-write.c141
-rw-r--r--xlators/cluster/afr/src/afr.c2
-rw-r--r--xlators/cluster/map/src/map.c17
-rw-r--r--xlators/cluster/stripe/src/stripe.c131
-rw-r--r--xlators/cluster/stripe/src/stripe.h1
-rw-r--r--xlators/debug/error-gen/src/error-gen.c131
-rw-r--r--xlators/debug/io-stats/src/io-stats.c70
-rw-r--r--xlators/debug/trace/src/trace.c99
-rw-r--r--xlators/performance/stat-prefetch/src/stat-prefetch.c134
-rw-r--r--xlators/protocol/client/src/client-protocol.c439
-rw-r--r--xlators/protocol/server/src/server-protocol.c446
-rw-r--r--xlators/storage/posix/src/posix.c149
-rw-r--r--xlators/storage/posix/src/posix.h9
14 files changed, 9 insertions, 1860 deletions
diff --git a/xlators/cluster/afr/src/afr-dir-read.c b/xlators/cluster/afr/src/afr-dir-read.c
index 91b9850b39b..384e9c98d0c 100644
--- a/xlators/cluster/afr/src/afr-dir-read.c
+++ b/xlators/cluster/afr/src/afr-dir-read.c
@@ -719,50 +719,6 @@ afr_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
return 0;
}
-int32_t
-afr_getdents_cbk (call_frame_t *frame, void *cookie,
- xlator_t *this, int32_t op_ret, int32_t op_errno,
- dir_entry_t *entry, int32_t count)
-{
- afr_private_t * priv = NULL;
- afr_local_t * local = NULL;
- xlator_t ** children = NULL;
-
- int unwind = 1;
- int last_tried = -1;
- int this_try = -1;
-
- priv = this->private;
- children = priv->children;
-
- local = frame->local;
-
- if (op_ret == -1) {
- last_tried = local->cont.getdents.last_tried;
-
- if (all_tried (last_tried, priv->child_count)) {
- goto out;
- }
-
- this_try = ++local->cont.getdents.last_tried;
- unwind = 0;
-
- STACK_WIND (frame, afr_getdents_cbk,
- children[this_try],
- children[this_try]->fops->getdents,
- local->fd, local->cont.getdents.size,
- local->cont.getdents.offset, local->cont.getdents.flag);
- }
-
-out:
- if (unwind) {
- AFR_STACK_UNWIND (getdents, frame, op_ret, op_errno,
- entry, count);
- }
-
- return 0;
-}
-
int32_t
afr_releasedir (xlator_t *this, fd_t *fd)
@@ -771,59 +727,3 @@ afr_releasedir (xlator_t *this, fd_t *fd)
return 0;
}
-
-
-int32_t
-afr_getdents (call_frame_t *frame, xlator_t *this,
- fd_t *fd, size_t size, off_t offset, int32_t flag)
-{
- afr_private_t * priv = NULL;
- xlator_t ** children = NULL;
- int call_child = 0;
- afr_local_t *local = NULL;
-
- int32_t op_ret = -1;
- int32_t op_errno = 0;
-
- VALIDATE_OR_GOTO (frame, out);
- VALIDATE_OR_GOTO (this, out);
- VALIDATE_OR_GOTO (this->private, out);
-
- priv = this->private;
- children = priv->children;
-
- ALLOC_OR_GOTO (local, afr_local_t, out);
-
- call_child = afr_first_up_child (priv);
- if (call_child == -1) {
- op_errno = ENOTCONN;
- gf_log (this->name, GF_LOG_DEBUG,
- "no child is up.");
- goto out;
- }
-
- local->cont.getdents.last_tried = call_child;
-
- local->fd = fd_ref (fd);
-
- local->cont.getdents.size = size;
- local->cont.getdents.offset = offset;
- local->cont.getdents.flag = flag;
-
- frame->local = local;
-
- STACK_WIND (frame, afr_getdents_cbk,
- children[call_child], children[call_child]->fops->getdents,
- fd, size, offset, flag);
-
- op_ret = 0;
-out:
- if (op_ret == -1) {
- AFR_STACK_UNWIND (getdents, frame, op_ret, op_errno,
- NULL, 0);
- }
-
- return 0;
-}
-
-
diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c
index 14d3e28c451..9d7e74e7871 100644
--- a/xlators/cluster/afr/src/afr-dir-write.c
+++ b/xlators/cluster/afr/src/afr-dir-write.c
@@ -2007,144 +2007,3 @@ out:
/* }}} */
-/* {{{ setdents */
-
-int32_t
-afr_setdents_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno)
-{
- afr_local_t * local = NULL;
- afr_private_t * priv = NULL;
-
- int call_count = -1;
- int child_index = (long) cookie;
-
- local = frame->local;
- priv = this->private;
-
- LOCK (&frame->lock);
- {
- if (afr_fop_failed (op_ret, op_errno))
- afr_transaction_fop_failed (frame, this, child_index);
-
- if ((op_ret != -1) && (local->success_count == 0)) {
- local->op_ret = op_ret;
- local->success_count++;
- }
-
- local->op_errno = op_errno;
- }
- UNLOCK (&frame->lock);
-
- call_count = afr_frame_return (frame);
-
- if (call_count == 0) {
- local->transaction.resume (frame, this);
- }
-
- return 0;
-}
-
-
-int32_t
-afr_setdents_wind (call_frame_t *frame, xlator_t *this)
-{
- afr_local_t *local = NULL;
- afr_private_t *priv = NULL;
-
- int call_count = -1;
- int i = 0;
-
- local = frame->local;
- priv = this->private;
-
- call_count = afr_up_children_count (priv->child_count, local->child_up);
-
- if (call_count == 0) {
- local->transaction.resume (frame, this);
- return 0;
- }
-
- local->call_count = call_count;
-
- for (i = 0; i < priv->child_count; i++) {
- if (local->child_up[i]) {
- STACK_WIND_COOKIE (frame, afr_setdents_wind_cbk,
- (void *) (long) i,
- priv->children[i],
- priv->children[i]->fops->setdents,
- local->fd, local->cont.setdents.flags,
- local->cont.setdents.entries,
- local->cont.setdents.count);
-
- if (!--call_count)
- break;
- }
- }
-
- return 0;
-}
-
-
-int32_t
-afr_setdents_done (call_frame_t *frame, xlator_t *this)
-{
- afr_local_t * local = frame->local;
-
- AFR_STACK_UNWIND (setdents, frame, local->op_ret, local->op_errno);
-
- return 0;
-}
-
-
-int32_t
-afr_setdents (call_frame_t *frame, xlator_t *this,
- fd_t *fd, int32_t flags, dir_entry_t *entries, int32_t count)
-{
- afr_private_t * priv = NULL;
- afr_local_t * local = NULL;
-
- int ret = -1;
-
- int op_ret = -1;
- int op_errno = 0;
-
- VALIDATE_OR_GOTO (frame, out);
- VALIDATE_OR_GOTO (this, out);
- VALIDATE_OR_GOTO (this->private, out);
-
- priv = this->private;
-
- ALLOC_OR_GOTO (local, afr_local_t, out);
-
- ret = AFR_LOCAL_INIT (local, priv);
- if (ret < 0) {
- op_errno = -ret;
- goto out;
- }
-
- frame->local = local;
-
- local->fd = fd_ref (fd);
-
- local->cont.setdents.flags = flags;
- local->cont.setdents.entries = entries;
- local->cont.setdents.count = count;
-
- local->transaction.fop = afr_setdents_wind;
- local->transaction.done = afr_setdents_done;
-
- local->transaction.basename = NULL;
-
- afr_transaction (frame, this, AFR_ENTRY_TRANSACTION);
-
- op_ret = 0;
-out:
- if (op_ret == -1) {
- AFR_STACK_UNWIND (setdents, frame, op_ret, op_errno);
- }
-
- return 0;
-}
-
-/* }}} */
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
index b7fbbd09c50..18cff07663c 100644
--- a/xlators/cluster/afr/src/afr.c
+++ b/xlators/cluster/afr/src/afr.c
@@ -3033,7 +3033,6 @@ struct xlator_fops fops = {
.opendir = afr_opendir,
.readdir = afr_readdir,
.readdirp = afr_readdirp,
- .getdents = afr_getdents,
/* dir write */
.create = afr_create,
@@ -3044,7 +3043,6 @@ struct xlator_fops fops = {
.link = afr_link,
.symlink = afr_symlink,
.rename = afr_rename,
- .setdents = afr_setdents,
};
diff --git a/xlators/cluster/map/src/map.c b/xlators/cluster/map/src/map.c
index 17de0c0954f..09d22b5d690 100644
--- a/xlators/cluster/map/src/map.c
+++ b/xlators/cluster/map/src/map.c
@@ -905,23 +905,6 @@ map_checksum_cbk (call_frame_t *frame,
}
-int32_t
-map_lock_notify_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno)
-{
- STACK_UNWIND (frame, op_ret, op_errno);
- return 0;
-}
-
-
-int32_t
-map_lock_fnotify_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno)
-{
- STACK_UNWIND (frame, op_ret, op_errno);
- return 0;
-}
-
/* Fops starts here */
int32_t
diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c
index a7fad23da81..eb5a154d5ee 100644
--- a/xlators/cluster/stripe/src/stripe.c
+++ b/xlators/cluster/stripe/src/stripe.c
@@ -2559,50 +2559,6 @@ stripe_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd,
}
/**
- * stripe_writedir -
- */
-int32_t
-stripe_setdents (call_frame_t *frame, xlator_t *this, fd_t *fd,
- int32_t flags, dir_entry_t *entries, int32_t count)
-{
- stripe_local_t *local = NULL;
- stripe_private_t *priv = NULL;
- xlator_list_t *trav = NULL;
- int32_t op_errno = 1;
-
- VALIDATE_OR_GOTO (frame, err);
- VALIDATE_OR_GOTO (this, err);
- VALIDATE_OR_GOTO (fd, err);
- VALIDATE_OR_GOTO (fd->inode, err);
-
- priv = this->private;
- trav = this->children;
-
- /* Initialization */
- local = CALLOC (1, sizeof (stripe_local_t));
- if (!local) {
- op_errno = ENOMEM;
- goto err;
- }
- local->op_ret = -1;
- frame->local = local;
- local->call_count = priv->child_count;
-
- while (trav) {
- STACK_WIND (frame, stripe_common_cbk, trav->xlator,
- trav->xlator->fops->setdents, fd, flags, entries,
- count);
- trav = trav->next;
- }
-
- return 0;
- err:
- STACK_UNWIND (frame, -1, op_errno);
- return 0;
-}
-
-
-/**
* stripe_flush -
*/
int32_t
@@ -3273,91 +3229,6 @@ stripe_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
/* Management operations */
-/**
- * stripe_stats_cbk - Add all the fields received from different clients.
- * Once all the clients return, send stats to above layer.
- *
- */
-int32_t
-stripe_stats_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct xlator_stats *stats)
-{
- int32_t callcnt = 0;
- stripe_local_t *local = NULL;
- call_frame_t *prev = NULL;
-
- prev = cookie;
- local = frame->local;
-
- LOCK(&frame->lock);
- {
- callcnt = --local->call_count;
-
- if (op_ret == -1) {
- gf_log (this->name, GF_LOG_DEBUG,
- "%s returned error %s",
- prev->this->name, strerror (op_errno));
- local->op_ret = -1;
- local->op_errno = op_errno;
- }
- if (op_ret == 0) {
- if (local->op_ret == -2) {
- /* This is to make sure this is the
- first time */
- local->stats = *stats;
- local->op_ret = 0;
- } else {
- local->stats.nr_files += stats->nr_files;
- local->stats.free_disk += stats->free_disk;
- local->stats.disk_usage += stats->disk_usage;
- local->stats.nr_clients += stats->nr_clients;
- }
- }
- }
- UNLOCK (&frame->lock);
-
- if (!callcnt) {
- STACK_UNWIND (frame, local->op_ret, local->op_errno,
- &local->stats);
- }
-
- return 0;
-}
-
-/**
- * stripe_stats -
- */
-int32_t
-stripe_stats (call_frame_t *frame, xlator_t *this, int32_t flags)
-{
- stripe_local_t *local = NULL;
- xlator_list_t *trav = NULL;
- stripe_private_t *priv = NULL;
- int32_t op_errno = 1;
-
- priv = this->private;
- trav = this->children;
-
- local = CALLOC (1, sizeof (stripe_local_t));
- if (!local) {
- op_errno = ENOMEM;
- goto err;
- }
- frame->local = local;
- local->op_ret = -2; /* to be used as a flag in _cbk */
- local->call_count = priv->child_count;
-
- while (trav) {
- STACK_WIND (frame, stripe_stats_cbk, trav->xlator,
- trav->xlator->mops->stats, flags);
- trav = trav->next;
- }
- return 0;
- err:
- STACK_UNWIND (frame, -1, op_errno, NULL);
- return 0;
-}
-
int32_t
stripe_release (xlator_t *this, fd_t *fd)
{
@@ -3674,12 +3545,10 @@ struct xlator_fops fops = {
.setattr = stripe_setattr,
.fsetattr = stripe_fsetattr,
.lookup = stripe_lookup,
- .setdents = stripe_setdents,
.mknod = stripe_mknod,
};
struct xlator_mops mops = {
- .stats = stripe_stats,
};
struct xlator_cbks cbks = {
diff --git a/xlators/cluster/stripe/src/stripe.h b/xlators/cluster/stripe/src/stripe.h
index 738727e9586..23ee4546d60 100644
--- a/xlators/cluster/stripe/src/stripe.h
+++ b/xlators/cluster/stripe/src/stripe.h
@@ -114,7 +114,6 @@ struct stripe_local {
struct readv_replies *replies;
struct statvfs statvfs_buf;
dir_entry_t *entry;
- struct xlator_stats stats;
int8_t revalidate;
int8_t failed;
diff --git a/xlators/debug/error-gen/src/error-gen.c b/xlators/debug/error-gen/src/error-gen.c
index 931e9dc96a1..434965b5c1a 100644
--- a/xlators/debug/error-gen/src/error-gen.c
+++ b/xlators/debug/error-gen/src/error-gen.c
@@ -124,9 +124,6 @@ sys_error_t error_no_list[] = {
[ERR_READDIRP] = { .error_no_count = 5,
.error_no = {EINVAL,EACCES,EBADF,
EMFILE,ENOENT}},
- [ERR_GETDENTS] = { .error_no_count = 5,
- .error_no = {EBADF,EFAULT,EINVAL,
- ENOENT,ENOTDIR}},
[ERR_FSYNCDIR] = { .error_no_count = 4,
.error_no = {EBADF,EIO,EROFS,EINVAL}},
[ERR_ACCESS] = { .error_no_count = 8,
@@ -144,9 +141,6 @@ sys_error_t error_no_list[] = {
[ERR_LK] = { .error_no_count = 4,
.error_no = {EACCES,EFAULT,ENOENT,
EINTR}},
- [ERR_SETDENTS] = { .error_no_count = 4,
- .error_no = {EACCES,EBADF,EINTR,
- ENAMETOOLONG}},
[ERR_CHECKSUM] = { .error_no_count = 4,
.error_no = {EACCES,EBADF,
ENAMETOOLONG,EINTR}},
@@ -180,9 +174,6 @@ sys_error_t error_no_list[] = {
ENAMETOOLONG,ENOENT,
ENOMEM,ENOTDIR,EPERM,
EROFS,EBADF,EIO}},
- [ERR_STATS] = { .error_no_count = 4,
- .error_no = {EACCES,EBADF,ENAMETOOLONG,
- EINTR}},
[ERR_GETSPEC] = { .error_no_count = 4,
.error_no = {EACCES,EBADF,ENAMETOOLONG,
EINTR}}
@@ -304,8 +295,6 @@ get_fop_int (char **op_no_str)
return ERR_READDIR;
else if (!strcmp ((*op_no_str), "readdirp"))
return ERR_READDIRP;
- else if (!strcmp ((*op_no_str), "getdents"))
- return ERR_GETDENTS;
else if (!strcmp ((*op_no_str), "fsyncdir"))
return ERR_FSYNCDIR;
else if (!strcmp ((*op_no_str), "access"))
@@ -316,8 +305,6 @@ get_fop_int (char **op_no_str)
return ERR_FSTAT;
else if (!strcmp ((*op_no_str), "lk"))
return ERR_LK;
- else if (!strcmp ((*op_no_str), "setdents"))
- return ERR_SETDENTS;
else if (!strcmp ((*op_no_str), "checksum"))
return ERR_CHECKSUM;
else if (!strcmp ((*op_no_str), "xattrop"))
@@ -336,8 +323,6 @@ get_fop_int (char **op_no_str)
return ERR_SETATTR;
else if (!strcmp ((*op_no_str), "fsetattr"))
return ERR_FSETATTR;
- else if (!strcmp ((*op_no_str), "stats"))
- return ERR_STATS;
else if (!strcmp ((*op_no_str), "getspec"))
return ERR_GETSPEC;
else
@@ -1280,83 +1265,6 @@ error_gen_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd)
return 0;
}
-
-int
-error_gen_getdents_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, dir_entry_t *entries,
- int32_t count)
-{
- STACK_UNWIND_STRICT (getdents, frame, op_ret, op_errno, entries,
- count);
- return 0;
-}
-
-
-int
-error_gen_getdents (call_frame_t *frame, xlator_t *this, fd_t *fd,
- size_t size, off_t offset, int32_t flag)
-{
- int op_errno = 0;
- eg_t *egp = NULL;
- int enable = 1;
-
- egp = this->private;
- enable = egp->enable[ERR_GETDENTS];
-
- if (enable)
- op_errno = error_gen (this, ERR_GETDENTS);
-
- if (op_errno) {
- GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno));
- STACK_UNWIND_STRICT (getdents, frame, -1, op_errno, NULL, 0);
- return 0;
- }
-
- STACK_WIND (frame, error_gen_getdents_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->getdents,
- fd, size, offset, flag);
- return 0;
-}
-
-
-int
-error_gen_setdents_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno)
-{
- STACK_UNWIND_STRICT (setdents, frame, op_ret, op_errno);
- return 0;
-}
-
-
-int
-error_gen_setdents (call_frame_t *frame, xlator_t *this, fd_t *fd,
- int32_t flags, dir_entry_t *entries, int32_t count)
-{
- int op_errno = 0;
- eg_t *egp = NULL;
- int enable = 1;
-
- egp = this->private;
- enable = egp->enable[ERR_SETDENTS];
-
- if (enable)
- op_errno = error_gen (this, ERR_SETDENTS);
-
- if (op_errno) {
- GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno));
- STACK_UNWIND_STRICT (setdents, frame, -1, op_errno);
- return 0;
- }
-
- STACK_WIND (frame, error_gen_setdents_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->setdents,
- fd, flags, entries, count);
- return 0;
-}
-
-
int
error_gen_fsyncdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno)
@@ -1815,42 +1723,6 @@ error_gen_fentrylk (call_frame_t *frame, xlator_t *this,
/* Management operations */
-int
-error_gen_stats_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- struct xlator_stats *stats)
-{
- STACK_UNWIND (frame, op_ret, op_errno, stats);
- return 0;
-}
-
-
-int
-error_gen_stats (call_frame_t *frame, xlator_t *this, int32_t flags)
-{
- int op_errno = 0;
- eg_t *egp = NULL;
- int enable = 1;
-
- egp = this->private;
- enable = egp->enable[ERR_STATS];
-
- if (enable)
- op_errno = error_gen (this, ERR_STATS);
-
- if (op_errno) {
- GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno));
- STACK_UNWIND (frame, -1, op_errno, NULL);
- return 0;
- }
-
- STACK_WIND (frame, error_gen_stats_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->mops->stats,
- flags);
- return 0;
-}
-
int
error_gen_getspec_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
@@ -2154,13 +2026,11 @@ struct xlator_fops fops = {
.opendir = error_gen_opendir,
.readdir = error_gen_readdir,
.readdirp = error_gen_readdirp,
- .getdents = error_gen_getdents,
.fsyncdir = error_gen_fsyncdir,
.access = error_gen_access,
.ftruncate = error_gen_ftruncate,
.fstat = error_gen_fstat,
.lk = error_gen_lk,
- .setdents = error_gen_setdents,
.lookup_cbk = error_gen_lookup_cbk,
.checksum = error_gen_checksum,
.xattrop = error_gen_xattrop,
@@ -2174,7 +2044,6 @@ struct xlator_fops fops = {
};
struct xlator_mops mops = {
- .stats = error_gen_stats,
.getspec = error_gen_getspec,
};
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
index eecca0a72b9..fa0c8891e7c 100644
--- a/xlators/debug/io-stats/src/io-stats.c
+++ b/xlators/debug/io-stats/src/io-stats.c
@@ -462,14 +462,6 @@ io_stats_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
-int
-io_stats_getdents_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- dir_entry_t *entries, int32_t count)
-{
- STACK_UNWIND_STRICT (getdents, frame, op_ret, op_errno, entries, count);
- return 0;
-}
int
@@ -731,15 +723,6 @@ io_stats_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-io_stats_setdents_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno)
-{
- STACK_UNWIND_STRICT (setdents, frame, op_ret, op_errno);
- return 0;
-}
-
-
-int
io_stats_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno)
{
@@ -1246,21 +1229,6 @@ io_stats_opendir (call_frame_t *frame, xlator_t *this,
return 0;
}
-
-int
-io_stats_getdents (call_frame_t *frame, xlator_t *this,
- fd_t *fd, size_t size, off_t offset, int32_t flag)
-{
- BUMP_FOP (GETDENTS);
-
- STACK_WIND (frame, io_stats_getdents_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->getdents,
- fd, size, offset, flag);
- return 0;
-}
-
-
int
io_stats_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
off_t offset)
@@ -1377,21 +1345,6 @@ io_stats_lk (call_frame_t *frame, xlator_t *this,
int
-io_stats_setdents (call_frame_t *frame, xlator_t *this,
- fd_t *fd, int32_t flags,
- dir_entry_t *entries, int32_t count)
-{
- BUMP_FOP (SETDENTS);
-
- STACK_WIND (frame, io_stats_setdents_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->setdents,
- fd, flags, entries, count);
- return 0;
-}
-
-
-int
io_stats_checksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
uint8_t *fchecksum, uint8_t *dchecksum)
@@ -1416,26 +1369,6 @@ io_stats_checksum (call_frame_t *frame, xlator_t *this,
}
-int
-io_stats_stats_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct xlator_stats *stats)
-{
- STACK_UNWIND (frame, op_ret, op_errno, stats);
- return 0;
-}
-
-
-int
-io_stats_stats (call_frame_t *frame, xlator_t *this, int32_t flags)
-{
- STACK_WIND (frame, io_stats_stats_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->mops->stats,
- flags);
-
- return 0;
-}
-
int
io_stats_release (xlator_t *this, fd_t *fd)
@@ -1576,8 +1509,6 @@ struct xlator_fops fops = {
.finodelk = io_stats_finodelk,
.entrylk = io_stats_entrylk,
.lookup = io_stats_lookup,
- .setdents = io_stats_setdents,
- .getdents = io_stats_getdents,
.checksum = io_stats_checksum,
.xattrop = io_stats_xattrop,
.fxattrop = io_stats_fxattrop,
@@ -1586,7 +1517,6 @@ struct xlator_fops fops = {
};
struct xlator_mops mops = {
- .stats = io_stats_stats,
};
struct xlator_cbks cbks = {
diff --git a/xlators/debug/trace/src/trace.c b/xlators/debug/trace/src/trace.c
index a9e580c0e92..5d1d342db88 100644
--- a/xlators/debug/trace/src/trace.c
+++ b/xlators/debug/trace/src/trace.c
@@ -271,21 +271,6 @@ trace_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
-int
-trace_getdents_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, dir_entry_t *entries,
- int32_t count)
-{
- if (trace_fop_names[GF_FOP_GETDENTS].enabled) {
- gf_log (this->name, GF_LOG_NORMAL,
- "%"PRId64": (op_ret=%d, op_errno=%d, count=%d)",
- frame->root->unique, op_ret, op_errno, count);
- }
-
- STACK_UNWIND_STRICT (getdents, frame, op_ret, op_errno, entries, count);
- return 0;
-}
-
int
trace_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
@@ -1112,20 +1097,6 @@ trace_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
-int
-trace_setdents_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno)
-{
- if (trace_fop_names[GF_FOP_SETDENTS].enabled) {
- gf_log (this->name, GF_LOG_NORMAL,
- "%"PRId64": op_ret=%d, op_errno=%d",
- frame->root->unique, op_ret, op_errno);
- }
-
- STACK_UNWIND_STRICT (setdents, frame, op_ret, op_errno);
- return 0;
-}
-
int
trace_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
@@ -1801,25 +1772,6 @@ trace_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd)
return 0;
}
-
-int
-trace_getdents (call_frame_t *frame, xlator_t *this, fd_t *fd,
- size_t size, off_t offset, int32_t flag)
-{
- if (trace_fop_names[GF_FOP_GETDENTS].enabled) {
- gf_log (this->name, GF_LOG_NORMAL,
- "%"PRId64": (fd=%p, size=%"GF_PRI_SIZET", offset=%"PRId64", flag=0x%x)",
- frame->root->unique, fd, size, offset, flag);
- }
-
- STACK_WIND (frame, trace_getdents_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->getdents,
- fd, size, offset, flag);
- return 0;
-}
-
-
int
trace_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
off_t offset)
@@ -1951,24 +1903,6 @@ trace_lk (call_frame_t *frame, xlator_t *this, fd_t *fd,
int
-trace_setdents (call_frame_t *frame, xlator_t *this, fd_t *fd,
- int32_t flags, dir_entry_t *entries, int32_t count)
-{
- if (trace_fop_names[GF_FOP_SETDENTS].enabled) {
- gf_log (this->name, GF_LOG_NORMAL,
- "%"PRId64": (*fd=%p, flags=%d, count=%d",
- frame->root->unique, fd, flags, count);
- }
-
- STACK_WIND (frame, trace_setdents_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->setdents,
- fd, flags, entries, count);
- return 0;
-}
-
-
-int
trace_checksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
uint8_t *fchecksum, uint8_t *dchecksum)
@@ -2000,36 +1934,6 @@ trace_checksum (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flag)
}
-int
-trace_stats_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- struct xlator_stats *stats)
-{
- gf_log (this->name, GF_LOG_NORMAL,
- "%"PRId64": op_ret (%d), op_errno(%d)",
- frame->root->unique, op_ret, op_errno);
-
- STACK_UNWIND (frame, op_ret, op_errno, stats);
- return 0;
-}
-
-
-int
-trace_stats (call_frame_t *frame, xlator_t *this, int32_t flags)
-{
- gf_log (this->name, GF_LOG_NORMAL,
- "%"PRId64": (flags=%d)",
- frame->root->unique, flags);
-
- STACK_WIND (frame, trace_stats_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->mops->stats,
- flags);
-
- return 0;
-}
-
-
void
enable_all_calls (int enabled)
{
@@ -2185,8 +2089,6 @@ struct xlator_fops fops = {
.finodelk = trace_finodelk,
.entrylk = trace_entrylk,
.lookup = trace_lookup,
- .setdents = trace_setdents,
- .getdents = trace_getdents,
.checksum = trace_checksum,
.xattrop = trace_xattrop,
.fxattrop = trace_fxattrop,
@@ -2195,7 +2097,6 @@ struct xlator_fops fops = {
};
struct xlator_mops mops = {
- .stats = trace_stats,
};
struct xlator_cbks cbks = {
diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c
index b3777cb76cd..c54042130e8 100644
--- a/xlators/performance/stat-prefetch/src/stat-prefetch.c
+++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c
@@ -3107,138 +3107,6 @@ out:
return 0;
}
-
-int32_t
-sp_setdents (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags,
- dir_entry_t *entries, int32_t count)
-{
- sp_fd_ctx_t *fd_ctx = NULL;
- sp_cache_t *cache = NULL;
- uint64_t value = 0;
- int32_t ret = 0;
- inode_t *parent = NULL;
- char *name = NULL;
- dir_entry_t *trav = NULL;
-
- ret = fd_ctx_get (fd, this, &value);
- if (ret == -1) {
- errno = EINVAL;
- goto unwind;
- }
-
- fd_ctx = (void *)(long)value;
- name = fd_ctx->name;
- parent = fd_ctx->parent_inode;
-
- cache = sp_get_cache_inode (this, parent, frame->root->pid);
- if (cache) {
- sp_cache_remove_entry (cache, name, 0);
- sp_cache_unref (cache);
- }
-
- cache = sp_get_cache_fd (this, fd);
- if (cache) {
- for (trav = entries->next; trav; trav = trav->next) {
- sp_cache_remove_entry (cache, trav->name, 0);
- }
- sp_cache_unref (cache);
- }
-
- STACK_WIND (frame, sp_err_cbk, FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->setdents, fd, flags, entries,
- count);
- return 0;
-
-unwind:
- SP_STACK_UNWIND (setdents, frame, -1, errno);
- return 0;
-}
-
-
-int32_t
-sp_getdents_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, dir_entry_t *entries,
- int32_t count)
-{
- dir_entry_t *trav = NULL;
- sp_local_t *local = NULL;
- sp_cache_t *cache = NULL;
-
- if (op_ret == -1) {
- goto out;
- }
-
- local = frame->local;
- if ((local == NULL) || (local->fd == NULL)) {
- op_ret = -1;
- op_errno = EINVAL;
- goto out;
- }
-
- cache = sp_get_cache_fd (this, local->fd);
- if (cache) {
- for (trav = entries->next; trav; trav = trav->next) {
- if (IA_ISLNK (trav->buf.ia_type)) {
- sp_cache_remove_entry (cache, trav->name, 0);
- }
- }
-
- sp_cache_unref (cache);
- }
-
-out:
- SP_STACK_UNWIND (getdents, frame, op_ret, op_errno, entries, count);
- return 0;
-}
-
-
-int32_t
-sp_getdents (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
- off_t offset, int32_t flags)
-{
- sp_fd_ctx_t *fd_ctx = NULL;
- sp_cache_t *cache = NULL;
- uint64_t value = 0;
- int32_t ret = 0;
- inode_t *parent = NULL;
- char *name = NULL;
- sp_local_t *local = NULL;
-
- ret = fd_ctx_get (fd, this, &value);
- if (ret == -1) {
- errno = EINVAL;
- goto unwind;
- }
-
- fd_ctx = (void *)(long)value;
- name = fd_ctx->name;
- parent = fd_ctx->parent_inode;
-
- cache = sp_get_cache_inode (this, parent, frame->root->pid);
- if (cache) {
- sp_cache_remove_entry (cache, name, 0);
- sp_cache_unref (cache);
- }
-
- local = CALLOC (1, sizeof (*local));
- if (local == NULL) {
- gf_log (this->name, GF_LOG_ERROR, "out of memory");
- goto unwind;
- }
-
- local->fd = fd;
- frame->local = local;
-
- STACK_WIND (frame, sp_getdents_cbk, FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->getdents, fd, size, offset, flags);
- return 0;
-
-unwind:
- SP_STACK_UNWIND (getdents, frame, -1, errno, NULL, -1);
- return 0;
-}
-
-
int32_t
sp_checksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, uint8_t *file_checksum,
@@ -3904,8 +3772,6 @@ struct xlator_fops fops = {
.rename = sp_rename,
.setxattr = sp_setxattr,
.removexattr = sp_removexattr,
- .setdents = sp_setdents,
- .getdents = sp_getdents,
.checksum = sp_checksum,
.xattrop = sp_xattrop,
.fxattrop = sp_fxattrop,
diff --git a/xlators/protocol/client/src/client-protocol.c b/xlators/protocol/client/src/client-protocol.c
index f50182a6bd1..36a31c5c918 100644
--- a/xlators/protocol/client/src/client-protocol.c
+++ b/xlators/protocol/client/src/client-protocol.c
@@ -2377,75 +2377,6 @@ unwind:
}
-
-/**
- * client_readdir - readdir function for client protocol
- * @frame: call frame
- * @this: this translator structure
- *
- * external reference through client_protocol_xlator->fops->readdir
- */
-
-int
-client_getdents (call_frame_t *frame, xlator_t *this, fd_t *fd,
- size_t size, off_t offset, int32_t flag)
-{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_getdents_req_t *req = NULL;
- size_t hdrlen = 0;
- int64_t remote_fd = -1;
- int ret = -1;
- client_fd_ctx_t *fdctx = NULL;
- client_conf_t *conf = NULL;
-
- conf = this->private;
-
- pthread_mutex_lock (&conf->mutex);
- {
- fdctx = this_fd_get_ctx (fd, this);
- }
- pthread_mutex_unlock (&conf->mutex);
-
- if (fdctx == NULL) {
- gf_log (this->name, GF_LOG_TRACE,
- "(%"PRId64"): failed to get fd ctx. EBADFD",
- fd->inode->ino);
- STACK_UNWIND (frame, -1, EBADFD, NULL);
- return 0;
- }
-
- if (fdctx->remote_fd == -1) {
- gf_log (this->name, GF_LOG_TRACE,
- "(%"PRId64"): failed to get fd ctx. EBADFD",
- fd->inode->ino);
- STACK_UNWIND (frame, -1, EBADFD, NULL);
- }
-
- remote_fd = fdctx->remote_fd;
- hdrlen = gf_hdr_len (req, 0);
- hdr = gf_hdr_new (req, 0);
- GF_VALIDATE_OR_GOTO (frame->this->name, hdr, unwind);
-
- req = gf_param (hdr);
- GF_VALIDATE_OR_GOTO (frame->this->name, hdr, unwind);
-
- req->fd = hton64 (remote_fd);
- req->size = hton32 (size);
- req->offset = hton64 (offset);
- req->flags = hton32 (flag);
-
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_BULK),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_GETDENTS,
- hdr, hdrlen, NULL, 0, NULL);
-
- return 0;
-unwind:
- STACK_UNWIND (frame, -1, EINVAL, NULL, 0);
- return 0;
-}
-
-
/**
* client_readdirp - readdirp function for client protocol
* @frame: call frame
@@ -3368,157 +3299,6 @@ unwind:
int
-client_setdents (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags,
- dir_entry_t *entries, int32_t count)
-{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_setdents_req_t *req = NULL;
- int64_t remote_fd = 0;
- char *ptr = NULL;
- dir_entry_t *trav = NULL;
- uint32_t len = 0;
- int32_t buf_len = 0;
- int32_t ret = -1;
- int32_t op_ret = -1;
- int32_t op_errno = EINVAL;
- int32_t vec_count = 0;
- size_t hdrlen = -1;
- struct iovec vector[1];
- struct iobref *iobref = NULL;
- struct iobuf *iobuf = NULL;
- client_fd_ctx_t *fdctx = NULL;
- client_conf_t *conf = NULL;
-
- GF_VALIDATE_OR_GOTO (this->name, fd, unwind);
-
- conf = this->private;
-
- pthread_mutex_lock (&conf->mutex);
- {
- fdctx = this_fd_get_ctx (fd, this);
- }
- pthread_mutex_unlock (&conf->mutex);
-
- if (fdctx == NULL) {
- gf_log (this->name, GF_LOG_DEBUG,
- "(%"PRId64"): failed to get fd ctx. EBADFD",
- fd->inode->ino);
- op_errno = EBADFD;
- goto unwind;
- }
-
- if (fdctx->remote_fd == -1) {
- gf_log (this->name, GF_LOG_DEBUG,
- "(%"PRId64"): failed to get fd ctx. EBADFD",
- fd->inode->ino);
- op_errno = EBADFD;
- goto unwind;
- }
-
- remote_fd = fdctx->remote_fd;
- GF_VALIDATE_OR_GOTO (this->name, entries, unwind);
- GF_VALIDATE_OR_GOTO (this->name, count, unwind);
-
- trav = entries->next;
- while (trav) {
- len += strlen (trav->name);
- len += 1;
- len += strlen (trav->link);
- len += 1;
- len += 256; // max possible for statbuf;
- trav = trav->next;
- }
- iobuf = iobuf_get (this->ctx->iobuf_pool);
- GF_VALIDATE_OR_GOTO (this->name, iobuf, unwind);
-
- ptr = iobuf->ptr;
-
- trav = entries->next;
- while (trav) {
- int32_t this_len = 0;
- char *tmp_buf = NULL;
- struct iatt *stbuf = &trav->buf;
- {
- /* Convert the stat buf to string */
- uint64_t dev = stbuf->ia_gen;
- uint64_t ino = stbuf->ia_ino;
- uint32_t mode = st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type);
- uint32_t nlink = stbuf->ia_nlink;
- uint32_t uid = stbuf->ia_uid;
- uint32_t gid = stbuf->ia_gid;
- uint64_t rdev = stbuf->ia_rdev;
- uint64_t size = stbuf->ia_size;
- uint32_t blksize = stbuf->ia_blksize;
- uint64_t blocks = stbuf->ia_blocks;
-
- uint32_t atime = stbuf->ia_atime;
- uint32_t mtime = stbuf->ia_mtime;
- uint32_t ctime = stbuf->ia_ctime;
-
- uint32_t atime_nsec = stbuf->ia_atime_nsec;
- uint32_t mtime_nsec = stbuf->ia_mtime_nsec;
- uint32_t ctime_nsec = stbuf->ia_ctime_nsec;
-
- ret = asprintf (&tmp_buf, GF_STAT_PRINT_FMT_STR,
- dev, ino, mode, nlink, uid, gid,
- rdev, size, blksize, blocks,
- atime, atime_nsec, mtime, mtime_nsec,
- ctime, ctime_nsec);
- if (-1 == ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "asprintf failed while setting stat "
- "buf to string");
- STACK_UNWIND (frame, -1, ENOMEM);
- return 0;
- }
- }
- this_len = sprintf (ptr, "%s/%s%s\n",
- trav->name, tmp_buf, trav->link);
-
- FREE (tmp_buf);
- trav = trav->next;
- ptr += this_len;
- }
- buf_len = strlen (iobuf->ptr);
-
- hdrlen = gf_hdr_len (req, 0);
- hdr = gf_hdr_new (req, 0);
- GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
-
- req = gf_param (hdr);
-
- req->fd = hton64 (remote_fd);
- req->flags = hton32 (flags);
- req->count = hton32 (count);
-
- iobref = iobref_new ();
- iobref_add (iobref, iobuf);
-
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_BULK),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_SETDENTS,
- hdr, hdrlen, vector, vec_count, iobref);
-
- if (iobref)
- iobref_unref (iobref);
-
- if (iobuf)
- iobuf_unref (iobuf);
-
- return ret;
-unwind:
-
- if (iobref)
- iobref_unref (iobref);
-
- if (iobuf)
- iobuf_unref (iobuf);
-
- STACK_UNWIND (frame, op_ret, op_errno);
- return 0;
-}
-
-int
client_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
struct iatt *stbuf, int32_t valid)
{
@@ -3766,45 +3546,6 @@ client_release (xlator_t *this, fd_t *fd)
* MGMT_OPS
*/
-/**
- * client_stats - stats function for client protocol
- * @frame: call frame
- * @this: this translator structure
- * @flags:
- *
- * external reference through client_protocol_xlator->mops->stats
- */
-
-int
-client_stats (call_frame_t *frame, xlator_t *this, int32_t flags)
-{
- gf_hdr_common_t *hdr = NULL;
- gf_mop_stats_req_t *req = NULL;
- size_t hdrlen = -1;
- int ret = -1;
-
- GF_VALIDATE_OR_GOTO ("client", this, unwind);
-
- hdrlen = gf_hdr_len (req, 0);
- hdr = gf_hdr_new (req, 0);
- GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
-
- req = gf_param (hdr);
-
- req->flags = hton32 (flags);
-
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_BULK),
- GF_OP_TYPE_MOP_REQUEST, GF_MOP_STATS,
- hdr, hdrlen, NULL, 0, NULL);
-
- return ret;
-unwind:
- STACK_UNWIND (frame, -1, EINVAL, NULL);
- return 0;
-}
-
-
/* Callbacks */
int
@@ -5036,74 +4777,6 @@ client_fsetattr_cbk (call_frame_t *frame,gf_hdr_common_t *hdr, size_t hdrlen,
return 0;
}
-static dir_entry_t *
-gf_bin_to_direntry (char *buf, size_t count)
-{
- int idx = 0;
- int bread = 0;
- size_t rcount = 0;
- char *ender = NULL;
- char *buffer = NULL;
- char tmp_buf[512] = {0,};
- dir_entry_t *trav = NULL;
- dir_entry_t *prev = NULL;
- dir_entry_t *thead = NULL;
- dir_entry_t *head = NULL;
-
- thead = CALLOC (1, sizeof (dir_entry_t));
- GF_VALIDATE_OR_GOTO ("client-protocol", thead, fail);
-
- buffer = buf;
- prev = thead;
-
- for (idx = 0; idx < count ; idx++) {
- bread = 0;
- trav = CALLOC (1, sizeof (dir_entry_t));
- GF_VALIDATE_OR_GOTO ("client-protocol", trav, fail);
-
- ender = strchr (buffer, '/');
- if (!ender)
- break;
- rcount = ender - buffer;
- trav->name = CALLOC (1, rcount + 2);
- GF_VALIDATE_OR_GOTO ("client-protocol", trav->name, fail);
-
- strncpy (trav->name, buffer, rcount);
- bread = rcount + 1;
- buffer += bread;
-
- ender = strchr (buffer, '\n');
- if (!ender)
- break;
- rcount = ender - buffer;
- strncpy (tmp_buf, buffer, rcount);
- bread = rcount + 1;
- buffer += bread;
-
- gf_string_to_stat (tmp_buf, &trav->buf);
-
- ender = strchr (buffer, '\n');
- if (!ender)
- break;
- rcount = ender - buffer;
- *ender = '\0';
- if (IA_ISLNK (trav->buf.ia_type))
- trav->link = strdup (buffer);
- else
- trav->link = "";
-
- bread = rcount + 1;
- buffer += bread;
-
- prev->next = trav;
- prev = trav;
- }
-
- head = thead;
-fail:
- return head;
-}
-
int
gf_free_direntry (dir_entry_t *head)
@@ -5129,50 +4802,6 @@ fail:
}
/*
- * client_getdents_cbk - readdir callback for client protocol
- * @frame: call frame
- * @args: argument dictionary
- *
- * not for external reference
- */
-
-int
-client_getdents_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen,
- struct iobuf *iobuf)
-{
- gf_fop_getdents_rsp_t *rsp = NULL;
- int32_t op_ret = 0;
- int32_t op_errno = 0;
- int32_t gf_errno = 0;
- int32_t nr_count = 0;
- dir_entry_t *entry = NULL;
-
- rsp = gf_param (hdr);
-
- op_ret = ntoh32 (hdr->rsp.op_ret);
- gf_errno = ntoh32 (hdr->rsp.op_errno);
- op_errno = gf_error_to_errno (gf_errno);
-
- if (op_ret >= 0) {
- nr_count = ntoh32 (rsp->count);
- entry = gf_bin_to_direntry(iobuf->ptr, nr_count);
- if (entry == NULL) {
- op_ret = -1;
- op_errno = EINVAL;
- }
- }
-
- STACK_UNWIND (frame, op_ret, op_errno, entry, nr_count);
-
- if (iobuf)
- iobuf_unref (iobuf);
- if (entry)
- gf_free_direntry(entry);
-
- return 0;
-}
-
-/*
* client_statfs_cbk - statfs callback for client protocol
* @frame: call frame
* @args: argument dictionary
@@ -5462,69 +5091,7 @@ client_fentrylk_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen,
return 0;
}
-/**
- * client_writedir_cbk -
- *
- * @frame:
- * @args:
- *
- * not for external reference
- */
-
-int
-client_setdents_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen,
- struct iobuf *iobuf)
-{
- int32_t op_ret = 0;
- int32_t op_errno = 0;
-
- op_ret = ntoh32 (hdr->rsp.op_ret);
- op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno));
-
- STACK_UNWIND (frame, op_ret, op_errno);
-
- return 0;
-}
-
-/*
- * client_stats_cbk - stats callback for client protocol
- *
- * @frame: call frame
- * @args: argument dictionary
- *
- * not for external reference
- */
-int
-client_stats_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen,
- struct iobuf *iobuf)
-{
- struct xlator_stats stats = {0,};
- gf_mop_stats_rsp_t *rsp = NULL;
- char *buffer = NULL;
- int32_t op_ret = 0;
- int32_t op_errno = 0;
-
- rsp = gf_param (hdr);
-
- op_ret = ntoh32 (hdr->rsp.op_ret);
- op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno));
-
- if (op_ret >= 0)
- {
- buffer = rsp->buf;
-
- sscanf (buffer, "%"SCNx64",%"SCNx64",%"SCNx64",%"SCNx64
- ",%"SCNx64",%"SCNx64",%"SCNx64",%"SCNx64"\n",
- &stats.nr_files, &stats.disk_usage, &stats.free_disk,
- &stats.total_disk_size, &stats.read_usage,
- &stats.write_usage, &stats.disk_speed,
- &stats.nr_clients);
- }
-
- STACK_UNWIND (frame, op_ret, op_errno, &stats);
- return 0;
-}
/*
* client_getspec - getspec function for client protocol
@@ -6446,7 +6013,6 @@ static gf_op_t gf_fops[] = {
[GF_FOP_GETXATTR] = client_getxattr_cbk,
[GF_FOP_REMOVEXATTR] = client_removexattr_cbk,
[GF_FOP_OPENDIR] = client_opendir_cbk,
- [GF_FOP_GETDENTS] = client_getdents_cbk,
[GF_FOP_FSYNCDIR] = client_fsyncdir_cbk,
[GF_FOP_ACCESS] = client_access_cbk,
[GF_FOP_CREATE] = client_create_cbk,
@@ -6454,7 +6020,6 @@ static gf_op_t gf_fops[] = {
[GF_FOP_FSTAT] = client_fstat_cbk,
[GF_FOP_LK] = client_lk_common_cbk,
[GF_FOP_LOOKUP] = client_lookup_cbk,
- [GF_FOP_SETDENTS] = client_setdents_cbk,
[GF_FOP_READDIR] = client_readdir_cbk,
[GF_FOP_READDIRP] = client_readdirp_cbk,
[GF_FOP_INODELK] = client_inodelk_cbk,
@@ -6472,7 +6037,6 @@ static gf_op_t gf_fops[] = {
static gf_op_t gf_mops[] = {
[GF_MOP_SETVOLUME] = client_setvolume_cbk,
[GF_MOP_GETVOLUME] = client_enosys_cbk,
- [GF_MOP_STATS] = client_stats_cbk,
[GF_MOP_SETSPEC] = client_setspec_cbk,
[GF_MOP_GETSPEC] = client_getspec_cbk,
[GF_MOP_PING] = client_ping_cbk,
@@ -7102,8 +6666,6 @@ struct xlator_fops fops = {
.entrylk = client_entrylk,
.fentrylk = client_fentrylk,
.lookup = client_lookup,
- .setdents = client_setdents,
- .getdents = client_getdents,
.checksum = client_checksum,
.rchecksum = client_rchecksum,
.xattrop = client_xattrop,
@@ -7113,7 +6675,6 @@ struct xlator_fops fops = {
};
struct xlator_mops mops = {
- .stats = client_stats,
.getspec = client_getspec,
.log = client_log,
};
diff --git a/xlators/protocol/server/src/server-protocol.c b/xlators/protocol/server/src/server-protocol.c
index 57e32039310..17daec9c622 100644
--- a/xlators/protocol/server/src/server-protocol.c
+++ b/xlators/protocol/server/src/server-protocol.c
@@ -348,39 +348,6 @@ protocol_server_reply (call_frame_t *frame, int type, int op,
/*
- * server_setdents_cbk - writedir callback for server protocol
- * @frame: call frame
- * @cookie:
- * @this:
- * @op_ret: return value
- * @op_errno: errno
- *
- * not for external reference
- */
-int
-server_setdents_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno)
-{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_setdents_rsp_t *rsp = NULL;
- size_t hdrlen = 0;
- int32_t gf_errno = 0;
-
- hdrlen = gf_hdr_len (rsp, 0);
- hdr = gf_hdr_new (rsp, 0);
- rsp = gf_param (hdr);
-
- hdr->rsp.op_ret = hton32 (op_ret);
- gf_errno = gf_errno_to_error (op_errno);
- hdr->rsp.op_errno = hton32 (gf_errno);
-
- protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_SETDENTS,
- hdr, hdrlen, NULL, 0, NULL);
-
- return 0;
-}
-
-/*
* server_lk_cbk - lk callback for server protocol
* @frame: call frame
* @cookie:
@@ -872,103 +839,6 @@ server_fsyncdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
-/*
- * server_getdents_cbk - readdir callback for server protocol
- * @frame: call frame
- * @cookie:
- * @this:
- * @op_ret: return value
- * @op_errno: errno
- * @entries:
- * @count:
- *
- * not for external reference
- */
-int
-server_getdents_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, dir_entry_t *entries,
- int32_t count)
-{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_getdents_rsp_t *rsp = NULL;
- size_t hdrlen = 0;
- int32_t vec_count = 0;
- int32_t gf_errno = 0;
- struct iobref *iobref = NULL;
- struct iobuf *iobuf = NULL;
- size_t buflen = 0;
- struct iovec vector[1];
- server_state_t *state = NULL;
-
- state = CALL_STATE(frame);
-
- if (op_ret >= 0) {
- iobuf = iobuf_get (this->ctx->iobuf_pool);
- if (!iobuf) {
- op_ret = -1;
- op_errno = ENOMEM;
- goto out;
- }
-
- buflen = gf_direntry_to_bin (entries, iobuf->ptr);
- if (buflen < 0) {
- gf_log (this->name, GF_LOG_ERROR,
- "fd - %"PRId64" (%"PRId64"): failed to convert "
- "entries list to string buffer",
- state->resolve.fd_no, state->fd->inode->ino);
- op_ret = -1;
- op_errno = EINVAL;
- goto out;
- }
-
- iobref = iobref_new ();
- if (iobref == NULL) {
- gf_log (this->name, GF_LOG_ERROR,
- "fd - %"PRId64" (%"PRId64"): failed to get iobref",
- state->resolve.fd_no, state->fd->inode->ino);
- op_ret = -1;
- op_errno = ENOMEM;
- goto out;
- }
-
- iobref_add (iobref, iobuf);
-
- vector[0].iov_base = iobuf->ptr;
- vector[0].iov_len = buflen;
- vec_count = 1;
- } else {
- gf_log (this->name, GF_LOG_TRACE,
- "%"PRId64": GETDENTS %"PRId64" (%"PRId64"): %"PRId32" (%s)",
- frame->root->unique,
- state->resolve.fd_no,
- state->fd ? state->fd->inode->ino : 0,
- op_ret, strerror (op_errno));
- vector[0].iov_base = NULL;
- vector[0].iov_len = 0;
- }
-
-out:
- hdrlen = gf_hdr_len (rsp, 0);
- hdr = gf_hdr_new (rsp, 0);
- rsp = gf_param (hdr);
-
- rsp->count = hton32 (count);
-
- hdr->rsp.op_ret = hton32 (op_ret);
- gf_errno = gf_errno_to_error (op_errno);
- hdr->rsp.op_errno = hton32 (gf_errno);
-
- protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_GETDENTS,
- hdr, hdrlen, vector, vec_count, iobref);
-
- if (iobref)
- iobref_unref (iobref);
- if (iobuf)
- iobuf_unref (iobuf);
-
- return 0;
-}
-
/*
* server_readdir_cbk - getdents callback for server protocol
@@ -3963,53 +3833,6 @@ server_releasedir (call_frame_t *frame, xlator_t *bound_xl,
return 0;
}
-int
-server_getdents_resume (call_frame_t *frame, xlator_t *bound_xl)
-{
- server_state_t *state = NULL;
-
- state = CALL_STATE (frame);
-
- if (state->resolve.op_ret != 0)
- goto err;
-
- STACK_WIND (frame, server_getdents_cbk,
- bound_xl,
- bound_xl->fops->getdents,
- state->fd, state->size, state->offset, state->flags);
-
- return 0;
-err:
- server_getdents_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, 0);
- return 0;
-}
-
-int
-server_getdents (call_frame_t *frame, xlator_t *bound_xl,
- gf_hdr_common_t *hdr, size_t hdrlen,
- struct iobuf *iobuf)
-{
- gf_fop_getdents_req_t *req = NULL;
- server_state_t *state = NULL;
- server_connection_t *conn = NULL;
-
- conn = SERVER_CONNECTION (frame);
-
- req = gf_param (hdr);
- state = CALL_STATE(frame);
-
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = ntoh64 (req->fd);
- state->size = ntoh32 (req->size);
- state->offset = ntoh64 (req->offset);
- state->flags = ntoh32 (req->flags);
-
- resolve_and_resume (frame, server_getdents_resume);
-
- return 0;
-}
-
/*
* server_readdirp_cbk - getdents callback for server protocol
* @frame: call frame
@@ -4963,189 +4786,6 @@ server_lk (call_frame_t *frame, xlator_t *bound_xl,
return 0;
}
-
-int
-server_setdents_resume(call_frame_t *frame, xlator_t *bound_xl)
-{
- server_state_t *state = NULL;
-
- state = CALL_STATE (frame);
-
- if (state->resolve.op_ret != 0)
- goto err;
-
- STACK_WIND (frame, server_setdents_cbk,
- BOUND_XL(frame),
- BOUND_XL(frame)->fops->setdents,
- state->fd, state->flags, state->entry, state->nr_count);
-
- return 0;
-err:
- server_setdents_cbk (frame, NULL, frame->this, state->resolve.op_ret, state->resolve.op_errno);
- return 0;
-}
-/*
- * server_writedir -
- *
- * @frame:
- * @bound_xl:
- * @params:
- *
- */
-int
-server_setdents (call_frame_t *frame, xlator_t *bound_xl,
- gf_hdr_common_t *hdr, size_t hdrlen,
- struct iobuf *iobuf)
-{
- server_connection_t *conn = NULL;
- gf_fop_setdents_req_t *req = NULL;
- server_state_t *state = NULL;
- dir_entry_t *entry = NULL;
- dir_entry_t *trav = NULL;
- dir_entry_t *prev = NULL;
- int32_t count = 0;
- int32_t i = 0;
- int32_t bread = 0;
- char *ender = NULL;
- char *buffer_ptr = NULL;
- char tmp_buf[512] = {0,};
-
- conn = SERVER_CONNECTION(frame);
-
- req = gf_param (hdr);
- state = CALL_STATE(frame);
-
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = ntoh64 (req->fd);
- state->nr_count = ntoh32 (req->count);
-
-
- if (iobuf == NULL) {
- gf_log (frame->this->name, GF_LOG_ERROR,
- "fd - %"PRId64" (%"PRId64"): received a null buffer, "
- "returning EINVAL",
- state->resolve.fd_no, state->fd->inode->ino);
-
- server_setdents_cbk (frame, NULL, frame->this, -1, ENOMEM);
-
- goto out;
- }
-
- entry = CALLOC (1, sizeof (dir_entry_t));
- ERR_ABORT (entry);
- prev = entry;
- buffer_ptr = iobuf->ptr;
-
- for (i = 0; i < state->nr_count ; i++) {
- bread = 0;
- trav = CALLOC (1, sizeof (dir_entry_t));
- ERR_ABORT (trav);
-
- ender = strchr (buffer_ptr, '/');
- if (!ender)
- break;
- count = ender - buffer_ptr;
- trav->name = CALLOC (1, count + 2);
- ERR_ABORT (trav->name);
-
- strncpy (trav->name, buffer_ptr, count);
- bread = count + 1;
- buffer_ptr += bread;
-
- ender = strchr (buffer_ptr, '\n');
- if (!ender)
- break;
- count = ender - buffer_ptr;
- strncpy (tmp_buf, buffer_ptr, count);
- bread = count + 1;
- buffer_ptr += bread;
-
- /* TODO: use str_to_stat instead */
- {
- uint64_t dev;
- uint64_t ino;
- uint32_t mode;
- uint32_t nlink;
- uint32_t uid;
- uint32_t gid;
- uint64_t rdev;
- uint64_t size;
- uint32_t blksize;
- uint64_t blocks;
- uint32_t atime;
- uint32_t atime_nsec;
- uint32_t mtime;
- uint32_t mtime_nsec;
- uint32_t ctime;
- uint32_t ctime_nsec;
-
- sscanf (tmp_buf, GF_STAT_PRINT_FMT_STR,
- &dev, &ino, &mode, &nlink, &uid, &gid, &rdev,
- &size, &blksize, &blocks, &atime, &atime_nsec,
- &mtime, &mtime_nsec, &ctime, &ctime_nsec);
-
- trav->buf.ia_gen = dev;
- trav->buf.ia_ino = ino;
- trav->buf.ia_prot = ia_prot_from_st_mode (mode);
- trav->buf.ia_type = ia_type_from_st_mode (mode);
- trav->buf.ia_nlink = nlink;
- trav->buf.ia_uid = uid;
- trav->buf.ia_gid = gid;
- trav->buf.ia_rdev = rdev;
- trav->buf.ia_size = size;
- trav->buf.ia_blksize = blksize;
- trav->buf.ia_blocks = blocks;
-
- trav->buf.ia_atime = atime;
- trav->buf.ia_mtime = mtime;
- trav->buf.ia_ctime = ctime;
-
- trav->buf.ia_atime_nsec = atime_nsec;
- trav->buf.ia_mtime_nsec = mtime_nsec;
- trav->buf.ia_ctime_nsec = ctime_nsec;
- }
-
- ender = strchr (buffer_ptr, '\n');
- if (!ender)
- break;
- count = ender - buffer_ptr;
- *ender = '\0';
- if (IA_ISLNK (trav->buf.ia_type)) {
- trav->link = strdup (buffer_ptr);
- } else
- trav->link = "";
- bread = count + 1;
- buffer_ptr += bread;
-
- prev->next = trav;
- prev = trav;
- }
-
- state->entry = entry;
- resolve_and_resume (frame, server_setdents_resume);
-
-
- /* Free the variables allocated in this fop here */
- trav = entry->next;
- prev = entry;
- while (trav) {
- prev->next = trav->next;
- FREE (trav->name);
- if (IA_ISLNK (trav->buf.ia_type))
- FREE (trav->link);
- FREE (trav);
- trav = prev->next;
- }
- FREE (entry);
-
-out:
- if (iobuf)
- iobuf_unref (iobuf);
- return 0;
-}
-
-
-
/* xxx_MOPS */
int
_volfile_update_checksum (xlator_t *this, char *key, uint32_t checksum)
@@ -5944,89 +5584,6 @@ fail:
return 0;
}
-/*
- * server_mop_stats_cbk - stats callback for server management operation
- * @frame: call frame
- * @cookie:
- * @this:
- * @op_ret: return value
- * @op_errno: errno
- * @stats:err
- *
- * not for external reference
- */
-
-int
-server_mop_stats_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t ret, int32_t op_errno,
- struct xlator_stats *stats)
-{
- /* TODO: get this information from somewhere else, not extern */
- gf_hdr_common_t *hdr = NULL;
- gf_mop_stats_rsp_t *rsp = NULL;
- char buffer[256] = {0,};
- int64_t glusterfsd_stats_nr_clients = 0;
- size_t hdrlen = 0;
- size_t buf_len = 0;
- int32_t gf_errno = 0;
-
- if (ret >= 0) {
- sprintf (buffer,
- "%"PRIx64",%"PRIx64",%"PRIx64
- ",%"PRIx64",%"PRIx64",%"PRIx64
- ",%"PRIx64",%"PRIx64"\n",
- stats->nr_files, stats->disk_usage, stats->free_disk,
- stats->total_disk_size, stats->read_usage,
- stats->write_usage, stats->disk_speed,
- glusterfsd_stats_nr_clients);
-
- buf_len = strlen (buffer);
- }
-
- hdrlen = gf_hdr_len (rsp, buf_len + 1);
- hdr = gf_hdr_new (rsp, buf_len + 1);
- rsp = gf_param (hdr);
-
- hdr->rsp.op_ret = hton32 (ret);
- gf_errno = gf_errno_to_error (op_errno);
- hdr->rsp.op_errno = hton32 (gf_errno);
-
- strcpy (rsp->buf, buffer);
-
- protocol_server_reply (frame, GF_OP_TYPE_MOP_REPLY, GF_MOP_STATS,
- hdr, hdrlen, NULL, 0, NULL);
-
- return 0;
-}
-
-
-/*
- * mop_unlock - unlock management function for server protocol
- * @frame: call frame
- * @bound_xl:
- * @params: parameter dictionary
- *
- */
-int
-mop_stats (call_frame_t *frame, xlator_t *bound_xl,
- gf_hdr_common_t *hdr, size_t hdrlen,
- struct iobuf *iobuf)
-{
- int32_t flag = 0;
- gf_mop_stats_req_t *req = NULL;
-
- req = gf_param (hdr);
-
- flag = ntoh32 (req->flags);
-
- STACK_WIND (frame, server_mop_stats_cbk,
- bound_xl,
- bound_xl->mops->stats,
- flag);
-
- return 0;
-}
-
int
mop_ping (call_frame_t *frame, xlator_t *bound_xl,
@@ -6244,7 +5801,6 @@ static gf_op_t gf_fops[] = {
[GF_FOP_FSETXATTR] = server_fsetxattr,
[GF_FOP_REMOVEXATTR] = server_removexattr,
[GF_FOP_OPENDIR] = server_opendir,
- [GF_FOP_GETDENTS] = server_getdents,
[GF_FOP_FSYNCDIR] = server_fsyncdir,
[GF_FOP_ACCESS] = server_access,
[GF_FOP_CREATE] = server_create,
@@ -6252,7 +5808,6 @@ static gf_op_t gf_fops[] = {
[GF_FOP_FSTAT] = server_fstat,
[GF_FOP_LK] = server_lk,
[GF_FOP_LOOKUP] = server_lookup,
- [GF_FOP_SETDENTS] = server_setdents,
[GF_FOP_READDIR] = server_readdir,
[GF_FOP_READDIRP] = server_readdirp,
[GF_FOP_INODELK] = server_inodelk,
@@ -6272,7 +5827,6 @@ static gf_op_t gf_fops[] = {
static gf_op_t gf_mops[] = {
[GF_MOP_SETVOLUME] = mop_setvolume,
[GF_MOP_GETVOLUME] = mop_getvolume,
- [GF_MOP_STATS] = mop_stats,
[GF_MOP_GETSPEC] = mop_getspec,
[GF_MOP_PING] = mop_ping,
[GF_MOP_LOG] = mop_log,
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index 64704c5d440..22e03304ff2 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -955,16 +955,6 @@ posix_opendir (call_frame_t *frame, xlator_t *this,
return 0;
}
-
-int
-posix_getdents (call_frame_t *frame, xlator_t *this,
- fd_t *fd, size_t size, off_t off, int32_t flag)
-{
- STACK_UNWIND_STRICT (getdents, frame, -1, ENOSYS, NULL, 0);
- return 0;
-}
-
-
int32_t
posix_releasedir (xlator_t *this,
fd_t *fd)
@@ -2132,7 +2122,7 @@ posix_create (call_frame_t *frame, xlator_t *this,
LOCK (&priv->lock);
{
- priv->stats.nr_files++;
+ priv->nr_files++;
}
UNLOCK (&priv->lock);
@@ -2248,7 +2238,7 @@ posix_open (call_frame_t *frame, xlator_t *this,
LOCK (&priv->lock);
{
- priv->stats.nr_files++;
+ priv->nr_files++;
}
UNLOCK (&priv->lock);
@@ -2346,7 +2336,6 @@ posix_readv (call_frame_t *frame, xlator_t *this,
LOCK (&priv->lock);
{
priv->read_value += op_ret;
- priv->interval_read += op_ret;
}
UNLOCK (&priv->lock);
@@ -2514,7 +2503,6 @@ posix_writev (call_frame_t *frame, xlator_t *this,
LOCK (&priv->lock);
{
priv->write_value += op_ret;
- priv->interval_write += op_ret;
}
UNLOCK (&priv->lock);
@@ -2680,7 +2668,7 @@ posix_release (xlator_t *this,
LOCK (&priv->lock);
{
- priv->stats.nr_files--;
+ priv->nr_files--;
}
UNLOCK (&priv->lock);
@@ -3793,17 +3781,6 @@ posix_ftruncate (call_frame_t *frame, xlator_t *this,
}
-int
-posix_setdents (call_frame_t *frame, xlator_t *this,
- fd_t *fd, int32_t flags, dir_entry_t *entries,
- int32_t count)
-{
-
- STACK_UNWIND_STRICT (setdents, frame, -1, ENOSYS);
- return 0;
-}
-
-
int32_t
posix_fstat (call_frame_t *frame, xlator_t *this,
fd_t *fd)
@@ -4110,107 +4087,6 @@ posix_readdirp (call_frame_t *frame, xlator_t *this,
int32_t
-posix_stats (call_frame_t *frame, xlator_t *this,
- int32_t flags)
-
-{
- int32_t op_ret = -1;
- int32_t op_errno = 0;
-
- struct xlator_stats xlstats = {0, };
- struct xlator_stats * stats = NULL;
- struct statvfs buf = {0,};
- struct timeval tv = {0,};
- struct posix_private * priv = (struct posix_private *)this->private;
-
- int64_t avg_read = 0;
- int64_t avg_write = 0;
- int64_t _time_ms = 0;
-
- DECLARE_OLD_FS_ID_VAR;
-
- SET_FS_ID (frame->root->uid, frame->root->gid);
-
- VALIDATE_OR_GOTO (frame, out);
- VALIDATE_OR_GOTO (this, out);
-
- stats = &xlstats;
-
- op_ret = statvfs (priv->base_path, &buf);
-
- if (op_ret == -1) {
- op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR, "statvfs failed: %s",
- strerror (op_errno));
- goto out;
- }
-
- /* client info is maintained at FSd */
- stats->nr_clients = priv->stats.nr_clients;
- stats->nr_files = priv->stats.nr_files;
-
- /* number of free block in the filesystem. */
- stats->free_disk = buf.f_bfree * buf.f_bsize;
-
- stats->total_disk_size = buf.f_blocks * buf.f_bsize;
- stats->disk_usage = (buf.f_blocks - buf.f_bavail) * buf.f_bsize;
-
- /* Calculate read and write usage */
- op_ret = gettimeofday (&tv, NULL);
- if (op_ret == -1) {
- op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "gettimeofday failed: %s", strerror (errno));
- goto out;
- }
-
- LOCK (&priv->lock);
- {
- /* Read */
- _time_ms = (tv.tv_sec - priv->init_time.tv_sec) * 1000 +
- ((tv.tv_usec - priv->init_time.tv_usec) / 1000);
-
- avg_read = (_time_ms) ? (priv->read_value / _time_ms) : 0; /* KBps */
- avg_write = (_time_ms) ? (priv->write_value / _time_ms) : 0; /* KBps */
-
- _time_ms = (tv.tv_sec - priv->prev_fetch_time.tv_sec) * 1000 +
- ((tv.tv_usec - priv->prev_fetch_time.tv_usec) / 1000);
-
- if (_time_ms && ((priv->interval_read / _time_ms) > priv->max_read)) {
- priv->max_read = (priv->interval_read / _time_ms);
- }
-
- if (_time_ms &&
- ((priv->interval_write / _time_ms) > priv->max_write)) {
- priv->max_write = priv->interval_write / _time_ms;
- }
-
- stats->read_usage = avg_read / priv->max_read;
- stats->write_usage = avg_write / priv->max_write;
- }
- UNLOCK (&priv->lock);
-
- op_ret = gettimeofday (&(priv->prev_fetch_time), NULL);
- if (op_ret == -1) {
- op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR, "gettimeofday failed: %s",
- strerror (op_errno));
- goto out;
- }
-
- priv->interval_read = 0;
- priv->interval_write = 0;
-
- op_ret = 0;
-
- out:
- SET_TO_OLD_FS_ID ();
-
- STACK_UNWIND (frame, op_ret, op_errno, stats);
- return 0;
-}
-
-int32_t
posix_checksum (call_frame_t *frame, xlator_t *this,
loc_t *loc, int32_t flag)
{
@@ -4306,11 +4182,11 @@ posix_priv (xlator_t *this)
gf_proc_dump_build_key(key, key_prefix, "base_path_length");
gf_proc_dump_write(key,"%d", priv->base_path_length);
gf_proc_dump_build_key(key, key_prefix, "max_read");
- gf_proc_dump_write(key,"%d", priv->max_read);
+ gf_proc_dump_write(key,"%d", priv->read_value);
gf_proc_dump_build_key(key, key_prefix, "max_write");
- gf_proc_dump_write(key,"%d", priv->max_write);
- gf_proc_dump_build_key(key, key_prefix, "stats.nr_files");
- gf_proc_dump_write(key,"%ld", priv->stats.nr_files);
+ gf_proc_dump_write(key,"%d", priv->write_value);
+ gf_proc_dump_build_key(key, key_prefix, "nr_files");
+ gf_proc_dump_write(key,"%ld", priv->nr_files);
return 0;
}
@@ -4533,14 +4409,6 @@ init (xlator_t *this)
"could not find hostname (%s)", strerror (errno));
}
- {
- /* Stats related variables */
- gettimeofday (&_private->init_time, NULL);
- gettimeofday (&_private->prev_fetch_time, NULL);
- _private->max_read = 1;
- _private->max_write = 1;
- }
-
_private->export_statfs = 1;
tmp_data = dict_get (this->options, "export-statfs-size");
if (tmp_data) {
@@ -4684,7 +4552,6 @@ struct xlator_dumpops dumpops = {
};
struct xlator_mops mops = {
- .stats = posix_stats,
};
struct xlator_fops fops = {
@@ -4723,8 +4590,6 @@ struct xlator_fops fops = {
.finodelk = posix_finodelk,
.entrylk = posix_entrylk,
.fentrylk = posix_fentrylk,
- .setdents = posix_setdents,
- .getdents = posix_getdents,
.checksum = posix_checksum,
.rchecksum = posix_rchecksum,
.xattrop = posix_xattrop,
diff --git a/xlators/storage/posix/src/posix.h b/xlators/storage/posix/src/posix.h
index f92e256fbc0..6146c37055f 100644
--- a/xlators/storage/posix/src/posix.h
+++ b/xlators/storage/posix/src/posix.h
@@ -73,8 +73,7 @@ struct posix_private {
char hostname[256];
/* Statistics, provides activity of the server */
- struct xlator_stats stats;
-
+
struct timeval prev_fetch_time;
struct timeval init_time;
@@ -84,13 +83,9 @@ struct posix_private {
pthread_cond_t janitor_cond;
pthread_mutex_t janitor_lock;
- int32_t max_read; /* */
- int32_t max_write; /* */
- int64_t interval_read; /* Used to calculate the max_read value */
- int64_t interval_write; /* Used to calculate the max_write value */
int64_t read_value; /* Total read, from init */
int64_t write_value; /* Total write, from init */
-
+ int64_t nr_files;
/*
In some cases, two exported volumes may reside on the same
partition on the server. Sending statvfs info for both