d1681e
From cd8c116ba97432f585408de509280a501816d3a5 Mon Sep 17 00:00:00 2001
d1681e
From: Sunil Kumar Acharya <sheggodu@redhat.com>
d1681e
Date: Thu, 23 Mar 2017 12:50:41 +0530
d1681e
Subject: [PATCH 121/128] cluster/ec: OpenFD heal implementation for EC
d1681e
d1681e
Existing EC code doesn't try to heal the OpenFD to
d1681e
avoid unnecessary healing of the data later.
d1681e
d1681e
Fix implements the healing of open FDs before
d1681e
carrying out file operations on them by making an
d1681e
attempt to open the FDs on required up nodes.
d1681e
d1681e
>BUG: 1431955
d1681e
>Change-Id: Ib696f59c41ffd8d5678a484b23a00bb02764ed15
d1681e
>Signed-off-by: Sunil Kumar Acharya <sheggodu@redhat.com>
d1681e
Upstream Patch: https://review.gluster.org/17077
d1681e
3.13 Patch: https://review.gluster.org/19176
d1681e
d1681e
BUG: 1509810
d1681e
Change-Id: Ib696f59c41ffd8d5678a484b23a00bb02764ed15
d1681e
Signed-off-by: Sunil Kumar Acharya <sheggodu@redhat.com>
d1681e
Reviewed-on: https://code.engineering.redhat.com/gerrit/127271
d1681e
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
d1681e
Tested-by: RHGS Build Bot <nigelb@redhat.com>
d1681e
Reviewed-by: Javier Hernandez Juan <jahernan@redhat.com>
d1681e
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
d1681e
---
d1681e
 tests/basic/ec/ec-fix-openfd.t         | 109 +++++++++++++++++++++++++++++++
d1681e
 tests/bugs/core/bug-908146.t           |  12 +---
d1681e
 tests/volume.rc                        |  12 ++++
d1681e
 xlators/cluster/ec/src/ec-common.c     | 113 +++++++++++++++++++++++++++++++++
d1681e
 xlators/cluster/ec/src/ec-common.h     |   4 ++
d1681e
 xlators/cluster/ec/src/ec-dir-read.c   |   8 ++-
d1681e
 xlators/cluster/ec/src/ec-dir-write.c  |   1 +
d1681e
 xlators/cluster/ec/src/ec-helpers.c    |  29 +++++----
d1681e
 xlators/cluster/ec/src/ec-inode-read.c |   3 +
d1681e
 xlators/cluster/ec/src/ec-types.h      |  59 +++++++++++------
d1681e
 10 files changed, 307 insertions(+), 43 deletions(-)
d1681e
 create mode 100644 tests/basic/ec/ec-fix-openfd.t
