b7d4d7
From 17a9ce965ef2fec9ee5c8e4b76981bb7cbcf1352 Mon Sep 17 00:00:00 2001
b7d4d7
From: mohit84 <moagrawa@redhat.com>
b7d4d7
Date: Mon, 9 Nov 2020 17:15:42 +0530
b7d4d7
Subject: [PATCH 506/511] posix: Attach a posix_spawn_disk_thread with
b7d4d7
 glusterfs_ctx (#1595)
b7d4d7
b7d4d7
Currently posix xlator spawns posix_disk_space_threads per brick and in
b7d4d7
case of brick_mux environment while glusterd attached bricks at maximum
b7d4d7
level(250) with a single brick process in that case 250 threads are
b7d4d7
spawned for all bricks and brick process memory size also increased.
b7d4d7
b7d4d7
Solution: Attach a posix_disk_space thread with glusterfs_ctx to
b7d4d7
          spawn a thread per process basis instead of spawning a per brick
b7d4d7
b7d4d7
> Fixes: #1482
b7d4d7
> Change-Id: I8dd88f252a950495b71742e2a7588bd5bb019ec7
b7d4d7
> Cherry-picked from commit 3f93be77e1acf5baacafa97a320e91e6879d1c0e
b7d4d7
> Reviewed on upstream link https://github.com/gluster/glusterfs/issues/1482
b7d4d7
> Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
b7d4d7
b7d4d7
Change-Id: I8dd88f252a950495b71742e2a7588bd5bb019ec7
b7d4d7
Bug: 1898776
b7d4d7
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
b7d4d7
Reviewed-on: https://code.engineering.redhat.com/gerrit/220366
b7d4d7
Tested-by: RHGS Build Bot <nigelb@redhat.com>
b7d4d7
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
b7d4d7
---
b7d4d7
 glusterfsd/src/glusterfsd.c                    |   4 +
b7d4d7
 libglusterfs/src/glusterfs/glusterfs.h         |   6 ++
b7d4d7
 xlators/storage/posix/src/posix-common.c       |  68 +++++++++++--
b7d4d7
 xlators/storage/posix/src/posix-handle.h       |   3 +-
b7d4d7
 xlators/storage/posix/src/posix-helpers.c      | 131 ++++++++++++++-----------
b7d4d7
 xlators/storage/posix/src/posix-inode-fd-ops.c |   3 +-
b7d4d7
 xlators/storage/posix/src/posix-mem-types.h    |   1 +
b7d4d7
 xlators/storage/posix/src/posix.h              |  12 ++-
b7d4d7
 8 files changed, 160 insertions(+), 68 deletions(-)
b7d4d7
b7d4d7
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
b7d4d7
index 955bf1d..ac25255 100644
b7d4d7
--- a/glusterfsd/src/glusterfsd.c
b7d4d7
+++ b/glusterfsd/src/glusterfsd.c
b7d4d7
@@ -1840,9 +1840,13 @@ glusterfs_ctx_defaults_init(glusterfs_ctx_t *ctx)
b7d4d7
     INIT_LIST_HEAD(&cmd_args->xlator_options);
b7d4d7
     INIT_LIST_HEAD(&cmd_args->volfile_servers);
b7d4d7
     ctx->pxl_count = 0;
b7d4d7
+    ctx->diskxl_count = 0;
b7d4d7
     pthread_mutex_init(&ctx->fd_lock, NULL);
b7d4d7
     pthread_cond_init(&ctx->fd_cond, NULL);
b7d4d7
     INIT_LIST_HEAD(&ctx->janitor_fds);
b7d4d7
+    pthread_mutex_init(&ctx->xl_lock, NULL);
b7d4d7
+    pthread_cond_init(&ctx->xl_cond, NULL);
b7d4d7
+    INIT_LIST_HEAD(&ctx->diskth_xl);
b7d4d7
 
b7d4d7
     lim.rlim_cur = RLIM_INFINITY;
b7d4d7
     lim.rlim_max = RLIM_INFINITY;
b7d4d7
diff --git a/libglusterfs/src/glusterfs/glusterfs.h b/libglusterfs/src/glusterfs/glusterfs.h
b7d4d7
index bf6a987..d3400bf 100644
b7d4d7
--- a/libglusterfs/src/glusterfs/glusterfs.h
b7d4d7
+++ b/libglusterfs/src/glusterfs/glusterfs.h
b7d4d7
@@ -740,7 +740,13 @@ struct _glusterfs_ctx {
b7d4d7
     pthread_t janitor;
b7d4d7
     /* The variable is use to save total posix xlator count */
b7d4d7
     uint32_t pxl_count;
b7d4d7
+    uint32_t diskxl_count;
b7d4d7
 
b7d4d7
+    /* List of posix xlator use by disk thread*/
b7d4d7
+    struct list_head diskth_xl;
b7d4d7
+    pthread_mutex_t xl_lock;
b7d4d7
+    pthread_cond_t xl_cond;
b7d4d7
+    pthread_t disk_space_check;
b7d4d7
     char volume_id[GF_UUID_BUF_SIZE]; /* Used only in protocol/client */
b7d4d7
 };
b7d4d7
 typedef struct _glusterfs_ctx glusterfs_ctx_t;
b7d4d7
diff --git a/xlators/storage/posix/src/posix-common.c b/xlators/storage/posix/src/posix-common.c
b7d4d7
index e5c6e62..2c9030b 100644
b7d4d7
--- a/xlators/storage/posix/src/posix-common.c
b7d4d7
+++ b/xlators/storage/posix/src/posix-common.c
b7d4d7
@@ -138,6 +138,36 @@ posix_inode(xlator_t *this)
b7d4d7
     return 0;
b7d4d7
 }
