summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorRaghavendra G <rgowdapp@redhat.com>2015-11-17 12:57:54 +0530
committerRaghavendra G <rgowdapp@redhat.com>2015-12-22 01:55:57 -0800
commit3fcead2de7bcdb4e1312f37e7e750abd8d9d9770 (patch)
tree6df073e7faf75ed55e997692201494fed547ce84 /libglusterfs
parentd73f5c9eae0f5c8796598fa1930844c15c2c37d4 (diff)
performance/write-behind: retry "failed syncs to backend"
1. When sync fails, the cached-write is still preserved unless there is a flush/fsync waiting on it. 2. When a sync fails and there is a flush/fsync waiting on the cached-write, the cache is thrown away and no further retries will be made. In other words flush/fsync act as barriers for all the previous writes. The behaviour of fsync acting as a barrier is controlled by an option (see below for details). All previous writes are either successfully synced to backend or forgotten in case of an error. Without such barrier fop (especially flush which is issued prior to a close), we end up retrying for ever even after fd is closed. 3. If a fop is waiting on cached-write and syncing to backend fails, the waiting fop is failed. 4. sync failures when no fop is waiting are ignored and are not propagated to application. For eg., a. first attempt of sync of a cached-write w1 fails b. second attempt of sync of w1 succeeds If there are no fops dependent on w1 are issued b/w a and b, application won't know about failure encountered in a. 5. The effect of repeated sync failures is that, there will be no cache for future writes and they cannot be written behind. fsync as a barrier and resync of cached writes post fsync failure: ================================================================== Whether to keep retrying failed syncs post fsync is controlled by an option "resync-failed-syncs-after-fsync". By default, this option is set to "off". If sync of "cached-writes issued before fsync" (to backend) fails, this option configures whether to retry syncing them after fsync or forget them. If set to on, cached-writes are retried till a "flush" fop (or a successful sync) on sync failures. fsync itself is failed irrespective of the value of this option, when there is a sync failure of any cached-writes issued before fsync. Change-Id: I6097c9257bfb9ee5b15616fbe6a0576ae9af369a Signed-off-by: Raghavendra G <rgowdapp@redhat.com> BUG: 1279730 Reviewed-on: http://review.gluster.org/12594
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/common-utils.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
index 0e7aa01..f5f4493 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -432,10 +432,12 @@ iov_subset (struct iovec *orig, int orig_count,
int i;
off_t offset = 0;
size_t start_offset = 0;
- size_t end_offset = 0;
+ size_t end_offset = 0, origin_iov_len = 0;
for (i = 0; i < orig_count; i++) {
+ origin_iov_len = orig[i].iov_len;
+
if ((offset + orig[i].iov_len < src_offset)
|| (offset > dst_offset)) {
goto not_subset;
@@ -463,7 +465,7 @@ iov_subset (struct iovec *orig, int orig_count,
new_count++;
not_subset:
- offset += orig[i].iov_len;
+ offset += origin_iov_len;
}
return new_count;