summaryrefslogtreecommitdiffstats
path: root/xlators/debug/io-stats/src
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/debug/io-stats/src')
-rw-r--r--xlators/debug/io-stats/src/io-stats.c678
1 files changed, 507 insertions, 171 deletions
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
index c21417a0192..69f182c5194 100644
--- a/xlators/debug/io-stats/src/io-stats.c
+++ b/xlators/debug/io-stats/src/io-stats.c
@@ -91,9 +91,13 @@ typedef struct _ios_sample_t {
uid_t uid;
gid_t gid;
char identifier[UNIX_PATH_MAX];
+ char path[UNIX_PATH_MAX];
glusterfs_fop_t fop_type;
struct timeval timestamp;
double elapsed;
+ gf_boolean_t have_path;
+ int32_t op_ret;
+ int32_t op_errno;
} ios_sample_t;
@@ -178,10 +182,33 @@ typedef int (*block_dump_func) (xlator_t *, struct ios_dump_args*,
int , int , uint64_t ) ;
struct ios_local {
- struct timeval wind_at;
- struct timeval unwind_at;
+ inode_t *inode;
+ loc_t loc;
+ fd_t *fd;
};
+static struct ios_local *
+ios_local_new() {
+ return GF_CALLOC (1, sizeof (struct ios_local),
+ gf_common_mt_char);
+}
+
+static void
+ios_local_free (struct ios_local *local)
+{
+ if (!local)
+ return;
+
+ inode_unref (local->inode);
+
+ if (local->fd)
+ fd_unref (local->fd);
+
+ loc_wipe (&local->loc);
+ memset (local, 0, sizeof (*local));
+ GF_FREE (local);
+}
+
struct volume_options options[];
static int
@@ -192,6 +219,57 @@ is_fop_latency_started (call_frame_t *frame)
return memcmp (&frame->begin, &epoch, sizeof (epoch));
}
+static void
+ios_free_local (call_frame_t *frame)
+{
+ struct ios_local *local = frame->local;
+
+ ios_local_free (local);
+
+ frame->local = NULL;
+}
+
+static void
+ios_track_loc (call_frame_t *frame, loc_t *loc)
+{
+ struct ios_local *local = NULL;
+
+ if (loc && loc->path) {
+ /* Check if frame->local is already set (it should
+ * only be set by either ios_track_loc() or
+ * ios_track_fd()). In other words, this check
+ * allows us to chain calls to ios_track_loc()
+ * and ios_track_fd() without clobbering frame->local
+ * in the process.
+ */
+ if (frame->local) {
+ local = frame->local;
+ } else {
+ local = ios_local_new ();
+ }
+ loc_copy (&local->loc, loc);
+ frame->local = local;
+ }
+}
+
+static void
+ios_track_fd (call_frame_t *frame, fd_t *fd)
+{
+ struct ios_local *local = NULL;
+
+ if (fd && fd->inode) {
+ if (frame->local) {
+ local = frame->local;
+ } else {
+ local = ios_local_new ();
+ }
+ local->fd = fd_ref (fd);
+ local->inode = inode_ref (fd->inode);
+ frame->local = local;
+ }
+}
+
+
#define _IOS_SAMP_DIR DEFAULT_LOG_FILE_DIRECTORY "/samples"
#ifdef GF_LINUX_HOST_OS
#define _IOS_DUMP_DIR DATADIR "/lib/glusterd/stats"
@@ -206,7 +284,7 @@ is_fop_latency_started (call_frame_t *frame)
conf = this->private; \
if (conf && conf->measure_latency) { \
gettimeofday (&frame->end, NULL); \
- update_ios_latency (conf, frame, GF_FOP_##op); \
+ update_ios_latency (conf, frame, GF_FOP_##op, 0, 0); \
} \
} while (0)
@@ -244,7 +322,7 @@ is_fop_latency_started (call_frame_t *frame)
#define STATS_ADD(x,i) (x) += (i)
#endif
-#define UPDATE_PROFILE_STATS(frame, op) \
+#define UPDATE_PROFILE_STATS(frame, op, op_ret, op_errno) \
do { \
struct ios_conf *conf = NULL; \
\
@@ -257,7 +335,8 @@ is_fop_latency_started (call_frame_t *frame)
conf->count_fop_hits) { \
BUMP_FOP(op); \
gettimeofday (&frame->end, NULL); \
- update_ios_latency (conf, frame, GF_FOP_##op);\
+ update_ios_latency (conf, frame, GF_FOP_##op, \
+ op_ret, op_errno); \
} \
} \
STATS_UNLOCK (&conf->lock); \
@@ -694,7 +773,7 @@ ios_dump_throughput_stats (struct ios_stat_head *list_head, xlator_t *this,
int
_io_stats_get_key_prefix (xlator_t *this, char **key_prefix) {
- char *key_root = "gluster";
+ char *key_root = "storage.gluster";
char *xlator_name = NULL;
char *instance_name = NULL;
size_t key_len = 0;
@@ -719,7 +798,7 @@ _io_stats_get_key_prefix (xlator_t *this, char **key_prefix) {
}
if (strcmp (__progname, "glusterfsd") == 0)
- key_root = "gluster.brick";
+ key_root = "storage.gluster.brick";
if (instance_name) {
/* +3 for 2 x "." + NULL */
@@ -1010,7 +1089,10 @@ _io_stats_write_latency_sample (xlator_t *this, ios_sample_t *sample,
char *port_pos = NULL;
char *group_name = NULL;
char *username = NULL;
+ char *path = NULL;
struct ios_conf *conf = NULL;
+ const char *error_string = NULL;
+ int32_t op_errno = 0;
conf = this->private;
@@ -1057,12 +1139,22 @@ _io_stats_write_latency_sample (xlator_t *this, ios_sample_t *sample,
sprintf (group_name, "%d", (int32_t)sample->gid);
}
+ path = "Unknown";
+ if (sample->have_path)
+ path = sample->path;
+
+ error_string = "No Error";
+ if (sample->op_ret != 0) {
+ op_errno = abs (sample->op_errno);
+ error_string = strerror (op_errno);
+ }
+
ios_log (this, logfp,
- "%0.6lf,%s,%s,%0.4lf,%s,%s,%s,%s,%s,%s",
+ "%0.6lf,%s,%s,%0.4lf,%s,%s,%s,%s,%s,%s,%s,%d,%s",
epoch_time, fop_enum_to_pri_string (sample->fop_type),
fop_enum_to_string (sample->fop_type),
sample->elapsed, xlator_name, instance_name, username,
- group_name, hostname, port);
+ group_name, hostname, port, path, op_errno, error_string);
goto out;
err:
gf_log (this->name, GF_LOG_ERROR,
@@ -1608,14 +1700,87 @@ io_stats_dump_fd (xlator_t *this, struct ios_fd *iosfd)
return 0;
}
+void ios_local_get_inode (struct ios_local *local, inode_t **inode)
+{
+ if (!local)
+ return;
+
+ /* In the cases that a loc is given to us,
+ * we should use that as the source of truth
+ * for the inode.
+ */
+ if (local->loc.inode) {
+ *inode = local->loc.inode;
+ return;
+ }
+
+ /* Fall back to the inode in the local struct,
+ * but there is no guarantee this will be a valid
+ * pointer.
+ */
+ *inode = local->inode;
+}
+
+void ios_local_get_path (call_frame_t *frame, const char **path)
+{
+ struct ios_stat *iosstat = NULL;
+ struct ios_local *local = NULL;
+ inode_t *inode = NULL;
+
+ local = frame->local;
+ if (!local)
+ goto out;
+
+ ios_local_get_inode (local, &inode);
+
+ if (inode) {
+ /* Each inode shold have an iosstat struct attached to it.
+ * This is the preferred way to retrieve the path.
+ */
+ ios_inode_ctx_get (inode, frame->this, &iosstat);
+ if (iosstat) {
+ gf_log ("io-stats", GF_LOG_DEBUG,
+ "[%s] Getting path from iostat struct",
+ fop_enum_to_string (frame->op));
+ *path = iosstat->filename;
+ goto out;
+ }
+ }
+
+ /* If we don't have the iosstat attached to the inode,
+ * fall back to retrieving the path via the loc struct
+ * inside the local.
+ */
+ if (local->loc.path) {
+ gf_log ("io-stats", GF_LOG_DEBUG,
+ "[%s] Getting path from loc_t",
+ fop_enum_to_string (frame->op));
+ *path = local->loc.path;
+ goto out;
+ }
+
+out:
+ /* If the inode and the loc don't have the path, we're out of luck.
+ */
+ if (!*path) {
+ gf_log ("io-stats", GF_LOG_DEBUG,
+ "Unable to get path for fop: %s",
+ fop_enum_to_string (frame->op));
+ }
+
+ return;
+}
+
void collect_ios_latency_sample (struct ios_conf *conf,
glusterfs_fop_t fop_type, double elapsed,
- call_frame_t *frame)
+ call_frame_t *frame, int32_t op_ret, int32_t op_errno)
{
+ struct ios_local *ios_local = NULL;
ios_sample_buf_t *ios_sample_buf = NULL;
ios_sample_t *ios_sample = NULL;
struct timeval *timestamp = NULL;
call_stack_t *root = NULL;
+ const char *path = NULL;
ios_sample_buf = conf->ios_sample_buf;
@@ -1630,6 +1795,8 @@ void collect_ios_latency_sample (struct ios_conf *conf,
ios_sample = &(ios_sample_buf->ios_samples[ios_sample_buf->pos]);
ios_sample->elapsed = elapsed;
ios_sample->fop_type = fop_type;
+ ios_sample->op_ret = op_ret;
+ ios_sample->op_errno = op_errno;
ios_sample->uid = root->uid;
ios_sample->gid = root->gid;
(ios_sample->timestamp).tv_sec = timestamp->tv_sec;
@@ -1637,6 +1804,52 @@ void collect_ios_latency_sample (struct ios_conf *conf,
memcpy (&ios_sample->identifier, &root->identifier,
sizeof (root->identifier));
+ /* Eventually every FOP will be supported
+ * (i.e., the frame->local will be
+ * of type struct ios_local), but for now, this is a safety.
+ */
+ switch (ios_sample->fop_type) {
+
+ case GF_FOP_CREATE:
+ case GF_FOP_OPEN:
+ case GF_FOP_STAT:
+ case GF_FOP_FSTAT:
+ case GF_FOP_READ:
+ case GF_FOP_WRITE:
+ case GF_FOP_OPENDIR:
+ case GF_FOP_READDIRP:
+ case GF_FOP_READDIR:
+ case GF_FOP_FLUSH:
+ case GF_FOP_ACCESS:
+ case GF_FOP_UNLINK:
+ case GF_FOP_TRUNCATE:
+ case GF_FOP_MKDIR:
+ case GF_FOP_RMDIR:
+ case GF_FOP_SETATTR:
+ case GF_FOP_LOOKUP:
+ case GF_FOP_INODELK:
+ case GF_FOP_FINODELK:
+ case GF_FOP_ENTRYLK:
+ case GF_FOP_FXATTROP:
+ case GF_FOP_XATTROP:
+ case GF_FOP_GETXATTR:
+ case GF_FOP_FGETXATTR:
+ case GF_FOP_SETXATTR:
+ case GF_FOP_FSETXATTR:
+ case GF_FOP_STATFS:
+ case GF_FOP_FSYNC:
+ ios_local_get_path (frame, &path);
+ break;
+ default:
+ path = NULL;
+ break;
+ }
+
+ if (path) {
+ strncpy (ios_sample->path, path, sizeof (ios_sample->path));
+ ios_sample->have_path = _gf_true;
+ }
+
/* We've reached the end of the circular buffer, start from the
* beginning. */
if (ios_sample_buf->pos == (ios_sample_buf->size - 1))
@@ -1674,7 +1887,7 @@ update_ios_latency_stats (struct ios_global_stats *stats, double elapsed,
int
update_ios_latency (struct ios_conf *conf, call_frame_t *frame,
- glusterfs_fop_t op)
+ glusterfs_fop_t op, int32_t op_ret, int32_t op_errno)
{
double elapsed;
struct timeval *begin, *end;
@@ -1687,7 +1900,7 @@ update_ios_latency (struct ios_conf *conf, call_frame_t *frame,
update_ios_latency_stats (&conf->cumulative, elapsed, op);
update_ios_latency_stats (&conf->incremental, elapsed, op);
- collect_ios_latency_sample (conf, op, elapsed, frame);
+ collect_ios_latency_sample (conf, op, elapsed, frame, op_ret, op_errno);
return 0;
}
@@ -1811,40 +2024,100 @@ unlock_list_head:
return ret;
}
+static int
+attach_iosstat_to_inode (xlator_t *this, inode_t *inode, const char *path,
+ const uuid_t gfid) {
+ struct ios_stat *iosstat = NULL;
+
+ if (!inode) {
+ return -EINVAL;
+ }
+
+ ios_inode_ctx_get (inode, this, &iosstat);
+ if (!iosstat) {
+ iosstat = GF_CALLOC (1, sizeof (*iosstat),
+ gf_io_stats_mt_ios_stat);
+ if (!iosstat) {
+ return -ENOMEM;
+ }
+ iosstat->filename = gf_strdup (path);
+ gf_uuid_copy (iosstat->gfid, gfid);
+ LOCK_INIT (&iosstat->lock);
+ ios_inode_ctx_set (inode, this, iosstat);
+ }
+
+ return 0;
+}
+
+
+int
+ios_build_fd (xlator_t *this, const char *path, fd_t *fd, struct ios_fd **iosfd)
+{
+ struct ios_fd *ifd = NULL;
+ int ret = 0;
+
+ ifd = GF_CALLOC (1, sizeof (*ifd), gf_io_stats_mt_ios_fd);
+ if (!ifd) {
+ ret = -ENOMEM;
+ goto free_and_out;
+ }
+
+ if (path) {
+ ifd->filename = gf_strdup (path);
+ if (!ifd->filename) {
+ ret = -ENOMEM;
+ goto free_and_out;
+ }
+ }
+
+ gettimeofday (&ifd->opened_at, NULL);
+
+ if (fd)
+ ios_fd_ctx_set (fd, this, ifd);
+
+ *iosfd = ifd;
+
+ return ret;
+
+ /* Failure path */
+free_and_out:
+ if (ifd) {
+ GF_FREE (ifd->filename);
+ GF_FREE (ifd);
+ }
+
+ *iosfd = NULL;
+
+ return ret;
+}
+
+
int
io_stats_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, fd_t *fd,
inode_t *inode, struct iatt *buf,
struct iatt *preparent, struct iatt *postparent, dict_t *xdata)
{
- struct ios_fd *iosfd = NULL;
- char *path = NULL;
- struct ios_stat *iosstat = NULL;
- struct ios_conf *conf = NULL;
-
- conf = this->private;
+ struct ios_local *local = NULL;
+ struct ios_conf *conf = NULL;
+ struct ios_fd *iosfd = NULL;
- path = frame->local;
- frame->local = NULL;
-
- if (!path)
+ if (op_ret < 0) {
goto unwind;
+ }
- if (op_ret < 0) {
- GF_FREE (path);
+ local = frame->local;
+ if (!local) {
goto unwind;
}
- iosfd = GF_CALLOC (1, sizeof (*iosfd), gf_io_stats_mt_ios_fd);
+ conf = this->private;
+
+ ios_build_fd (this, local->loc.path, fd, &iosfd);
if (!iosfd) {
- GF_FREE (path);
goto unwind;
}
- iosfd->filename = path;
- gettimeofday (&iosfd->opened_at, NULL);
-
- ios_fd_ctx_set (fd, this, iosfd);
LOCK (&conf->lock);
{
conf->cumulative.nr_opens++;
@@ -1855,18 +2128,12 @@ io_stats_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
UNLOCK (&conf->lock);
- iosstat = GF_CALLOC (1, sizeof (*iosstat), gf_io_stats_mt_ios_stat);
- if (!iosstat) {
- GF_FREE (path);
- goto unwind;
- }
- iosstat->filename = gf_strdup (path);
- gf_uuid_copy (iosstat->gfid, buf->ia_gfid);
- LOCK_INIT (&iosstat->lock);
- ios_inode_ctx_set (fd->inode, this, iosstat);
+ attach_iosstat_to_inode (this, local->loc.inode, local->loc.path,
+ buf->ia_gfid);
unwind:
- UPDATE_PROFILE_STATS (frame, CREATE);
+ UPDATE_PROFILE_STATS (frame, CREATE, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (create, frame, op_ret, op_errno, fd, inode, buf,
preparent, postparent, xdata);
return 0;
@@ -1877,44 +2144,24 @@ int
io_stats_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata)
{
- struct ios_fd *iosfd = NULL;
- char *path = NULL;
- struct ios_stat *iosstat = NULL;
- struct ios_conf *conf = NULL;
-
- conf = this->private;
- path = frame->local;
- frame->local = NULL;
-
- if (!path)
- goto unwind;
+ struct ios_stat *iosstat = NULL;
+ struct ios_local *local = NULL;
+ struct ios_conf *conf = NULL;
+ struct ios_fd *iosfd = NULL;
if (op_ret < 0) {
- GF_FREE (path);
goto unwind;
}
- iosfd = GF_CALLOC (1, sizeof (*iosfd), gf_io_stats_mt_ios_fd);
- if (!iosfd) {
- GF_FREE (path);
+ local = frame->local;
+ if (!local) {
goto unwind;
}
- iosfd->filename = path;
- gettimeofday (&iosfd->opened_at, NULL);
-
- ios_fd_ctx_set (fd, this, iosfd);
-
- ios_inode_ctx_get (fd->inode, this, &iosstat);
- if (!iosstat) {
- iosstat = GF_CALLOC (1, sizeof (*iosstat),
- gf_io_stats_mt_ios_stat);
- if (iosstat) {
- iosstat->filename = gf_strdup (path);
- gf_uuid_copy (iosstat->gfid, fd->inode->gfid);
- LOCK_INIT (&iosstat->lock);
- ios_inode_ctx_set (fd->inode, this, iosstat);
- }
+ conf = this->private;
+ ios_build_fd (this, local->loc.path, fd, &iosfd);
+ if (!iosfd) {
+ goto unwind;
}
LOCK (&conf->lock);
@@ -1926,13 +2173,19 @@ io_stats_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
}
UNLOCK (&conf->lock);
+
+ ios_inode_ctx_get (fd->inode, this, &iosstat);
if (iosstat) {
BUMP_STATS (iosstat, IOS_STATS_TYPE_OPEN);
- iosstat = NULL;
}
-unwind:
- UPDATE_PROFILE_STATS (frame, OPEN);
+ attach_iosstat_to_inode (this, local->loc.inode,
+ local->loc.path,
+ local->loc.inode->gfid);
+
+unwind:
+ UPDATE_PROFILE_STATS (frame, OPEN, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (open, frame, op_ret, op_errno, fd, xdata);
return 0;
@@ -1943,7 +2196,8 @@ int
io_stats_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *buf, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, STAT);
+ UPDATE_PROFILE_STATS (frame, STAT, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (stat, frame, op_ret, op_errno, buf, xdata);
return 0;
}
@@ -1956,26 +2210,29 @@ io_stats_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct iatt *buf, struct iobref *iobref, dict_t *xdata)
{
int len = 0;
- fd_t *fd = NULL;
struct ios_stat *iosstat = NULL;
+ struct ios_local *local = NULL;
- fd = frame->local;
- frame->local = NULL;
+ local = frame->local;
+ if (!local || !local->fd)
+ goto unwind;
if (op_ret > 0) {
len = iov_length (vector, count);
- BUMP_READ (fd, len);
+ BUMP_READ (local->fd, len);
}
- UPDATE_PROFILE_STATS (frame, READ);
- ios_inode_ctx_get (fd->inode, this, &iosstat);
+ UPDATE_PROFILE_STATS (frame, READ, op_ret, op_errno);
+ ios_inode_ctx_get (local->fd->inode, this, &iosstat);
if (iosstat) {
- BUMP_STATS (iosstat, IOS_STATS_TYPE_READ);
- BUMP_THROUGHPUT (iosstat, IOS_STATS_THRU_READ);
- iosstat = NULL;
+ BUMP_STATS (iosstat, IOS_STATS_TYPE_READ);
+ BUMP_THROUGHPUT (iosstat, IOS_STATS_THRU_READ);
+
}
+unwind:
+ ios_free_local (frame);
STACK_UNWIND_STRICT (readv, frame, op_ret, op_errno,
vector, count, buf, iobref, xdata);
return 0;
@@ -1989,21 +2246,23 @@ io_stats_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata)
{
struct ios_stat *iosstat = NULL;
+ struct ios_local *local = NULL;
inode_t *inode = NULL;
- UPDATE_PROFILE_STATS (frame, WRITE);
- if (frame->local){
- inode = frame->local;
- frame->local = NULL;
- ios_inode_ctx_get (inode, this, &iosstat);
- if (iosstat) {
- BUMP_STATS (iosstat, IOS_STATS_TYPE_WRITE);
- BUMP_THROUGHPUT (iosstat, IOS_STATS_THRU_WRITE);
- inode = NULL;
- iosstat = NULL;
- }
- }
+ local = frame->local;
+ if (!local || !local->fd)
+ goto unwind;
+
+ UPDATE_PROFILE_STATS (frame, WRITE, op_ret, op_errno);
+
+ ios_inode_ctx_get (local->inode, this, &iosstat);
+ if (iosstat) {
+ BUMP_STATS (iosstat, IOS_STATS_TYPE_WRITE);
+ BUMP_THROUGHPUT (iosstat, IOS_STATS_THRU_WRITE);
+ }
+unwind:
+ ios_free_local (frame);
STACK_UNWIND_STRICT (writev, frame, op_ret, op_errno, prebuf, postbuf, xdata);
return 0;
@@ -2021,7 +2280,7 @@ io_stats_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
frame->local = NULL;
- UPDATE_PROFILE_STATS (frame, READDIRP);
+ UPDATE_PROFILE_STATS (frame, READDIRP, op_ret, op_errno);
ios_inode_ctx_get (inode, this, &iosstat);
@@ -2039,7 +2298,16 @@ int
io_stats_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, gf_dirent_t *buf, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, READDIR);
+ struct ios_local *local = NULL;
+ struct ios_stat *iosstat = NULL;
+
+ local = frame->local;
+
+ UPDATE_PROFILE_STATS (frame, READDIR, op_ret, op_errno);
+
+ ios_free_local (frame);
+
+ UPDATE_PROFILE_STATS (frame, READDIR, op_ret, op_errno);
STACK_UNWIND_STRICT (readdir, frame, op_ret, op_errno, buf, xdata);
return 0;
}
@@ -2050,8 +2318,10 @@ io_stats_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, FSYNC);
- STACK_UNWIND_STRICT (fsync, frame, op_ret, op_errno, prebuf, postbuf, xdata);
+ UPDATE_PROFILE_STATS (frame, FSYNC, op_ret, op_errno);
+ ios_free_local (frame);
+ STACK_UNWIND_STRICT (fsync, frame, op_ret, op_errno, prebuf, postbuf,
+ xdata);
return 0;
}
@@ -2061,7 +2331,8 @@ io_stats_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
struct iatt *preop, struct iatt *postop, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, SETATTR);
+ UPDATE_PROFILE_STATS (frame, SETATTR, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (setattr, frame, op_ret, op_errno, preop, postop, xdata);
return 0;
}
@@ -2072,7 +2343,8 @@ io_stats_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
struct iatt *preparent, struct iatt *postparent, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, UNLINK);
+ UPDATE_PROFILE_STATS (frame, UNLINK, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (unlink, frame, op_ret, op_errno,
preparent, postparent, xdata);
return 0;
@@ -2086,7 +2358,7 @@ io_stats_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct iatt *preoldparent, struct iatt *postoldparent,
struct iatt *prenewparent, struct iatt *postnewparent, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, RENAME);
+ UPDATE_PROFILE_STATS (frame, RENAME, op_ret, op_errno);
STACK_UNWIND_STRICT (rename, frame, op_ret, op_errno, buf,
preoldparent, postoldparent,
prenewparent, postnewparent, xdata);
@@ -2099,7 +2371,8 @@ io_stats_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, const char *buf,
struct iatt *sbuf, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, READLINK);
+ UPDATE_PROFILE_STATS (frame, READLINK, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (readlink, frame, op_ret, op_errno, buf, sbuf, xdata);
return 0;
}
@@ -2111,7 +2384,14 @@ io_stats_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
inode_t *inode, struct iatt *buf,
dict_t *xdata, struct iatt *postparent)
{
- UPDATE_PROFILE_STATS (frame, LOOKUP);
+ struct ios_local *local = frame->local;
+
+ if (local && local->loc.path && inode && op_ret >= 0) {
+ attach_iosstat_to_inode (this, inode, local->loc.path,
+ inode->gfid);
+ }
+ UPDATE_PROFILE_STATS (frame, LOOKUP, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (lookup, frame, op_ret, op_errno, inode, buf, xdata,
postparent);
return 0;
@@ -2124,7 +2404,7 @@ io_stats_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
inode_t *inode, struct iatt *buf,
struct iatt *preparent, struct iatt *postparent, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, SYMLINK);
+ UPDATE_PROFILE_STATS (frame, SYMLINK, op_ret, op_errno);
STACK_UNWIND_STRICT (symlink, frame, op_ret, op_errno, inode, buf,
preparent, postparent, xdata);
return 0;
@@ -2137,7 +2417,7 @@ io_stats_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
inode_t *inode, struct iatt *buf,
struct iatt *preparent, struct iatt *postparent, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, MKNOD);
+ UPDATE_PROFILE_STATS (frame, MKNOD, op_ret, op_errno);
STACK_UNWIND_STRICT (mknod, frame, op_ret, op_errno, inode, buf,
preparent, postparent, xdata);
return 0;
@@ -2151,28 +2431,16 @@ io_stats_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct iatt *preparent, struct iatt *postparent,
dict_t *xdata)
{
- struct ios_stat *iosstat = NULL;
- char *path = frame->local;
+ struct ios_local *local = frame->local;
- if (!path)
- goto unwind;
-
- UPDATE_PROFILE_STATS (frame, MKDIR);
- if (op_ret < 0)
- goto unwind;
-
- iosstat = GF_CALLOC (1, sizeof (*iosstat), gf_io_stats_mt_ios_stat);
- if (iosstat) {
- LOCK_INIT (&iosstat->lock);
- iosstat->filename = gf_strdup(path);
- gf_uuid_copy (iosstat->gfid, buf->ia_gfid);
- ios_inode_ctx_set (inode, this, iosstat);
+ if (local && local->loc.path) {
+ local->inode = inode_ref (inode);
+ attach_iosstat_to_inode (this, inode, local->loc.path,
+ buf->ia_gfid);
}
-unwind:
- /* local is assigned with path */
- GF_FREE (frame->local);
- frame->local = NULL;
+ UPDATE_PROFILE_STATS (frame, MKDIR, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (mkdir, frame, op_ret, op_errno, inode, buf,
preparent, postparent, xdata);
return 0;
@@ -2185,7 +2453,7 @@ io_stats_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
inode_t *inode, struct iatt *buf,
struct iatt *preparent, struct iatt *postparent, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, LINK);
+ UPDATE_PROFILE_STATS (frame, LINK, op_ret, op_errno);
STACK_UNWIND_STRICT (link, frame, op_ret, op_errno, inode, buf,
preparent, postparent, xdata);
return 0;
@@ -2196,7 +2464,8 @@ int
io_stats_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, FLUSH);
+ UPDATE_PROFILE_STATS (frame, FLUSH, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (flush, frame, op_ret, op_errno, xdata);
return 0;
}
@@ -2206,20 +2475,28 @@ int
io_stats_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata)
{
- struct ios_stat *iosstat = NULL;
- int ret = -1;
+ struct ios_local *local = NULL;
+ struct ios_stat *iosstat = NULL;
+ int ret = -1;
+
+ local = frame->local;
+ if (!local || !local->fd)
+ goto unwind;
- UPDATE_PROFILE_STATS (frame, OPENDIR);
if (op_ret < 0)
goto unwind;
- ios_fd_ctx_set (fd, this, 0);
+ attach_iosstat_to_inode (this, local->inode, local->loc.path,
+ local->inode->gfid);
- ret = ios_inode_ctx_get (fd->inode, this, &iosstat);
- if (!ret)
+ ios_fd_ctx_set (local->fd, this, 0);
+ ios_inode_ctx_get (local->fd->inode, this, &iosstat);
+ if (iosstat)
BUMP_STATS (iosstat, IOS_STATS_TYPE_OPENDIR);
unwind:
+ UPDATE_PROFILE_STATS (frame, OPENDIR, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (opendir, frame, op_ret, op_errno, fd, xdata);
return 0;
}
@@ -2231,8 +2508,8 @@ io_stats_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct iatt *preparent, struct iatt *postparent, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, RMDIR);
-
+ UPDATE_PROFILE_STATS (frame, RMDIR, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (rmdir, frame, op_ret, op_errno,
preparent, postparent, xdata);
return 0;
@@ -2244,7 +2521,8 @@ io_stats_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, TRUNCATE);
+ UPDATE_PROFILE_STATS (frame, TRUNCATE, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (truncate, frame, op_ret, op_errno,
prebuf, postbuf, xdata);
return 0;
@@ -2255,7 +2533,8 @@ int
io_stats_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct statvfs *buf, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, STATFS);
+ UPDATE_PROFILE_STATS (frame, STATFS, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (statfs, frame, op_ret, op_errno, buf, xdata);
return 0;
}
@@ -2265,7 +2544,8 @@ int
io_stats_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, SETXATTR);
+ UPDATE_PROFILE_STATS (frame, SETXATTR, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (setxattr, frame, op_ret, op_errno, xdata);
return 0;
}
@@ -2275,7 +2555,8 @@ int
io_stats_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, GETXATTR);
+ UPDATE_PROFILE_STATS (frame, GETXATTR, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (getxattr, frame, op_ret, op_errno, dict, xdata);
return 0;
}
@@ -2285,7 +2566,8 @@ int
io_stats_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, REMOVEXATTR);
+ UPDATE_PROFILE_STATS (frame, REMOVEXATTR, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (removexattr, frame, op_ret, op_errno, xdata);
return 0;
}
@@ -2294,7 +2576,8 @@ int
io_stats_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, FSETXATTR);
+ UPDATE_PROFILE_STATS (frame, FSETXATTR, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (fsetxattr, frame, op_ret, op_errno, xdata);
return 0;
}
@@ -2304,7 +2587,8 @@ int
io_stats_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, FGETXATTR);
+ UPDATE_PROFILE_STATS (frame, FGETXATTR, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (fgetxattr, frame, op_ret, op_errno, dict, xdata);
return 0;
}
@@ -2314,7 +2598,8 @@ int
io_stats_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, FREMOVEXATTR);
+ UPDATE_PROFILE_STATS (frame, FREMOVEXATTR, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (fremovexattr, frame, op_ret, op_errno, xdata);
return 0;
}
@@ -2324,7 +2609,8 @@ int
io_stats_fsyncdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, FSYNCDIR);
+ UPDATE_PROFILE_STATS (frame, FSYNCDIR, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (fsyncdir, frame, op_ret, op_errno, xdata);
return 0;
}
@@ -2334,7 +2620,20 @@ int
io_stats_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, ACCESS);
+ struct ios_local *local = frame->local;
+
+ /* ACCESS is called before a READ when a fop fails over
+ * in NFS. We need to make sure that we are attaching the
+ * data correctly to this inode.
+ */
+ if (local->loc.inode && local->loc.path) {
+ attach_iosstat_to_inode (this, local->loc.inode,
+ local->loc.path,
+ local->loc.inode->gfid);
+ }
+
+ UPDATE_PROFILE_STATS (frame, ACCESS, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (access, frame, op_ret, op_errno, xdata);
return 0;
}
@@ -2345,7 +2644,8 @@ io_stats_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, FTRUNCATE);
+ UPDATE_PROFILE_STATS (frame, FTRUNCATE, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (ftruncate, frame, op_ret, op_errno,
prebuf, postbuf, xdata);
return 0;
@@ -2356,7 +2656,8 @@ int
io_stats_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *buf, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, FSTAT);
+ UPDATE_PROFILE_STATS (frame, FSTAT, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (fstat, frame, op_ret, op_errno, buf, xdata);
return 0;
}
@@ -2367,8 +2668,9 @@ io_stats_fallocate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
struct iatt *postbuf, dict_t *xdata)
{
- UPDATE_PROFILE_STATS(frame, FALLOCATE);
- STACK_UNWIND_STRICT(fallocate, frame, op_ret, op_errno, prebuf, postbuf,
+ UPDATE_PROFILE_STATS (frame, FALLOCATE, op_ret, op_errno);
+ ios_free_local (frame);
+ STACK_UNWIND_STRICT(fallocate, frame, op_ret, op_errno, prebuf, postbuf,
xdata);
return 0;
}
@@ -2379,8 +2681,9 @@ io_stats_discard_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
struct iatt *postbuf, dict_t *xdata)
{
- UPDATE_PROFILE_STATS(frame, DISCARD);
- STACK_UNWIND_STRICT(discard, frame, op_ret, op_errno, prebuf, postbuf,
+ UPDATE_PROFILE_STATS (frame, DISCARD, op_ret, op_errno);
+ ios_free_local (frame);
+ STACK_UNWIND_STRICT(discard, frame, op_ret, op_errno, prebuf, postbuf,
xdata);
return 0;
}
@@ -2390,7 +2693,8 @@ io_stats_zerofill_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
struct iatt *postbuf, dict_t *xdata)
{
- UPDATE_PROFILE_STATS(frame, ZEROFILL);
+ UPDATE_PROFILE_STATS (frame, ZEROFILL, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT(zerofill, frame, op_ret, op_errno, prebuf, postbuf,
xdata);
return 0;
@@ -2400,7 +2704,8 @@ int
io_stats_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct gf_flock *lock, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, LK);
+ UPDATE_PROFILE_STATS (frame, LK, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (lk, frame, op_ret, op_errno, lock, xdata);
return 0;
}
@@ -2410,7 +2715,8 @@ int
io_stats_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, ENTRYLK);
+ UPDATE_PROFILE_STATS (frame, ENTRYLK, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (entrylk, frame, op_ret, op_errno, xdata);
return 0;
}
@@ -2420,7 +2726,8 @@ int
io_stats_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, XATTROP);
+ UPDATE_PROFILE_STATS (frame, XATTROP, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (xattrop, frame, op_ret, op_errno, dict, xdata);
return 0;
}
@@ -2430,7 +2737,8 @@ int
io_stats_fxattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, FXATTROP);
+ UPDATE_PROFILE_STATS (frame, FXATTROP, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (fxattrop, frame, op_ret, op_errno, dict, xdata);
return 0;
}
@@ -2440,7 +2748,8 @@ int
io_stats_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- UPDATE_PROFILE_STATS (frame, INODELK);
+ UPDATE_PROFILE_STATS (frame, INODELK, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (inodelk, frame, op_ret, op_errno, xdata);
return 0;
}
@@ -2450,6 +2759,8 @@ io_stats_entrylk (call_frame_t *frame, xlator_t *this,
const char *volume, loc_t *loc, const char *basename,
entrylk_cmd cmd, entrylk_type type, dict_t *xdata)
{
+ ios_track_loc (frame, loc);
+
START_FOP_LATENCY (frame);
STACK_WIND (frame, io_stats_entrylk_cbk,
@@ -2464,6 +2775,7 @@ int
io_stats_inodelk (call_frame_t *frame, xlator_t *this,
const char *volume, loc_t *loc, int32_t cmd, struct gf_flock *flock, dict_t *xdata)
{
+ ios_track_loc (frame, loc);
START_FOP_LATENCY (frame);
@@ -2479,8 +2791,8 @@ int
io_stats_finodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
-
- UPDATE_PROFILE_STATS (frame, FINODELK);
+ UPDATE_PROFILE_STATS (frame, FINODELK, op_ret, op_errno);
+ ios_free_local (frame);
STACK_UNWIND_STRICT (finodelk, frame, op_ret, op_errno, xdata);
return 0;
}
@@ -2490,6 +2802,7 @@ int
io_stats_finodelk (call_frame_t *frame, xlator_t *this, const char *volume,
fd_t *fd, int32_t cmd, struct gf_flock *flock, dict_t *xdata)
{
+ ios_track_fd (frame, fd);
START_FOP_LATENCY (frame);
STACK_WIND (frame, io_stats_finodelk_cbk,
@@ -2504,6 +2817,7 @@ int
io_stats_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc,
gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata)
{
+ ios_track_loc (frame, loc);
START_FOP_LATENCY (frame);
STACK_WIND (frame, io_stats_xattrop_cbk,
@@ -2518,6 +2832,7 @@ int
io_stats_fxattrop (call_frame_t *frame, xlator_t *this, fd_t *fd,
gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata)
{
+ ios_track_fd (frame, fd);
START_FOP_LATENCY (frame);
STACK_WIND (frame, io_stats_fxattrop_cbk,
@@ -2532,6 +2847,7 @@ int
io_stats_lookup (call_frame_t *frame, xlator_t *this,
loc_t *loc, dict_t *xdata)
{
+ ios_track_loc (frame, loc);
START_FOP_LATENCY (frame);
STACK_WIND (frame, io_stats_lookup_cbk,
@@ -2545,6 +2861,7 @@ io_stats_lookup (call_frame_t *frame, xlator_t *this,
int
io_stats_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
{
+ ios_track_loc (frame, loc);
START_FOP_LATENCY (frame);
STACK_WIND (frame, io_stats_stat_cbk,
@@ -2559,6 +2876,7 @@ int
io_stats_readlink (call_frame_t *frame, xlator_t *this,
loc_t *loc, size_t size, dict_t *xdata)
{
+ ios_track_loc (frame, loc);
START_FOP_LATENCY (frame);
STACK_WIND (frame, io_stats_readlink_cbk,
@@ -2573,6 +2891,7 @@ int
io_stats_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc,
mode_t mode, dev_t dev, mode_t umask, dict_t *xdata)
{
+ ios_track_loc (frame, loc);
START_FOP_LATENCY (frame);
STACK_WIND (frame, io_stats_mknod_cbk,
@@ -2587,9 +2906,7 @@ int
io_stats_mkdir (call_frame_t *frame, xlator_t *this,
loc_t *loc, mode_t mode, mode_t umask, dict_t *xdata)
{
- if (loc->path)
- frame->local = gf_strdup (loc->path);
-
+ ios_track_loc (frame, loc);
START_FOP_LATENCY (frame);
STACK_WIND (frame, io_stats_mkdir_cbk,
@@ -2604,6 +2921,7 @@ int
io_stats_unlink (call_frame_t *frame, xlator_t *this,
loc_t *loc, int xflag, dict_t *xdata)
{
+ ios_track_loc (frame, loc);
START_FOP_LATENCY (frame);
STACK_WIND (frame, io_stats_unlink_cbk,
@@ -2618,6 +2936,7 @@ int
io_stats_rmdir (call_frame_t *frame, xlator_t *this,
loc_t *loc, int flags, dict_t *xdata)
{
+ ios_track_loc (frame, loc);
START_FOP_LATENCY (frame);
STACK_WIND (frame, io_stats_rmdir_cbk,
@@ -2674,6 +2993,7 @@ int
io_stats_setattr (call_frame_t *frame, xlator_t *this,
loc_t *loc, struct iatt *stbuf, int32_t valid, dict_t *xdata)
{
+ ios_track_loc (frame, loc);
START_FOP_LATENCY (frame);
STACK_WIND (frame, io_stats_setattr_cbk,
@@ -2688,6 +3008,7 @@ int
io_stats_truncate (call_frame_t *frame, xlator_t *this,
loc_t *loc, off_t offset, dict_t *xdata)
{
+ ios_track_loc (frame, loc);
START_FOP_LATENCY (frame);
STACK_WIND (frame, io_stats_truncate_cbk,
@@ -2702,8 +3023,8 @@ int
io_stats_open (call_frame_t *frame, xlator_t *this, loc_t *loc,
int32_t flags, fd_t *fd, dict_t *xdata)
{
- if (loc->path)
- frame->local = gf_strdup (loc->path);
+ ios_track_loc (frame, loc);
+ ios_track_fd (frame, fd);
START_FOP_LATENCY (frame);
@@ -2719,9 +3040,10 @@ int
io_stats_create (call_frame_t *frame, xlator_t *this,
loc_t *loc, int32_t flags, mode_t mode,
mode_t umask, fd_t *fd, dict_t *xdata)
+
{
- if (loc->path)
- frame->local = gf_strdup (loc->path);
+ ios_track_loc (frame, loc);
+ ios_track_fd (frame, fd);
START_FOP_LATENCY (frame);
@@ -2737,8 +3059,7 @@ int
io_stats_readv (call_frame_t *frame, xlator_t *this,
fd_t *fd, size_t size, off_t offset, uint32_t flags, dict_t *xdata)
{
- frame->local = fd;
-
+ ios_track_fd (frame, fd);
START_FOP_LATENCY (frame);
STACK_WIND (frame, io_stats_readv_cbk,
@@ -2756,9 +3077,12 @@ io_stats_writev (call_frame_t *frame, xlator_t *this,
uint32_t flags, struct iobref *iobref, dict_t *xdata)
{
int len = 0;
+ struct ios_conf *conf = NULL;
+ struct ios_local *local = NULL;
+ int ret = 0;
+
+ ios_track_fd (frame, fd);
- if (fd->inode)
- frame->local = fd->inode;
len = iov_length (vector, count);
BUMP_WRITE (fd, len);
@@ -2777,6 +3101,7 @@ int
io_stats_statfs (call_frame_t *frame, xlator_t *this,
loc_t *loc, dict_t *xdata)
{
+ ios_track_loc (frame, loc);
START_FOP_LATENCY (frame);
STACK_WIND (frame, io_stats_statfs_cbk,
@@ -2791,6 +3116,7 @@ int
io_stats_flush (call_frame_t *frame, xlator_t *this,
fd_t *fd, dict_t *xdata)
{
+ ios_track_fd (frame, fd);
START_FOP_LATENCY (frame);
STACK_WIND (frame, io_stats_flush_cbk,
@@ -2805,6 +3131,7 @@ int
io_stats_fsync (call_frame_t *frame, xlator_t *this,
fd_t *fd, int32_t flags, dict_t *xdata)
{
+ ios_track_fd (frame, fd);
START_FOP_LATENCY (frame);
STACK_WIND (frame, io_stats_fsync_cbk,
@@ -2971,7 +3298,7 @@ _ios_dump_thread (xlator_t *this) {
stats_filename, strerror(errno));
log_stats_fopen_failure = _gf_false;
}
- samples_logfp = fopen (samples_filename, "w+");
+ samples_logfp = fopen (samples_filename, "a");
if (samples_logfp) {
io_stats_dump_latency_samples_logfp (this,
samples_logfp);
@@ -3024,6 +3351,8 @@ io_stats_setxattr (call_frame_t *frame, xlator_t *this,
goto out;
}
+ ios_track_loc (frame, loc);
+
START_FOP_LATENCY (frame);
STACK_WIND (frame, io_stats_setxattr_cbk,
@@ -3042,6 +3371,7 @@ int
io_stats_getxattr (call_frame_t *frame, xlator_t *this,
loc_t *loc, const char *name, dict_t *xdata)
{
+ ios_track_loc (frame, loc);
START_FOP_LATENCY (frame);
STACK_WIND (frame, io_stats_getxattr_cbk,
@@ -3056,6 +3386,7 @@ int
io_stats_removexattr (call_frame_t *frame, xlator_t *this,
loc_t *loc, const char *name, dict_t *xdata)
{
+ ios_track_loc (frame, loc);
START_FOP_LATENCY (frame);
STACK_WIND (frame, io_stats_removexattr_cbk,
@@ -3071,6 +3402,7 @@ io_stats_fsetxattr (call_frame_t *frame, xlator_t *this,
fd_t *fd, dict_t *dict,
int32_t flags, dict_t *xdata)
{
+ ios_track_fd (frame, fd);
START_FOP_LATENCY (frame);
STACK_WIND (frame, io_stats_fsetxattr_cbk,
@@ -3085,6 +3417,7 @@ int
io_stats_fgetxattr (call_frame_t *frame, xlator_t *this,
fd_t *fd, const char *name, dict_t *xdata)
{
+ ios_track_fd (frame, fd);
START_FOP_LATENCY (frame);
STACK_WIND (frame, io_stats_fgetxattr_cbk,
@@ -3099,6 +3432,7 @@ int
io_stats_fremovexattr (call_frame_t *frame, xlator_t *this,
fd_t *fd, const char *name, dict_t *xdata)
{
+ ios_track_fd (frame, fd);
START_FOP_LATENCY (frame);
STACK_WIND (frame, io_stats_fremovexattr_cbk,
@@ -3170,6 +3504,7 @@ int
io_stats_access (call_frame_t *frame, xlator_t *this,
loc_t *loc, int32_t mask, dict_t *xdata)
{
+ ios_track_loc (frame, loc);
START_FOP_LATENCY (frame);
STACK_WIND (frame, io_stats_access_cbk,
@@ -3212,6 +3547,7 @@ int
io_stats_fstat (call_frame_t *frame, xlator_t *this,
fd_t *fd, dict_t *xdata)
{
+ ios_track_fd (frame, fd);
START_FOP_LATENCY (frame);
STACK_WIND (frame, io_stats_fstat_cbk,