b7d4d7
 
b7d4d7
+static void
b7d4d7
+delete_posix_diskxl(xlator_t *this)
b7d4d7
+{
b7d4d7
+    struct posix_private *priv = this->private;
b7d4d7
+    struct posix_diskxl *pxl = priv->pxl;
b7d4d7
+    glusterfs_ctx_t *ctx = this->ctx;
b7d4d7
+    uint32_t count = 1;
b7d4d7
+
b7d4d7
+    if (pxl) {
b7d4d7
+        pthread_mutex_lock(&ctx->xl_lock);
b7d4d7
+        {
b7d4d7
+            pxl->detach_notify = _gf_true;
b7d4d7
+            while (pxl->is_use)
b7d4d7
+                pthread_cond_wait(&pxl->cond, &ctx->xl_lock);
b7d4d7
+            list_del_init(&pxl->list);
b7d4d7
+            priv->pxl = NULL;
b7d4d7
+            count = --ctx->diskxl_count;
b7d4d7
+            if (count == 0)
b7d4d7
+                pthread_cond_signal(&ctx->xl_cond);
b7d4d7
+        }
b7d4d7
+        pthread_mutex_unlock(&ctx->xl_lock);
b7d4d7
+        pthread_cond_destroy(&pxl->cond);
b7d4d7
+        GF_FREE(pxl);
b7d4d7
+        if (count == 0) {
b7d4d7
+            pthread_join(ctx->disk_space_check, NULL);
b7d4d7
+            ctx->disk_space_check = 0;
b7d4d7
+        }
b7d4d7
+    }
b7d4d7
+}
b7d4d7
+
b7d4d7
 /**
b7d4d7
  * notify - when parent sends PARENT_UP, send CHILD_UP event from here
b7d4d7
  */
b7d4d7
@@ -194,6 +224,8 @@ posix_notify(xlator_t *this, int32_t event, void *data, ...)
b7d4d7
             }
b7d4d7
             pthread_mutex_unlock(&ctx->fd_lock);
b7d4d7
 
b7d4d7
+            delete_posix_diskxl(this);
b7d4d7
+
b7d4d7
             gf_log(this->name, GF_LOG_INFO, "Sending CHILD_DOWN for brick %s",
b7d4d7
                    victim->name);
b7d4d7
             default_notify(this->parents->xlator, GF_EVENT_CHILD_DOWN, data);
b7d4d7
@@ -318,6 +350,7 @@ posix_reconfigure(xlator_t *this, dict_t *options)
b7d4d7
     int32_t force_directory_mode = -1;
