From 4749db6e47ad0fa624e49c5ed3766c77335f68c7 Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Mon, 21 Sep 2009 09:51:35 +0000 Subject: performance/write-behind: remove redundant traversal of write-requests in the wind list in wb_sync. - no need of getting the total_count of number of requests in the list. Even if there is a single request, we need to sync it. Signed-off-by: Anand V. Avati BUG: 276 (write behind needs to be optimized.) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=276 --- xlators/performance/write-behind/src/write-behind.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'xlators/performance/write-behind/src') diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c index 463b9ccb3..27f824d07 100644 --- a/xlators/performance/write-behind/src/write-behind.c +++ b/xlators/performance/write-behind/src/write-behind.c @@ -352,7 +352,7 @@ wb_sync (call_frame_t *frame, wb_file_t *file, list_head_t *winds) struct iobref *iobref = NULL; wb_local_t *local = NULL; struct iovec *vector = NULL; - size_t bytes = 0, current_size = 0; + size_t current_size = 0, bytes = 0; size_t bytecount = 0; wb_conf_t *conf = NULL; fd_t *fd = NULL; @@ -360,8 +360,9 @@ wb_sync (call_frame_t *frame, wb_file_t *file, list_head_t *winds) conf = file->this->private; list_for_each_entry (request, winds, winds) { total_count += request->stub->args.writev.count; - bytes += iov_length (request->stub->args.writev.vector, - request->stub->args.writev.count); + if (total_count > 0) { + break; + } } if (!total_count) { @@ -438,6 +439,7 @@ wb_sync (call_frame_t *frame, wb_file_t *file, list_head_t *winds) iobref = NULL; vector = NULL; copied = count = 0; + bytes += current_size; } } -- cgit