diff options
| author | Raghavendra G <raghavendra@gluster.com> | 2009-09-22 01:38:25 +0000 | 
|---|---|---|
| committer | Anand V. Avati <avati@dev.gluster.com> | 2009-09-22 06:13:14 -0700 | 
| commit | 32a6898678686df1b2c82a37e548170ba5c3512b (patch) | |
| tree | c6d3404d4dafaa300f74f793f25d7704ca12573a | |
| parent | 8a0d85eb936f9483a5d23d67cf5989351d5f86d7 (diff) | |
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 <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.c | 8 | 
1 files changed, 5 insertions, 3 deletions
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c index b38f1665b..34a48809e 100644 --- a/xlators/performance/write-behind/src/write-behind.c +++ b/xlators/performance/write-behind/src/write-behind.c @@ -370,7 +370,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; -        ssize_t         bytes = 0, current_size = 0; +        ssize_t         current_size = 0, bytes = 0;          size_t          bytecount = 0;          wb_conf_t      *conf = NULL;          fd_t           *fd   = NULL; @@ -378,8 +378,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 == 0) { @@ -460,6 +461,7 @@ wb_sync (call_frame_t *frame, wb_file_t *file, list_head_t *winds)                          fd_ref (fd); +                        bytes += current_size;                          STACK_WIND (sync_frame,                                      wb_sync_cbk,                                      FIRST_CHILD(sync_frame->this),  | 