b7d4d7
     int32_t create_mask = -1;
b7d4d7
     int32_t create_directory_mask = -1;
b7d4d7
+    double old_disk_reserve = 0.0;
b7d4d7
 
b7d4d7
     priv = this->private;
b7d4d7
 
b7d4d7
@@ -383,6 +416,7 @@ posix_reconfigure(xlator_t *this, dict_t *options)
b7d4d7
                " fallback to <hostname>:<export>");
b7d4d7
     }
b7d4d7
 
b7d4d7
+    old_disk_reserve = priv->disk_reserve;
b7d4d7
     GF_OPTION_RECONF("reserve", priv->disk_reserve, options, percent_or_size,
b7d4d7
                      out);
b7d4d7
     /* option can be any one of percent or bytes */
b7d4d7
@@ -390,11 +424,19 @@ posix_reconfigure(xlator_t *this, dict_t *options)
b7d4d7
     if (priv->disk_reserve < 100.0)
b7d4d7
         priv->disk_unit = 'p';
b7d4d7
 
b7d4d7
-    if (priv->disk_reserve) {
b7d4d7
+    /* Delete a pxl object from a list of disk_reserve while something
b7d4d7
+       is changed for reserve option during graph reconfigure
b7d4d7
+    */
b7d4d7
+    if (old_disk_reserve != priv->disk_reserve) {
b7d4d7
+        delete_posix_diskxl(this);
b7d4d7
+        old_disk_reserve = 0;
b7d4d7
+    }
b7d4d7
+
b7d4d7
+    if (!old_disk_reserve && priv->disk_reserve) {
b7d4d7
         ret = posix_spawn_disk_space_check_thread(this);
b7d4d7
         if (ret) {
b7d4d7
             gf_msg(this->name, GF_LOG_INFO, 0, P_MSG_DISK_SPACE_CHECK_FAILED,
b7d4d7
-                   "Getting disk space check from thread failed");
b7d4d7
+                   "Getting disk space check from thread failed ");
b7d4d7
             goto out;
b7d4d7
         }
b7d4d7
     }
b7d4d7
@@ -1008,13 +1050,13 @@ posix_init(xlator_t *this)
b7d4d7
                " fallback to <hostname>:<export>");
b7d4d7
     }
b7d4d7
 
b7d4d7
-    _private->disk_space_check_active = _gf_false;
b7d4d7
     _private->disk_space_full = 0;
b7d4d7
 
b7d4d7
     GF_OPTION_INIT("reserve", _private->disk_reserve, percent_or_size, out);
b7d4d7
 
b7d4d7
     /* option can be any one of percent or bytes */
b7d4d7
     _private->disk_unit = 0;
b7d4d7
+    pthread_cond_init(&_private->fd_cond, NULL);
b7d4d7
     if (_private->disk_reserve < 100.0)
b7d4d7
         _private->disk_unit = 'p';
b7d4d7
 
b7d4d7
@@ -1162,12 +1204,6 @@ posix_fini(xlator_t *this)
b7d4d7
         priv->health_check = 0;
b7d4d7
     }
b7d4d7
 
b7d4d7
-    if (priv->disk_space_check) {
b7d4d7
-        priv->disk_space_check_active = _gf_false;
b7d4d7
-        (void)gf_thread_cleanup_xint(priv->disk_space_check);
b7d4d7
-        priv->disk_space_check = 0;
b7d4d7
-    }
b7d4d7
-
b7d4d7
     if (priv->janitor) {
b7d4d7
         /*TODO: Make sure the synctask is also complete */
b7d4d7
         ret = gf_tw_del_timer(this->ctx->tw->timer_wheel, priv->janitor);
b7d4d7
@@ -1192,10 +1228,24 @@ posix_fini(xlator_t *this)
b7d4d7
         pthread_join(ctx->janitor, NULL);
b7d4d7
     }
b7d4d7
 