d1681e
d1681e
diff --git a/tests/basic/ec/ec-fix-openfd.t b/tests/basic/ec/ec-fix-openfd.t
d1681e
new file mode 100644
d1681e
index 0000000..b62fbf4
d1681e
--- /dev/null
d1681e
+++ b/tests/basic/ec/ec-fix-openfd.t
d1681e
@@ -0,0 +1,109 @@
d1681e
+#!/bin/bash
d1681e
+
d1681e
+. $(dirname $0)/../../include.rc
d1681e
+. $(dirname $0)/../../volume.rc
d1681e
+. $(dirname $0)/../../fileio.rc
d1681e
+
d1681e
+# This test checks for open fd heal on EC
d1681e
+
d1681e
+#Create Volume
d1681e
+cleanup
d1681e
+TEST glusterd
d1681e
+TEST pidof glusterd
d1681e
+TEST $CLI volume create $V0 disperse 3 redundancy 1 $H0:$B0/${V0}{0..2}
d1681e
+TEST $CLI volume set $V0 performance.read-after-open yes
d1681e
+TEST $CLI volume set $V0 performance.lazy-open no
d1681e
+TEST $CLI volume set $V0 performance.open-behind off
d1681e
+TEST $CLI volume set $V0 disperse.background-heals 0
d1681e
+TEST $CLI volume heal $V0 disable
d1681e
+TEST $CLI volume start $V0
d1681e
+
d1681e
+#Mount the volume
d1681e
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0;
d1681e
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "3" ec_child_up_count $V0 0
d1681e
+
d1681e
+#Touch a file
d1681e
+TEST touch "$M0/test_file"
d1681e
+
d1681e
+#Kill a brick
d1681e
+TEST kill_brick $V0 $H0 $B0/${V0}0
d1681e
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "2" ec_child_up_count $V0 0
d1681e
+
d1681e
+#Open the file in write mode
d1681e
+TEST fd=`fd_available`
d1681e
+TEST fd_open $fd 'rw' "$M0/test_file"
d1681e
+
d1681e
+#Bring up the killed brick
d1681e
+TEST $CLI volume start $V0 force
d1681e
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "3" ec_child_up_count $V0 0
d1681e
+
d1681e
+#Test the fd count
d1681e
+EXPECT "0" get_fd_count $V0 $H0 $B0/${V0}0 test_file
d1681e
+EXPECT "1" get_fd_count $V0 $H0 $B0/${V0}1 test_file
d1681e
+EXPECT "1" get_fd_count $V0 $H0 $B0/${V0}2 test_file
d1681e
+
d1681e
+#Write to file
d1681e
+dd iflag=fullblock if=/dev/random bs=1024 count=2 >&$fd 2>/dev/null
d1681e
+
d1681e
+#Test the fd count
d1681e
+EXPECT "1" get_fd_count $V0 $H0 $B0/${V0}0 test_file
d1681e
+
d1681e
+#Close fd
d1681e
+TEST fd_close $fd
d1681e
+
d1681e
+#Stop the volume
d1681e
+TEST $CLI volume stop $V0
d1681e
+
d1681e
+#Start the volume
d1681e
+TEST $CLI volume start $V0
d1681e
+
d1681e
+#Kill brick1
d1681e
+TEST kill_brick $V0 $H0 $B0/${V0}0
d1681e
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "2" ec_child_up_count $V0 0
d1681e
+
d1681e
+#Unmount and mount
d1681e
+EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0;
d1681e
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0;
d1681e
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "2" ec_child_up_count $V0 0
d1681e
+
d1681e
+#Calculate md5 sum
d1681e
+md5sum0=`get_md5_sum "$M0/test_file"`
d1681e
+
d1681e
+#Bring up the brick
d1681e
+TEST $CLI volume start $V0 force
d1681e
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "3" ec_child_up_count $V0 0
d1681e
+
d1681e
+#Kill brick2
d1681e
+TEST kill_brick $V0 $H0 $B0/${V0}1
d1681e
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "2" ec_child_up_count $V0 0
d1681e
+
d1681e
+#Unmount and mount
d1681e
+EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0
d1681e
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0;
d1681e
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "2" ec_child_up_count $V0 0
d1681e
+
d1681e
+#Calculate md5 sum
d1681e
+md5sum1=`get_md5_sum "$M0/test_file"`
d1681e
+
d1681e
+#Bring up the brick
d1681e
+TEST $CLI volume start $V0 force
d1681e
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "3" ec_child_up_count $V0 0
d1681e
+
d1681e
+#Kill brick3
d1681e
+TEST kill_brick $V0 $H0 $B0/${V0}2
d1681e
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "2" ec_child_up_count $V0 0
d1681e
+
d1681e
+#Unmount and mount
d1681e
+EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0
d1681e
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0;
d1681e
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "2" ec_child_up_count $V0 0
d1681e
+
d1681e
+#Calculate md5 sum
d1681e
+md5sum2=`get_md5_sum "$M0/test_file"`
d1681e
+
d1681e
+#compare the md5sum
d1681e
+EXPECT "$md5sum0" echo $md5sum1
d1681e
+EXPECT "$md5sum0" echo $md5sum2
d1681e
+EXPECT "$md5sum1" echo $md5sum2
d1681e
+
d1681e
+cleanup
d1681e
diff --git a/tests/bugs/core/bug-908146.t b/tests/bugs/core/bug-908146.t
d1681e
index bf34992..327be6e 100755
d1681e
--- a/tests/bugs/core/bug-908146.t
d1681e
+++ b/tests/bugs/core/bug-908146.t
d1681e
@@ -2,18 +2,8 @@
d1681e
 
