summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2009-09-21 09:50:48 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-09-22 06:14:11 -0700
commit3c5d05b42708e77e161eda4018b42484f36b1436 (patch)
treee89cd1fdb29486557c8f9751f06e938a282a0959
parent02f0b705e87f9cf50e7384520b49a54fc95e7b1e (diff)
performance/write-behind: fine-tune logic of wb_mark_winds
- remove wb_mark_wind_aggregegate_size_aware, since wb_mark_wind_all does the same work (with check for whether current aggregated data size is greater than the configured limit before calling it). Moreover, wb_mark_wind_aggregate_size_aware called __wb_get_aggregate_size redundantly, thereby reducing the performance, since for small sized large number of writes, traversing the list of requests takes significant amount of time. 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
-rw-r--r--xlators/performance/write-behind/src/write-behind.c79
1 files changed, 14 insertions, 65 deletions
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c
index 374c173449b..2c654b4f942 100644
--- a/xlators/performance/write-behind/src/write-behind.c
+++ b/xlators/performance/write-behind/src/write-behind.c
@@ -1126,11 +1126,11 @@ __wb_get_aggregate_size (list_head_t *list, char *other_fop_in_queue,
}
-uint32_t
-__wb_get_incomplete_writes (list_head_t *list)
+char
+__wb_any_incomplete_writes (list_head_t *list)
{
wb_request_t *request = NULL;
- uint32_t count = 0;
+ char incomplete_writes = 0;
list_for_each_entry (request, list, list)
{
@@ -1141,60 +1141,12 @@ __wb_get_incomplete_writes (list_head_t *list)
if (request->flags.write_request.stack_wound
&& !request->flags.write_request.got_reply) {
- count++;
+ incomplete_writes = 1;
+ break;
}
}
- return count;
-}
-
-
-size_t
-__wb_mark_wind_atmost_aggregate_size (list_head_t *list, list_head_t *winds,
- size_t aggregate_conf)
-{
- wb_request_t *request = NULL;
- struct iovec *vector = NULL;
- int32_t count = 0;
- size_t aggregate_current = 0, size = 0, length = 0;
-
- list_for_each_entry (request, list, list)
- {
- vector = request->stub->args.writev.vector;
- count = request->stub->args.writev.count;
- if (!request->flags.write_request.stack_wound) {
- length = iov_length (vector, count);
- size += length;
- aggregate_current += length;
-
- if (aggregate_current > aggregate_conf) {
- break;
- }
-
- request->flags.write_request.stack_wound = 1;
- list_add_tail (&request->winds, winds);
- }
- }
-
- return size;
-}
-
-size_t
-__wb_mark_wind_aggregate_size_aware (list_head_t *list, list_head_t *winds,
- size_t aggregate_conf)
-{
- size_t size = 0;
- size_t aggregate_current = 0;
-
- aggregate_current = __wb_get_aggregate_size (list, NULL, NULL);
- while (aggregate_current >= aggregate_conf) {
- size += __wb_mark_wind_atmost_aggregate_size (list, winds,
- aggregate_conf);
-
- aggregate_current = __wb_get_aggregate_size (list, NULL, NULL);
- }
-
- return size;
+ return incomplete_writes;
}
@@ -1202,25 +1154,22 @@ size_t
__wb_mark_winds (list_head_t *list, list_head_t *winds, size_t aggregate_conf,
char wind_all)
{
- size_t aggregate_current = 0;
- uint32_t incomplete_writes = 0;
+ size_t aggregate_current = 0, size = 0;
+ char incomplete_writes = 0;
char other_fop_in_queue = 0;
char non_contiguous_writes = 0;
- incomplete_writes = __wb_get_incomplete_writes (list);
+ incomplete_writes = __wb_any_incomplete_writes (list);
aggregate_current = __wb_get_aggregate_size (list, &other_fop_in_queue,
&non_contiguous_writes);
- if ((incomplete_writes == 0) || (wind_all) || (non_contiguous_writes)
- || (other_fop_in_queue)) {
- __wb_mark_wind_all (list, winds);
- } else if (aggregate_current >= aggregate_conf) {
- __wb_mark_wind_aggregate_size_aware (list, winds,
- aggregate_conf);
- }
+ if ((!incomplete_writes) || (wind_all) || (non_contiguous_writes)
+ || (other_fop_in_queue) || (aggregate_current >= aggregate_conf)) {
+ size = __wb_mark_wind_all (list, winds);
+ }
- return aggregate_current;
+ return size;
}