b7d4d7
+    pthread_mutex_lock(&ctx->xl_lock);
b7d4d7
+    {
b7d4d7
+        count = --ctx->diskxl_count;
b7d4d7
+        if (count == 0)
b7d4d7
+            pthread_cond_signal(&ctx->xl_cond);
b7d4d7
+    }
b7d4d7
+    pthread_mutex_unlock(&ctx->xl_lock);
b7d4d7
+
b7d4d7
+    if (count == 0) {
b7d4d7
+        pthread_join(ctx->disk_space_check, NULL);
b7d4d7
+        ctx->disk_space_check = 0;
b7d4d7
+    }
b7d4d7
+
b7d4d7
     if (priv->fsyncer) {
b7d4d7
         (void)gf_thread_cleanup_xint(priv->fsyncer);
b7d4d7
         priv->fsyncer = 0;
b7d4d7
     }
b7d4d7
+
b7d4d7
     /*unlock brick dir*/
b7d4d7
     if (priv->mount_lock)
b7d4d7
         (void)sys_closedir(priv->mount_lock);
b7d4d7
diff --git a/xlators/storage/posix/src/posix-handle.h b/xlators/storage/posix/src/posix-handle.h
b7d4d7
index c4d7cb1..8e4c719 100644
b7d4d7
--- a/xlators/storage/posix/src/posix-handle.h
b7d4d7
+++ b/xlators/storage/posix/src/posix-handle.h
b7d4d7
@@ -206,5 +206,6 @@ int
b7d4d7
 posix_check_internal_writes(xlator_t *this, fd_t *fd, int sysfd, dict_t *xdata);
b7d4d7
 
b7d4d7
 void
b7d4d7
-posix_disk_space_check(xlator_t *this);
b7d4d7
+posix_disk_space_check(struct posix_private* priv);
b7d4d7
+
b7d4d7
 #endif /* !_POSIX_HANDLE_H */
b7d4d7
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c
b7d4d7
index ceac52a..110d383 100644
b7d4d7
--- a/xlators/storage/posix/src/posix-helpers.c
b7d4d7
+++ b/xlators/storage/posix/src/posix-helpers.c
b7d4d7
@@ -2284,9 +2284,8 @@ unlock:
b7d4d7
 }
b7d4d7
 
b7d4d7
 void
