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