9ae3f9
From 7c51addf7912a94320e6b148bd66f2dbf274c533 Mon Sep 17 00:00:00 2001
9ae3f9
From: Pranith Kumar K <pkarampu@redhat.com>
9ae3f9
Date: Mon, 11 Mar 2019 14:04:39 +0530
9ae3f9
Subject: [PATCH 464/465] storage/posix: Remove nr_files usage
9ae3f9
9ae3f9
nr_files is supposed to represent the number of files opened in posix.
9ae3f9
Present logic doesn't seem to handle anon-fds because of which the
9ae3f9
counts would always be wrong.
9ae3f9
9ae3f9
I don't remember anyone using this value in debugging any problem probably
9ae3f9
because we always have 'ls -l /proc/<pid>/fd' which not only prints the
9ae3f9
fds that are active but also prints their paths. It also handles directories
9ae3f9
and anon-fds which actually opened the file. So removing this code
9ae3f9
instead of fixing the buggy logic to have the nr_files.
9ae3f9
9ae3f9
> fixes bz#1688106
9ae3f9
> Change-Id: Ibf8713fdfdc1ef094e08e6818152637206a54040
9ae3f9
> Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
9ae3f9
> (Cherry pick from commit f5987d38f216a3142dfe45f03bf66ff4827d9b55)
9ae3f9
> (Reviewed on upstream link https://review.gluster.org/#/c/glusterfs/+/22333/)
9ae3f9
9ae3f9
Change-Id: Ibf8713fdfdc1ef094e08e6818152637206a54040
9ae3f9
BUG: 1851989
9ae3f9
Signed-off-by: Mohit Agrawal<moagrawa@redhat.com>
9ae3f9
Reviewed-on: https://code.engineering.redhat.com/gerrit/209468
9ae3f9
Tested-by: RHGS Build Bot <nigelb@redhat.com>
9ae3f9
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
9ae3f9
---
9ae3f9
 xlators/storage/posix/src/posix-common.c       | 2 --
9ae3f9
 xlators/storage/posix/src/posix-entry-ops.c    | 2 --
9ae3f9
 xlators/storage/posix/src/posix-inode-fd-ops.c | 2 --
9ae3f9
 xlators/storage/posix/src/posix.h              | 1 -
9ae3f9
 4 files changed, 7 deletions(-)
9ae3f9
9ae3f9
diff --git a/xlators/storage/posix/src/posix-common.c b/xlators/storage/posix/src/posix-common.c
9ae3f9
index ac53796..b317627 100644
9ae3f9
--- a/xlators/storage/posix/src/posix-common.c
9ae3f9
+++ b/xlators/storage/posix/src/posix-common.c
9ae3f9
@@ -128,7 +128,6 @@ posix_priv(xlator_t *this)
9ae3f9
     gf_proc_dump_write("max_read", "%" PRId64, GF_ATOMIC_GET(priv->read_value));
9ae3f9
     gf_proc_dump_write("max_write", "%" PRId64,
9ae3f9
                        GF_ATOMIC_GET(priv->write_value));
9ae3f9
-    gf_proc_dump_write("nr_files", "%" PRId64, GF_ATOMIC_GET(priv->nr_files));
9ae3f9
 
9ae3f9
     return 0;
9ae3f9
 }
9ae3f9
@@ -815,7 +814,6 @@ posix_init(xlator_t *this)
9ae3f9
     }
9ae3f9
 
9ae3f9
     LOCK_INIT(&_private->lock);
9ae3f9
-    GF_ATOMIC_INIT(_private->nr_files, 0);
9ae3f9
     GF_ATOMIC_INIT(_private->read_value, 0);
9ae3f9
     GF_ATOMIC_INIT(_private->write_value, 0);
9ae3f9
 
9ae3f9
diff --git a/xlators/storage/posix/src/posix-entry-ops.c b/xlators/storage/posix/src/posix-entry-ops.c
9ae3f9
index 65650b3..b3a5381 100644
9ae3f9
--- a/xlators/storage/posix/src/posix-entry-ops.c
9ae3f9
+++ b/xlators/storage/posix/src/posix-entry-ops.c
9ae3f9
@@ -2243,8 +2243,6 @@ fill_stat:
9ae3f9
         gf_msg(this->name, GF_LOG_WARNING, 0, P_MSG_FD_PATH_SETTING_FAILED,
9ae3f9
                "failed to set the fd context path=%s fd=%p", real_path, fd);
9ae3f9
 
9ae3f9
-    GF_ATOMIC_INC(priv->nr_files);
9ae3f9
-
9ae3f9
     op_ret = 0;
9ae3f9
 
9ae3f9
 out:
9ae3f9
diff --git a/xlators/storage/posix/src/posix-inode-fd-ops.c b/xlators/storage/posix/src/posix-inode-fd-ops.c
9ae3f9
index d135d8b..81f4a6b 100644
9ae3f9
--- a/xlators/storage/posix/src/posix-inode-fd-ops.c
9ae3f9
+++ b/xlators/storage/posix/src/posix-inode-fd-ops.c
9ae3f9
@@ -1605,7 +1605,6 @@ posix_open(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
9ae3f9
         gf_msg(this->name, GF_LOG_WARNING, 0, P_MSG_FD_PATH_SETTING_FAILED,
9ae3f9
                "failed to set the fd context path=%s fd=%p", real_path, fd);
9ae3f9
 
9ae3f9
-    GF_ATOMIC_INC(priv->nr_files);
9ae3f9
     op_ret = 0;
9ae3f9
 
9ae3f9
 out:
9ae3f9
@@ -2526,7 +2525,6 @@ posix_release(xlator_t *this, fd_t *fd)
9ae3f9
     if (!priv)
9ae3f9
         goto out;
9ae3f9
 
9ae3f9
-    GF_ATOMIC_DEC(priv->nr_files);
9ae3f9
 out:
9ae3f9
     return 0;
9ae3f9
 }
9ae3f9
diff --git a/xlators/storage/posix/src/posix.h b/xlators/storage/posix/src/posix.h
9ae3f9
index 61495a7..124dbb4 100644
9ae3f9
--- a/xlators/storage/posix/src/posix.h
9ae3f9
+++ b/xlators/storage/posix/src/posix.h
9ae3f9
@@ -154,7 +154,6 @@ struct posix_private {
9ae3f9
 
9ae3f9
     gf_atomic_t read_value;  /* Total read, from init */
9ae3f9
     gf_atomic_t write_value; /* Total write, from init */
9ae3f9
-    gf_atomic_t nr_files;
9ae3f9
     /*
9ae3f9
        In some cases, two exported volumes may reside on the same
9ae3f9
        partition on the server. Sending statvfs info for both
9ae3f9
-- 
9ae3f9
1.8.3.1
9ae3f9