summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2009-09-22 01:38:37 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-09-22 06:13:21 -0700
commit35d1cabfd1266609ec22f11e5e4ddba13f0ffc56 (patch)
tree611b2df4c5abd0f78e836ab4d0525f435d8f2dc2 /xlators
parentdb33e097111ca76f487f087d494984d45d4b3b64 (diff)
performance/write-behind: reduce traversal of request list during wb_mark_winds.
- move all the decision making code to __wb_can_wind. - don't continue traversing the request list, once we know any of the following conditions are true: * requests other than write are present in queue. * writes are happening at non-contiguous offsets. * there are no write requests, which are wound to server but not yet received the reply. * enough data is aggregated for writing. Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 276 (write behind needs to be optimized.) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=276
Diffstat (limited to 'xlators')
-rw-r--r--xlators/performance/write-behind/src/write-behind.c63
1 files changed, 28 insertions, 35 deletions
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c
index f4a3fe89c9c..1006b730a9c 100644
--- a/xlators/performance/write-behind/src/write-behind.c
+++ b/xlators/performance/write-behind/src/write-behind.c
@@ -1316,12 +1316,13 @@ __wb_mark_wind_all (list_head_t *list, list_head_t *winds)
}
-size_t
-__wb_get_aggregate_size (list_head_t *list, char *other_fop_in_queue,
- char *non_contiguous_writes)
+void
+__wb_can_wind (list_head_t *list, size_t aggregate_conf,
+ char *other_fop_in_queue, char *non_contiguous_writes,
+ char *incomplete_writes, char *enough_data_aggregated)
{
wb_request_t *request = NULL;
- size_t size = 0, length = 0;
+ size_t aggregate_current = 0, length = 0;
struct iovec *vector = NULL;
int32_t count = 0;
char first_request = 1;
@@ -1337,6 +1338,13 @@ __wb_get_aggregate_size (list_head_t *list, char *other_fop_in_queue,
break;
}
+ if (request->flags.write_request.stack_wound
+ && !request->flags.write_request.got_reply
+ && (incomplete_writes != NULL)) {
+ *incomplete_writes = 1;
+ break;
+ }
+
vector = request->stub->args.writev.vector;
count = request->stub->args.writev.count;
if (!request->flags.write_request.stack_wound) {
@@ -1353,36 +1361,19 @@ __wb_get_aggregate_size (list_head_t *list, char *other_fop_in_queue,
}
length = iov_length (vector, count);
- size += length;
+ aggregate_current += length;
offset_expected += length;
- }
- }
-
- return size;
-}
-
-
-char
-__wb_any_incomplete_writes (list_head_t *list)
-{
- wb_request_t *request = NULL;
- char incomplete_writes = 0;
-
- list_for_each_entry (request, list, list)
- {
- if ((request->stub == NULL)
- || (request->stub->fop != GF_FOP_WRITE)) {
- break;
- }
- if (request->flags.write_request.stack_wound
- && !request->flags.write_request.got_reply) {
- incomplete_writes = 1;
- break;
+ if (aggregate_current >= aggregate_conf) {
+ if (enough_data_aggregated != NULL) {
+ *enough_data_aggregated = 1;
+ }
+ break;
+ }
}
}
- return incomplete_writes;
+ return;
}
@@ -1390,18 +1381,20 @@ ssize_t
__wb_mark_winds (list_head_t *list, list_head_t *winds, size_t aggregate_conf,
char wind_all)
{
- size_t aggregate_current = 0, size = 0;
+ size_t size = 0;
char incomplete_writes = 0;
char other_fop_in_queue = 0;
char non_contiguous_writes = 0;
+ char enough_data_aggregated = 0;
- incomplete_writes = __wb_any_incomplete_writes (list);
-
- aggregate_current = __wb_get_aggregate_size (list, &other_fop_in_queue,
- &non_contiguous_writes);
+ if (!wind_all) {
+ __wb_can_wind (list, aggregate_conf, &other_fop_in_queue,
+ &non_contiguous_writes, &incomplete_writes,
+ &enough_data_aggregated);
+ }
if ((!incomplete_writes) || (wind_all) || (non_contiguous_writes)
- || (other_fop_in_queue) || (aggregate_current >= aggregate_conf)) {
+ || (other_fop_in_queue) || (enough_data_aggregated)) {
size = __wb_mark_wind_all (list, winds);
}