d1681e
 . $(dirname $0)/../../include.rc
d1681e
 . $(dirname $0)/../../volume.rc
d1681e
+. $(dirname $0)/../../fileio.rc
d1681e
 
d1681e
-function get_fd_count {
d1681e
-        local vol=$1
d1681e
-        local host=$2
d1681e
-        local brick=$3
d1681e
-        local fname=$4
d1681e
-        local gfid_str=$(gf_gfid_xattr_to_str $(gf_get_gfid_xattr $brick/$fname))
d1681e
-        local statedump=$(generate_brick_statedump $vol $host $brick)
d1681e
-        local count=$(grep "gfid=$gfid_str" $statedump -A2 | grep fd-count | cut -f2 -d'=' | tail -1)
d1681e
-        rm -f $statedump
d1681e
-        echo $count
d1681e
-}
d1681e
 cleanup;
d1681e
 
d1681e
 TEST glusterd
d1681e
diff --git a/tests/volume.rc b/tests/volume.rc
d1681e
index 1cee648..1ca17ab 100644
d1681e
--- a/tests/volume.rc
d1681e
+++ b/tests/volume.rc
d1681e
@@ -796,3 +796,15 @@ function count_sh_entries()
d1681e
 {
d1681e
     ls $1/.glusterfs/indices/xattrop | grep -v "xattrop-" | wc -l
d1681e
 }
d1681e
+
d1681e
+function get_fd_count {
d1681e
+        local vol=$1
d1681e
+        local host=$2
d1681e
+        local brick=$3
d1681e
+        local fname=$4
d1681e
+        local gfid_str=$(gf_gfid_xattr_to_str $(gf_get_gfid_xattr $brick/$fname))
d1681e
+        local statedump=$(generate_brick_statedump $vol $host $brick)
d1681e
+        local count=$(grep "gfid=$gfid_str" $statedump -A2 | grep fd-count | cut -f2 -d'=' | tail -1)
d1681e
+        rm -f $statedump
d1681e
+        echo $count
d1681e
+}
d1681e
diff --git a/xlators/cluster/ec/src/ec-common.c b/xlators/cluster/ec/src/ec-common.c
d1681e
index f86ecf8..18ed274 100644
d1681e
--- a/xlators/cluster/ec/src/ec-common.c
d1681e
+++ b/xlators/cluster/ec/src/ec-common.c
d1681e
@@ -25,6 +25,114 @@
d1681e
                                    EC_FLAG_WAITING_DATA_DIRTY |\
d1681e
                                    EC_FLAG_WAITING_METADATA_DIRTY)
d1681e
 
