summaryrefslogtreecommitdiffstats
path: root/xlators/debug/io-stats
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2011-03-22 05:20:01 +0000
committerVijay Bellur <vijay@dev.gluster.com>2011-03-22 04:55:04 -0700
commit384f81cf412c0da9d13a547c0aeb2cd33e59774d (patch)
tree0e6ddc89c28643112f0e0705ae469ef9c4b69a07 /xlators/debug/io-stats
parent95f59725adbefd574cfd694dc101ee9c803f167a (diff)
Moved stats cleanup to forget from unlink and rmdir
Additionally, replace inode_ctx_get with inode_ctx_del in cleanup Signed-off-by: shishir gowda <shishirng@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 2575 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2575
Diffstat (limited to 'xlators/debug/io-stats')
-rw-r--r--xlators/debug/io-stats/src/io-stats.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
index 41a099396..13173b498 100644
--- a/xlators/debug/io-stats/src/io-stats.c
+++ b/xlators/debug/io-stats/src/io-stats.c
@@ -340,7 +340,7 @@ ios_stat_unref (struct ios_stat *iosstat)
LOCK (&iosstat->lock);
{
iosstat->refcnt--;
- if (iosstat->refcnt <= 0) {
+ if (iosstat->refcnt == 0) {
if (iosstat->filename) {
GF_FREE (iosstat->filename);
iosstat->filename = NULL;
@@ -484,8 +484,15 @@ ios_stats_cleanup (xlator_t *this, inode_t *inode)
{
struct ios_stat *iosstat = NULL;
+ uint64_t iosstat64 = 0;
- ios_inode_ctx_get (inode, this, &iosstat);
+ inode_ctx_del (inode, this, &iosstat64);
+ if (!iosstat64) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "could not get inode ctx");
+ return 0;
+ }
+ iosstat = (void *) (long)iosstat64;
if (iosstat) {
ios_stat_unref (iosstat);
}
@@ -1306,14 +1313,6 @@ 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)
{
- inode_t *inode = NULL;
-
- if (frame->local) {
- inode = frame->local;
- frame->local = NULL;
- ios_stats_cleanup (this, inode);
- inode = NULL;
- }
END_FOP_LATENCY (frame, UNLINK);
STACK_UNWIND_STRICT (unlink, frame, op_ret, op_errno,
preparent, postparent);
@@ -1465,18 +1464,9 @@ io_stats_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
struct iatt *preparent, struct iatt *postparent)
{
- inode_t *inode = NULL;
END_FOP_LATENCY (frame, RMDIR);
-
- if (frame->local) {
- inode = frame->local;
- frame->local = NULL;
- ios_stats_cleanup (this, inode);
- inode = NULL;
- }
-
STACK_UNWIND_STRICT (rmdir, frame, op_ret, op_errno,
preparent, postparent);
return 0;
@@ -1828,7 +1818,6 @@ io_stats_rmdir (call_frame_t *frame, xlator_t *this,
{
BUMP_FOP (RMDIR);
- frame->local = loc->inode;
START_FOP_LATENCY (frame);
STACK_WIND (frame, io_stats_rmdir_cbk,
@@ -2346,7 +2335,7 @@ int
io_stats_forget (xlator_t *this, inode_t *inode)
{
BUMP_FOP (FORGET);
-
+ ios_stats_cleanup (this, inode);
return 0;
}