7c2869
From c73641d9d7647ea63b5f9f8f6a9aced88e243d0c Mon Sep 17 00:00:00 2001
7c2869
From: Pranith Kumar K <pkarampu@redhat.com>
7c2869
Date: Mon, 19 Mar 2018 15:26:40 +0530
7c2869
Subject: [PATCH 673/675] cluster/afr: Switch to active-fd-count for open-fd
7c2869
 checks
7c2869
7c2869
 >BUG: 1557932
7c2869
7c2869
Change-Id: I1476ebc84336250f10c82ad913eba88a575c9913
7c2869
Upstream-patch: https://review.gluster.org/19741
7c2869
BUG: 1583733
7c2869
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
7c2869
Reviewed-on: https://code.engineering.redhat.com/gerrit/140578
7c2869
Tested-by: RHGS Build Bot <nigelb@redhat.com>
7c2869
Tested-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
7c2869
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
7c2869
---
7c2869
 tests/basic/afr/afr-no-fsync.t            | 20 ++++++++++++++++++++
7c2869
 xlators/cluster/afr/src/afr-inode-write.c | 16 ++++++++--------
7c2869
 2 files changed, 28 insertions(+), 8 deletions(-)
7c2869
 create mode 100644 tests/basic/afr/afr-no-fsync.t
7c2869
7c2869
diff --git a/tests/basic/afr/afr-no-fsync.t b/tests/basic/afr/afr-no-fsync.t
7c2869
new file mode 100644
7c2869
index 0000000..0966d9b
7c2869
--- /dev/null
7c2869
+++ b/tests/basic/afr/afr-no-fsync.t
7c2869
@@ -0,0 +1,20 @@
7c2869
+#!/bin/bash
7c2869
+#Tests that sequential write workload doesn't lead to FSYNCs
7c2869
+
7c2869
+. $(dirname $0)/../../include.rc
7c2869
+. $(dirname $0)/../../volume.rc
7c2869
+
7c2869
+cleanup;
7c2869
+
7c2869
+TEST glusterd
7c2869
+TEST pidof glusterd
7c2869
+TEST $CLI volume create $V0 replica 3 $H0:$B0/brick{0,1,3}
7c2869
+TEST $CLI volume set $V0 features.shard on
7c2869
+TEST $CLI volume set $V0 performance.flush-behind off
7c2869
+TEST $CLI volume start $V0
7c2869
+TEST $CLI volume profile $V0 start
7c2869
+TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0;
7c2869
+TEST dd if=/dev/zero of=$M0/a bs=1M count=500
7c2869
+TEST ! "$CLI volume profile $V0 info incremental | grep FSYNC"
7c2869
+
7c2869
+cleanup;
7c2869
diff --git a/xlators/cluster/afr/src/afr-inode-write.c b/xlators/cluster/afr/src/afr-inode-write.c
7c2869
index 33c1015..5eb2964 100644
7c2869
--- a/xlators/cluster/afr/src/afr-inode-write.c
7c2869
+++ b/xlators/cluster/afr/src/afr-inode-write.c
7c2869
@@ -314,10 +314,10 @@ afr_inode_write_fill (call_frame_t *frame, xlator_t *this, int child_index,
7c2869
 		if (ret || !write_is_append)
7c2869
 			local->append_write = _gf_false;
7c2869
 
7c2869
-		ret = dict_get_uint32 (xdata, GLUSTERFS_OPEN_FD_COUNT,
7c2869
-				       &open_fd_count);
7c2869
-		if (ret == -1)
7c2869
-			goto unlock;
7c2869
+                ret = dict_get_uint32 (xdata, GLUSTERFS_ACTIVE_FD_COUNT,
7c2869
+                                       &open_fd_count);
7c2869
+                if (ret < 0)
7c2869
+                        goto unlock;
7c2869
 		if (open_fd_count > local->open_fd_count) {
7c2869
                         local->open_fd_count = open_fd_count;
7c2869
                         local->update_open_fd_count = _gf_true;
7c2869
@@ -530,10 +530,10 @@ afr_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
7c2869
         if (ret)
7c2869
                 goto out;
7c2869
 
7c2869
-	if (dict_set_uint32 (local->xdata_req, GLUSTERFS_OPEN_FD_COUNT, 4)) {
7c2869
-		op_errno = ENOMEM;
7c2869
-		goto out;
7c2869
-	}
7c2869
+        if (dict_set_uint32 (local->xdata_req, GLUSTERFS_ACTIVE_FD_COUNT, 4)) {
7c2869
+                op_errno = ENOMEM;
7c2869
+                goto out;
7c2869
+        }
7c2869
 
7c2869
 	if (dict_set_uint32 (local->xdata_req, GLUSTERFS_WRITE_IS_APPEND, 4)) {
7c2869
 		op_errno = ENOMEM;
7c2869
-- 
7c2869
1.8.3.1
7c2869