d1681e
+void
d1681e
+ec_update_fd_status (fd_t *fd, xlator_t *xl, int idx,
d1681e
+                     int32_t ret_status)
d1681e
+{
d1681e
+        ec_fd_t *fd_ctx;
d1681e
+
d1681e
+        if (fd == NULL)
d1681e
+                return;
d1681e
+
d1681e
+        LOCK (&fd->lock);
d1681e
+        {
d1681e
+                fd_ctx = __ec_fd_get(fd, xl);
d1681e
+                if (fd_ctx) {
d1681e
+                        if (ret_status >= 0)
d1681e
+                                fd_ctx->fd_status[idx] = EC_FD_OPENED;
d1681e
+                        else
d1681e
+                                fd_ctx->fd_status[idx] = EC_FD_NOT_OPENED;
d1681e
+                }
d1681e
+        }
d1681e
+        UNLOCK (&fd->lock);
d1681e
+}
d1681e
+
d1681e
+static int
d1681e
+ec_fd_ctx_need_open (fd_t *fd, xlator_t *this, uintptr_t *need_open)
d1681e
+{
d1681e
+    int i = 0;
d1681e
+    int count = 0;
d1681e
+    ec_t *ec = NULL;
d1681e
+    ec_fd_t *fd_ctx = NULL;
d1681e
+
d1681e
+    ec = this->private;
d1681e
+    *need_open = 0;
d1681e
+
d1681e
+    fd_ctx = ec_fd_get (fd, this);
d1681e
+    if (!fd_ctx)
d1681e
+        return count;
d1681e
+
d1681e
+    LOCK (&fd->lock);
d1681e
+    {
d1681e
+        for (i = 0; i < ec->nodes; i++) {
d1681e
+                if ((fd_ctx->fd_status[i] == EC_FD_NOT_OPENED) &&
d1681e
+                    (ec->xl_up & (1<
d1681e
+                        fd_ctx->fd_status[i] = EC_FD_OPENING;
d1681e
+                        *need_open |= (1<
d1681e
+                        count++;
d1681e
+                }
d1681e
+        }
d1681e
+    }
d1681e
+    UNLOCK (&fd->lock);
d1681e
+
d1681e
+    /* If fd needs to open on minimum number of nodes
d1681e
+     * then ignore fixing the fd as it has been
d1681e
+     * requested from heal operation.
d1681e
+     */
d1681e
+    if (count >= ec->fragments)
d1681e
+        count = 0;
d1681e
+
d1681e
+    return count;
d1681e
+}
d1681e
+
d1681e
+static gf_boolean_t
d1681e
+ec_is_fd_fixable (fd_t *fd)
d1681e
+{
d1681e
+    if (!fd || !fd->inode)
d1681e
+        return _gf_false;
d1681e
+    else if (fd_is_anonymous (fd))
d1681e
+        return _gf_false;
d1681e
+    else if (gf_uuid_is_null (fd->inode->gfid))
d1681e
+        return _gf_false;
d1681e
+
d1681e
+    return _gf_true;
d1681e
+}
d1681e
+
d1681e
+static void
d1681e
+ec_fix_open (ec_fop_data_t *fop)
d1681e
+{
d1681e
+    int                call_count = 0;
d1681e
+    uintptr_t           need_open = 0;
d1681e
+    int                       ret = 0;
d1681e
+    loc_t                     loc = {0, };
d1681e
+
d1681e
+    if (!ec_is_fd_fixable (fop->fd))
d1681e
+        goto out;
d1681e
+
d1681e
+    /* Evaluate how many remote fd's to be opened */
d1681e
+    call_count = ec_fd_ctx_need_open (fop->fd, fop->xl, &need_open);
d1681e
+    if (!call_count)
d1681e
+        goto out;
d1681e
+
d1681e
+    loc.inode = inode_ref (fop->fd->inode);
d1681e
+    gf_uuid_copy (loc.gfid, fop->fd->inode->gfid);
d1681e
+    ret = loc_path (&loc, NULL);
d1681e
+    if (ret < 0) {
d1681e
+        goto out;
d1681e
+    }
d1681e
+
d1681e
+    if (IA_IFDIR == fop->fd->inode->ia_type) {
d1681e
+        ec_opendir(fop->frame, fop->xl, need_open, EC_MINIMUM_ONE,
d1681e
+                   NULL, NULL, &fop->loc[0], fop->fd, NULL);
d1681e
+    } else{
d1681e
+        ec_open(fop->frame, fop->xl, need_open, EC_MINIMUM_ONE,
d1681e
+                NULL, NULL, &loc, fop->fd->flags, fop->fd, NULL);
d1681e
+    }
d1681e
+
d1681e
+out:
d1681e
+    loc_wipe (&loc;;
d1681e
+}
d1681e
+
d1681e
 off_t
d1681e
 ec_range_end_get (off_t fl_start, size_t fl_size)
d1681e
 {
d1681e
@@ -1647,6 +1755,11 @@ void ec_lock_acquired(ec_lock_link_t *link)
d1681e
 
d1681e
     ec_lock_apply(link);
d1681e
 
d1681e
+    if (fop->use_fd &&
d1681e
+        (link->update[EC_DATA_TXN] || link->update[EC_METADATA_TXN])) {
d1681e
+        ec_fix_open(fop);
d1681e
+    }
d1681e
+
d1681e
     ec_lock_resume_shared(&list);
d1681e
 }
d1681e
 
d1681e
diff --git a/xlators/cluster/ec/src/ec-common.h b/xlators/cluster/ec/src/ec-common.h
d1681e
index dec81ca..c0ad604 100644
d1681e
--- a/xlators/cluster/ec/src/ec-common.h
d1681e
+++ b/xlators/cluster/ec/src/ec-common.h
d1681e
@@ -135,4 +135,8 @@ ec_heal_inspect (call_frame_t *frame, ec_t *ec,
d1681e
                  ec_heal_need_t *need_heal);
d1681e
 int32_t
d1681e
 ec_get_heal_info (xlator_t *this, loc_t *loc, dict_t **dict);
d1681e
+
d1681e
+void
d1681e
+ec_update_fd_status (fd_t *fd, xlator_t *xl,
d1681e
+                     int child_index, int32_t ret_status);
d1681e
 #endif /* __EC_COMMON_H__ */
d1681e
diff --git a/xlators/cluster/ec/src/ec-dir-read.c b/xlators/cluster/ec/src/ec-dir-read.c
d1681e
index 48afe54..b44bb42 100644
d1681e
--- a/xlators/cluster/ec/src/ec-dir-read.c
d1681e
+++ b/xlators/cluster/ec/src/ec-dir-read.c
d1681e
@@ -19,7 +19,11 @@
d1681e
 #include "ec-method.h"
d1681e
 #include "ec-fops.h"
d1681e
 
d1681e
-/* FOP: opendir */
d1681e
+/****************************************************************
d1681e
+ *
d1681e
+ * File Operation: opendir
d1681e
+ *
d1681e
+ ***************************************************************/
d1681e
 
d1681e
 int32_t ec_combine_opendir(ec_fop_data_t * fop, ec_cbk_data_t * dst,
d1681e
                            ec_cbk_data_t * src)
d1681e
@@ -88,6 +92,8 @@ int32_t ec_opendir_cbk(call_frame_t * frame, void * cookie, xlator_t * this,
d1681e
         }
d1681e
 
d1681e
         ec_combine(cbk, ec_combine_opendir);
d1681e
+
d1681e
+        ec_update_fd_status (fd, this, idx, op_ret);
d1681e
     }
d1681e
 
d1681e
 out:
d1681e
diff --git a/xlators/cluster/ec/src/ec-dir-write.c b/xlators/cluster/ec/src/ec-dir-write.c
d1681e
index 150dc66..7779d48 100644
d1681e
--- a/xlators/cluster/ec/src/ec-dir-write.c
d1681e
+++ b/xlators/cluster/ec/src/ec-dir-write.c
d1681e
@@ -71,6 +71,7 @@ ec_dir_write_cbk (call_frame_t *frame, xlator_t *this,
d1681e
 out:
d1681e
         if (cbk)
d1681e
                 ec_combine (cbk, ec_combine_write);
d1681e
+
d1681e
         if (fop)
d1681e
                 ec_complete (fop);
d1681e
         return 0;
d1681e
diff --git a/xlators/cluster/ec/src/ec-helpers.c b/xlators/cluster/ec/src/ec-helpers.c
d1681e
index 0c66948..d54340c 100644
d1681e
--- a/xlators/cluster/ec/src/ec-helpers.c
d1681e
+++ b/xlators/cluster/ec/src/ec-helpers.c
d1681e
@@ -751,27 +751,32 @@ ec_inode_t * ec_inode_get(inode_t * inode, xlator_t * xl)
d1681e
 
d1681e
 ec_fd_t * __ec_fd_get(fd_t * fd, xlator_t * xl)
d1681e
 {
d1681e
+    int i = 0;
d1681e
     ec_fd_t * ctx = NULL;
d1681e
     uint64_t value = 0;
d1681e
+    ec_t *ec = xl->private;
d1681e
 
d1681e
-    if ((__fd_ctx_get(fd, xl, &value) != 0) || (value == 0))
d1681e
-    {
d1681e
-        ctx = GF_MALLOC(sizeof(*ctx), ec_mt_ec_fd_t);
d1681e
-        if (ctx != NULL)
d1681e
-        {
d1681e
+    if ((__fd_ctx_get(fd, xl, &value) != 0) || (value == 0)) {
d1681e
+        ctx = GF_MALLOC(sizeof(*ctx) + (sizeof (ec_fd_status_t) * ec->nodes),
d1681e
+                        ec_mt_ec_fd_t);
d1681e
+        if (ctx != NULL) {
d1681e
             memset(ctx, 0, sizeof(*ctx));
d1681e
 
d1681e
-            value = (uint64_t)(uintptr_t)ctx;
d1681e
-            if (__fd_ctx_set(fd, xl, value) != 0)
d1681e
-            {
d1681e
-                GF_FREE(ctx);
d1681e
+            for (i = 0; i < ec->nodes; i++) {
d1681e
+                if (fd_is_anonymous (fd)) {
d1681e
+                        ctx->fd_status[i] = EC_FD_OPENED;
d1681e
+                } else {
d1681e
+                        ctx->fd_status[i] = EC_FD_NOT_OPENED;
d1681e
+                }
d1681e
+            }
d1681e
 
d1681e
+            value = (uint64_t)(uintptr_t)ctx;
d1681e
+            if (__fd_ctx_set(fd, xl, value) != 0) {
d1681e
+                GF_FREE (ctx);
d1681e
                 return NULL;
d1681e
             }
d1681e
         }
d1681e
-    }
d1681e
-    else
d1681e
-    {
d1681e
+    } else {
d1681e
         ctx = (ec_fd_t *)(uintptr_t)value;
d1681e
     }
d1681e
 
d1681e
diff --git a/xlators/cluster/ec/src/ec-inode-read.c b/xlators/cluster/ec/src/ec-inode-read.c
d1681e
index 33fd7f5..24fcdb9 100644
d1681e
--- a/xlators/cluster/ec/src/ec-inode-read.c
d1681e
+++ b/xlators/cluster/ec/src/ec-inode-read.c
d1681e
@@ -739,6 +739,9 @@ int32_t ec_open_cbk(call_frame_t * frame, void * cookie, xlator_t * this,
d1681e
         }
d1681e
 
d1681e
         ec_combine(cbk, ec_combine_open);
d1681e
+
d1681e
+        ec_update_fd_status (fd, this, idx, op_ret);
d1681e
+
d1681e
     }
d1681e
 
d1681e
 out:
d1681e
diff --git a/xlators/cluster/ec/src/ec-types.h b/xlators/cluster/ec/src/ec-types.h
d1681e
index a891ff5..3129586 100644
d1681e
--- a/xlators/cluster/ec/src/ec-types.h
d1681e
+++ b/xlators/cluster/ec/src/ec-types.h
d1681e
@@ -124,6 +124,13 @@ enum _ec_heal_need {
d1681e
         EC_HEAL_MUST
d1681e
 };
d1681e
 
d1681e
+/* Enumartions to indicate FD status. */
d1681e
+typedef enum {
d1681e
+    EC_FD_NOT_OPENED,
d1681e
+    EC_FD_OPENED,
d1681e
+    EC_FD_OPENING
d1681e
+} ec_fd_status_t;
d1681e
+
d1681e
 struct _ec_config {
d1681e
     uint32_t version;
d1681e
     uint8_t  algorithm;
d1681e
@@ -137,6 +144,7 @@ struct _ec_fd {
d1681e
     loc_t     loc;
d1681e
     uintptr_t open;
d1681e
     int32_t   flags;
d1681e
+    ec_fd_status_t fd_status[0];
d1681e
 };
d1681e
 
d1681e
 struct _ec_inode {
d1681e
@@ -263,17 +271,21 @@ struct _ec_lock_link {
d1681e
     off_t             fl_end;
d1681e
 };
d1681e
 
d1681e
+/* EC xlator data structure to collect all the data required to perform
d1681e
+ * the file operation.*/
d1681e
 struct _ec_fop_data {
d1681e
-    int32_t            id;
d1681e
+    int32_t            id;           /* ID of the file operation */
d1681e
     int32_t            refs;
d1681e
     int32_t            state;
d1681e
-    int32_t            minimum;
d1681e
+    int32_t            minimum;      /* Mininum number of successful
d1681e
+                                        operation required to conclude a
d1681e
+                                        fop as successful */
d1681e
     int32_t            expected;
d1681e
     int32_t            winds;
d1681e
     int32_t            jobs;
d1681e
     int32_t            error;
d1681e
     ec_fop_data_t     *parent;
d1681e
-    xlator_t          *xl;
d1681e
+    xlator_t          *xl;           /* points to EC xlator */
d1681e
     call_frame_t      *req_frame;    /* frame of the calling xlator */
d1681e
     call_frame_t      *frame;        /* frame used by this fop */
d1681e
     struct list_head   cbk_list;     /* sorted list of groups of answers */
d1681e
@@ -299,10 +311,10 @@ struct _ec_fop_data {
d1681e
     uid_t              uid;
d1681e
     gid_t              gid;
d1681e
 
d1681e
-    ec_wind_f          wind;
d1681e
-    ec_handler_f       handler;
d1681e
+    ec_wind_f          wind;          /* Function to wind to */
d1681e
+    ec_handler_f       handler;       /* FOP manager function */
d1681e
     ec_resume_f        resume;
d1681e
-    ec_cbk_t           cbks;
d1681e
+    ec_cbk_t           cbks;          /* Callback function for this FOP */
d1681e
     void              *data;
d1681e
     ec_heal_t         *heal;
d1681e
     struct list_head   healer;
d1681e
@@ -310,7 +322,8 @@ struct _ec_fop_data {
d1681e
     uint64_t           user_size;
d1681e
     uint32_t           head;
d1681e
 
d1681e
-    int32_t            use_fd;
d1681e
+    int32_t            use_fd;        /* Indicates whether this FOP uses FD or
d1681e
+                                         not */
d1681e
 
d1681e
     dict_t            *xdata;
d1681e
     dict_t            *dict;
d1681e
@@ -324,10 +337,12 @@ struct _ec_fop_data {
d1681e
     gf_xattrop_flags_t xattrop_flags;
d1681e
     dev_t              dev;
d1681e
     inode_t           *inode;
d1681e
-    fd_t              *fd;
d1681e
+    fd_t              *fd;              /* FD of the file on which FOP is
d1681e
+                                           being carried upon */
d1681e
     struct iatt        iatt;
d1681e
     char              *str[2];
d1681e
-    loc_t              loc[2];
d1681e
+    loc_t              loc[2];          /* Holds the location details for
d1681e
+                                           the file */
d1681e
     struct gf_flock    flock;
d1681e
     struct iovec      *vector;
d1681e
     struct iobref     *buffers;
d1681e
@@ -555,18 +570,24 @@ struct _ec {
d1681e
     xlator_t          *xl;
d1681e
     int32_t            healers;
d1681e
     int32_t            heal_waiters;
d1681e
-    int32_t            nodes;
d1681e
+    int32_t            nodes;                /* Total number of bricks(n) */
d1681e
     int32_t            bits_for_nodes;
d1681e
-    int32_t            fragments;
d1681e
-    int32_t            redundancy;
d1681e
-    uint32_t           fragment_size;
d1681e
-    uint32_t           stripe_size;
d1681e
-    int32_t            up;
d1681e
+    int32_t            fragments;            /* Data bricks(k) */
d1681e
+    int32_t            redundancy;           /* Redundant bricks(m) */
d1681e
+    uint32_t           fragment_size;        /* Size of fragment/chunk on a
d1681e
+                                                brick. */
d1681e
+    uint32_t           stripe_size;          /* (fragment_size * fragments)
d1681e
+                                                maximum size of user data
d1681e
+                                                stored in one stripe. */
d1681e
+    int32_t            up;                   /* Represents whether EC volume is
d1681e
+                                                up or not. */
d1681e
     uint32_t           idx;
d1681e
-    uint32_t           xl_up_count;
d1681e
-    uintptr_t          xl_up;
d1681e
-    uint32_t           xl_notify_count;
d1681e
-    uintptr_t          xl_notify;
d1681e
+    uint32_t           xl_up_count;          /* Number of UP bricks. */
d1681e
+    uintptr_t          xl_up;                /* Bit flag representing UP
d1681e
+                                                bricks */
d1681e
+    uint32_t           xl_notify_count;      /* Number of notifications. */
d1681e
+    uintptr_t          xl_notify;            /* Bit flag representing
d1681e
+                                                notification for bricks. */
d1681e
     uintptr_t          node_mask;
d1681e
     xlator_t         **xl_list;
d1681e
     gf_lock_t          lock;
d1681e
-- 
d1681e
1.8.3.1
d1681e