b7d4d7
-posix_disk_space_check(xlator_t *this)
b7d4d7
+posix_disk_space_check(struct posix_private *priv)
b7d4d7
 {
b7d4d7
-    struct posix_private *priv = NULL;
b7d4d7
     char *subvol_path = NULL;
b7d4d7
     int op_ret = 0;
b7d4d7
     double size = 0;
b7d4d7
@@ -2295,16 +2294,14 @@ posix_disk_space_check(xlator_t *this)
b7d4d7
     double totsz = 0;
b7d4d7
     double freesz = 0;
b7d4d7
 
b7d4d7
-    GF_VALIDATE_OR_GOTO(this->name, this, out);
b7d4d7
-    priv = this->private;
b7d4d7
-    GF_VALIDATE_OR_GOTO(this->name, priv, out);
b7d4d7
+    GF_VALIDATE_OR_GOTO("posix-helpers", priv, out);
b7d4d7
 
b7d4d7
     subvol_path = priv->base_path;
b7d4d7
 
b7d4d7
     op_ret = sys_statvfs(subvol_path, &buf;;
b7d4d7
 
b7d4d7
     if (op_ret == -1) {
b7d4d7
-        gf_msg(this->name, GF_LOG_ERROR, errno, P_MSG_STATVFS_FAILED,
b7d4d7
+        gf_msg("posix-disk", GF_LOG_ERROR, errno, P_MSG_STATVFS_FAILED,
b7d4d7
                "statvfs failed on %s", subvol_path);
b7d4d7
         goto out;
b7d4d7
     }
b7d4d7
@@ -2328,78 +2325,102 @@ out:
b7d4d7
 }
b7d4d7
 
b7d4d7
 static void *
b7d4d7
-posix_disk_space_check_thread_proc(void *data)
b7d4d7
+posix_ctx_disk_thread_proc(void *data)
b7d4d7
 {
b7d4d7
-    xlator_t *this = NULL;
b7d4d7
     struct posix_private *priv = NULL;
b7d4d7
+    glusterfs_ctx_t *ctx = NULL;
b7d4d7
     uint32_t interval = 0;
b7d4d7
-    int ret = -1;
b7d4d7
-
b7d4d7
-    this = data;
b7d4d7
-    priv = this->private;
b7d4d7
+    struct posix_diskxl *pthis = NULL;
b7d4d7
+    xlator_t *this = NULL;
b7d4d7
+    struct timespec sleep_till = {
b7d4d7
+        0,
b7d4d7
+    };
b7d4d7
 
b7d4d7
+    ctx = data;
b7d4d7
     interval = 5;
b7d4d7
-    gf_msg_debug(this->name, 0,
b7d4d7
-                 "disk-space thread started, "
b7d4d7
+
b7d4d7
+    gf_msg_debug("glusterfs_ctx", 0,
b7d4d7
+                 "Ctx disk-space thread started, "
b7d4d7
                  "interval = %d seconds",
b7d4d7
                  interval);
b7d4d7
-    while (1) {
b7d4d7
-        /* aborting sleep() is a request to exit this thread, sleep()
b7d4d7
-         * will normally not return when cancelled */
b7d4d7
-        ret = sleep(interval);
b7d4d7
-        if (ret > 0)
b7d4d7
-            break;
b7d4d7
-        /* prevent thread errors while doing the health-check(s) */
b7d4d7
-        pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
b7d4d7
-
b7d4d7
-        /* Do the disk-check.*/
b7d4d7
-        posix_disk_space_check(this);
b7d4d7
-        if (!priv->disk_space_check_active)
b7d4d7
-            goto out;
b7d4d7
-        pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
b7d4d7
-    }
b7d4d7
 
b7d4d7
-out:
b7d4d7
-    gf_msg_debug(this->name, 0, "disk space check thread exiting");
b7d4d7
-    LOCK(&priv->lock);
b7d4d7
+    pthread_mutex_lock(&ctx->xl_lock);
b7d4d7
     {
b7d4d7
-        priv->disk_space_check_active = _gf_false;
b7d4d7
+        while (ctx->diskxl_count > 0) {
b7d4d7
+            list_for_each_entry(pthis, &ctx->diskth_xl, list)
b7d4d7
+            {
b7d4d7
+                pthis->is_use = _gf_true;
b7d4d7
+                pthread_mutex_unlock(&ctx->xl_lock);
b7d4d7
+
b7d4d7
+                THIS = this = pthis->xl;
b7d4d7
+                priv = this->private;
b7d4d7
+
b7d4d7
+                posix_disk_space_check(priv);
b7d4d7
+
b7d4d7
+                pthread_mutex_lock(&ctx->xl_lock);
b7d4d7
+                pthis->is_use = _gf_false;
b7d4d7
+                /* Send a signal to posix_notify function */
b7d4d7
+                if (pthis->detach_notify)
b7d4d7
+                    pthread_cond_signal(&pthis->cond);
b7d4d7
+            }
b7d4d7
+
b7d4d7
+            timespec_now_realtime(&sleep_till);
b7d4d7
+            sleep_till.tv_sec += 5;
b7d4d7
+            (void)pthread_cond_timedwait(&ctx->xl_cond, &ctx->xl_lock,
b7d4d7
+                                         &sleep_till);
b7d4d7
+        }
b7d4d7
     }
b7d4d7
-    UNLOCK(&priv->lock);
b7d4d7
+    pthread_mutex_unlock(&ctx->xl_lock);
b7d4d7
 
b7d4d7
     return NULL;
b7d4d7
 }
b7d4d7
 
b7d4d7
 int
b7d4d7
-posix_spawn_disk_space_check_thread(xlator_t *xl)
b7d4d7
+posix_spawn_disk_space_check_thread(xlator_t *this)
b7d4d7
 {
b7d4d7
-    struct posix_private *priv = NULL;
b7d4d7
-    int ret = -1;
b7d4d7
+    int ret = 0;
b7d4d7
+    glusterfs_ctx_t *ctx = this->ctx;
b7d4d7
+    struct posix_diskxl *pxl = NULL;
b7d4d7
+    struct posix_private *priv = this->private;
b7d4d7
 
b7d4d7
-    priv = xl->private;
b7d4d7
+    pxl = GF_CALLOC(1, sizeof(struct posix_diskxl), gf_posix_mt_diskxl_t);
b7d4d7
+    if (!pxl) {
b7d4d7
+        ret = -ENOMEM;
b7d4d7
+        gf_log(this->name, GF_LOG_ERROR,
b7d4d7
+               "Calloc is failed to allocate "
b7d4d7
+               "memory for diskxl object");
b7d4d7
+        goto out;
b7d4d7
+    }
b7d4d7
+    pthread_cond_init(&pxl->cond, NULL);
b7d4d7
 
b7d4d7
-    LOCK(&priv->lock);
b7d4d7
+    pthread_mutex_lock(&ctx->xl_lock);
b7d4d7
     {
b7d4d7
-        /* cancel the running thread  */
b7d4d7
-        if (priv->disk_space_check_active == _gf_true) {
b7d4d7
-            pthread_cancel(priv->disk_space_check);
b7d4d7
-            priv->disk_space_check_active = _gf_false;
b7d4d7
-        }
b7d4d7
+        if (ctx->diskxl_count++ == 0) {
b7d4d7
+            ret = gf_thread_create(&ctx->disk_space_check, NULL,
b7d4d7
+                                   posix_ctx_disk_thread_proc, ctx,
b7d4d7
+                                   "posixctxres");
b7d4d7
 
b7d4d7
-        ret = gf_thread_create(&priv->disk_space_check, NULL,
b7d4d7
-                               posix_disk_space_check_thread_proc, xl,
b7d4d7
-                               "posix_reserve");
b7d4d7
-        if (ret) {
b7d4d7
-            priv->disk_space_check_active = _gf_false;
b7d4d7
-            gf_msg(xl->name, GF_LOG_ERROR, errno, P_MSG_DISK_SPACE_CHECK_FAILED,
b7d4d7
-                   "unable to setup disk space check thread");
b7d4d7
-            goto unlock;
b7d4d7
+            if (ret) {
b7d4d7
+                gf_msg(this->name, GF_LOG_ERROR, errno, P_MSG_THREAD_FAILED,
b7d4d7
+                       "spawning disk space check thread failed");
b7d4d7
+                ctx->diskxl_count--;
b7d4d7
+                pthread_mutex_unlock(&ctx->xl_lock);
b7d4d7
+                goto out;
b7d4d7
+            }
b7d4d7
         }
b7d4d7
+        pxl->xl = this;
b7d4d7
+        priv->pxl = (void *)pxl;
b7d4d7
+        list_add_tail(&pxl->list, &ctx->diskth_xl);
b7d4d7
+    }
b7d4d7
+    pthread_mutex_unlock(&ctx->xl_lock);
b7d4d7
 
b7d4d7
-        priv->disk_space_check_active = _gf_true;
b7d4d7
+out:
b7d4d7
+    if (ret) {
b7d4d7
+        if (pxl) {
b7d4d7
+            pthread_cond_destroy(&pxl->cond);
b7d4d7
+            GF_FREE(pxl);
b7d4d7
+        }
b7d4d7
     }
b7d4d7
-unlock:
b7d4d7
-    UNLOCK(&priv->lock);
b7d4d7
     return ret;
b7d4d7
 }
b7d4d7
 
b7d4d7
diff --git a/xlators/storage/posix/src/posix-inode-fd-ops.c b/xlators/storage/posix/src/posix-inode-fd-ops.c
b7d4d7
index 1d37aed..761e018 100644
b7d4d7
--- a/xlators/storage/posix/src/posix-inode-fd-ops.c
b7d4d7
+++ b/xlators/storage/posix/src/posix-inode-fd-ops.c
b7d4d7
@@ -37,6 +37,7 @@
b7d4d7
 #include <fcntl.h>
b7d4d7
 #endif /* HAVE_LINKAT */
b7d4d7
 
b7d4d7
+#include "posix-handle.h"
b7d4d7
 #include <glusterfs/glusterfs.h>
b7d4d7
 #include <glusterfs/checksum.h>
b7d4d7
 #include <glusterfs/dict.h>
b7d4d7
@@ -713,7 +714,7 @@ posix_do_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags,
b7d4d7
        option behaviour
b7d4d7
     */
b7d4d7
     if (priv->disk_reserve)
b7d4d7
-        posix_disk_space_check(this);
b7d4d7
+        posix_disk_space_check(priv);
b7d4d7
 
b7d4d7
     DISK_SPACE_CHECK_AND_GOTO(frame, priv, xdata, ret, ret, unlock);
b7d4d7
 
b7d4d7
diff --git a/xlators/storage/posix/src/posix-mem-types.h b/xlators/storage/posix/src/posix-mem-types.h
b7d4d7
index 2253f38..bb4c56d 100644
b7d4d7
--- a/xlators/storage/posix/src/posix-mem-types.h
b7d4d7
+++ b/xlators/storage/posix/src/posix-mem-types.h
b7d4d7
@@ -20,6 +20,7 @@ enum gf_posix_mem_types_ {
b7d4d7
     gf_posix_mt_paiocb,
b7d4d7
     gf_posix_mt_inode_ctx_t,
b7d4d7
     gf_posix_mt_mdata_attr,
b7d4d7
+    gf_posix_mt_diskxl_t,
b7d4d7
     gf_posix_mt_end
b7d4d7
 };
b7d4d7
 #endif
b7d4d7
diff --git a/xlators/storage/posix/src/posix.h b/xlators/storage/posix/src/posix.h
b7d4d7
index 07f367b..4be979c 100644
b7d4d7
--- a/xlators/storage/posix/src/posix.h
b7d4d7
+++ b/xlators/storage/posix/src/posix.h
b7d4d7
@@ -36,7 +36,6 @@
b7d4d7
 #include <glusterfs/compat.h>
b7d4d7
 #include <glusterfs/timer.h>
b7d4d7
 #include "posix-mem-types.h"
b7d4d7
-#include "posix-handle.h"
b7d4d7
 #include <glusterfs/call-stub.h>
b7d4d7
 
b7d4d7
 #ifdef HAVE_LIBAIO
b7d4d7
@@ -138,6 +137,14 @@ struct posix_fd {
b7d4d7
     char _pad[4]; /* manual padding */
b7d4d7
 };
b7d4d7
 
b7d4d7
+struct posix_diskxl {
b7d4d7
+    pthread_cond_t cond;
b7d4d7
+    struct list_head list;
b7d4d7
+    xlator_t *xl;
b7d4d7
+    gf_boolean_t detach_notify;
b7d4d7
+    gf_boolean_t is_use;
b7d4d7
+};
b7d4d7
+
b7d4d7
 struct posix_private {
b7d4d7
     char *base_path;
b7d4d7
     int32_t base_path_length;
b7d4d7
@@ -207,6 +214,7 @@ struct posix_private {
b7d4d7
     pthread_mutex_t janitor_mutex;
b7d4d7
     pthread_cond_t janitor_cond;
b7d4d7
     pthread_cond_t fd_cond;
b7d4d7
+    pthread_cond_t disk_cond;
b7d4d7
     int fsync_queue_count;
b7d4d7
 
b7d4d7
     enum {
b7d4d7
@@ -233,7 +241,6 @@ struct posix_private {
b7d4d7
     char disk_unit;
b7d4d7
     uint32_t disk_space_full;
b7d4d7
     pthread_t disk_space_check;
b7d4d7
-    gf_boolean_t disk_space_check_active;
b7d4d7
 
b7d4d7
 #ifdef GF_DARWIN_HOST_OS
b7d4d7
     enum {
b7d4d7
@@ -263,6 +270,7 @@ struct posix_private {
b7d4d7
     gf_boolean_t ctime;
b7d4d7
     gf_boolean_t janitor_task_stop;
b7d4d7
     uint32_t rel_fdcount;
b7d4d7
+    void *pxl;
b7d4d7
 };
b7d4d7
 
b7d4d7
 typedef struct {
b7d4d7
-- 
b7d4d7
1.8.3.1
b7d4d7