diff options
-rw-r--r-- | xlators/cluster/stripe/src/stripe.c | 4 | ||||
-rw-r--r-- | xlators/encryption/crypt/src/atom.c | 4 | ||||
-rw-r--r-- | xlators/encryption/crypt/src/crypt.c | 16 | ||||
-rw-r--r-- | xlators/encryption/crypt/src/crypt.h | 10 | ||||
-rw-r--r-- | xlators/encryption/crypt/src/data.c | 6 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-rpc-fops.c | 9 |
6 files changed, 16 insertions, 33 deletions
diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index fb10fd2a302..67006ab06b6 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -3674,9 +3674,7 @@ stripe_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, STRIPE_VALIDATE_FCTX (fctx, err); /* File has to be stripped across the child nodes */ - for (idx = 0; idx< count; idx ++) { - total_size += vector[idx].iov_len; - } + total_size = iov_length (vector, count); remaining_size = total_size; local = mem_get0 (this->local_pool); diff --git a/xlators/encryption/crypt/src/atom.c b/xlators/encryption/crypt/src/atom.c index 21d63e5d6d6..6d7b351b370 100644 --- a/xlators/encryption/crypt/src/atom.c +++ b/xlators/encryption/crypt/src/atom.c @@ -502,7 +502,7 @@ static int32_t rmw_partial_block(call_frame_t *frame, #endif set_local_io_params_writev(frame, object, atom, atom->offset_at(frame, object), - iovec_get_size(partial, 1)); + iov_length(partial, 1)); /* * write the whole block to disk */ @@ -522,7 +522,7 @@ static int32_t rmw_partial_block(call_frame_t *frame, gf_log("crypt", GF_LOG_DEBUG, "submit partial block: %d bytes from %d offset", - (int)iovec_get_size(partial, 1), + (int)iov_length(partial, 1), (int)atom->offset_at(frame, object)); exit: return 0; diff --git a/xlators/encryption/crypt/src/crypt.c b/xlators/encryption/crypt/src/crypt.c index 2982bb26db0..0dd076bd897 100644 --- a/xlators/encryption/crypt/src/crypt.c +++ b/xlators/encryption/crypt/src/crypt.c @@ -148,7 +148,7 @@ static void check_read(call_frame_t *frame, xlator_t *this, int32_t read, if (read <= 0) return; - if (read != iovec_get_size(vec, count)) + if (read != iov_length(vec, count)) gf_log ("crypt", GF_LOG_DEBUG, "op_ret differs from amount of read bytes"); @@ -340,8 +340,8 @@ int32_t crypt_readv_cbk(call_frame_t *frame, object_alg_should_pad(object)) gf_log(this->name, GF_LOG_DEBUG, "Bad offset in tail %d", conf->off_in_tail); - if (iovec_get_size(vec, count) != 0 && - in_same_lblock(conf->orig_offset + iovec_get_size(vec, count) - 1, + if (iov_length(vec, count) != 0 && + in_same_lblock(conf->orig_offset + iov_length(vec, count) - 1, local->cur_file_size - 1, object_alg_blkbits(object))) { gf_log(this->name, GF_LOG_DEBUG, "Compound last cblock"); @@ -1083,7 +1083,7 @@ int crypt_writev(call_frame_t *frame, struct gf_flock lock = {0, }; #if DEBUG_CRYPT gf_log ("crypt", GF_LOG_DEBUG, "writing %d bytes from offset %llu", - (int)iovec_get_size(vec, count), (long long)offset); + (int)iov_length(vec, count), (long long)offset); #endif local = crypt_alloc_local(frame, this, GF_FOP_WRITE); if (!local) { @@ -1113,11 +1113,11 @@ int crypt_writev(call_frame_t *frame, ret = EINVAL; goto error; } - if (iovec_get_size(vec, count) == 0) + if (iov_length(vec, count) == 0) goto trivial; ret = prepare_for_submit_data(frame, this, offset, - iovec_get_size(vec, count), + iov_length(vec, count), vec, count, 0 /* don't setup gup in tail: we don't know file size yet */); @@ -1403,7 +1403,7 @@ static int32_t prune_write(call_frame_t *frame, /* * At first, uptodate head block */ - if (iovec_get_size(vec, count) < conf->off_in_head) { + if (iov_length(vec, count) < conf->off_in_head) { gf_log(this->name, GF_LOG_WARNING, "Failed to uptodate head block for prune"); local->op_ret = -1; @@ -3454,7 +3454,7 @@ static int32_t __crypt_readv_done(call_frame_t *frame, gf_log("crypt", GF_LOG_DEBUG, "readv: ret_to_user: %d, iovec len: %d, ia_size: %llu", (int)(local->rw_count > 0 ? local->rw_count : local->op_ret), - (int)(local->rw_count > 0 ? iovec_get_size(avec, local->data_conf.acount) : 0), + (int)(local->rw_count > 0 ? iov_length(avec, local->data_conf.acount) : 0), (unsigned long long)local->buf.ia_size); STACK_UNWIND_STRICT(readv, diff --git a/xlators/encryption/crypt/src/crypt.h b/xlators/encryption/crypt/src/crypt.h index c1bfe3fcd0c..6c014535f0a 100644 --- a/xlators/encryption/crypt/src/crypt.h +++ b/xlators/encryption/crypt/src/crypt.h @@ -465,7 +465,6 @@ void submit_full(call_frame_t *frame, xlator_t *this); /* crypt.c */ end_writeback_handler_t dispatch_end_writeback(glusterfs_fop_t fop); -static size_t iovec_get_size(struct iovec *vec, uint32_t count); void set_local_io_params_writev(call_frame_t *frame, struct object_cipher_info *object, struct rmw_atom *atom, off_t io_offset, @@ -479,15 +478,6 @@ void rename_unwind(call_frame_t *frame); /* Inline functions */ -static inline size_t iovec_get_size(struct iovec *vec, uint32_t count) -{ - int i; - size_t size = 0; - for (i = 0; i < count; i++) - size += vec[i].iov_len; - return size; -} - static inline int32_t crypt_xlator_id(void) { return CRYPT_XLATOR_ID; diff --git a/xlators/encryption/crypt/src/data.c b/xlators/encryption/crypt/src/data.c index 2f96ed2bab5..8b467bf2c60 100644 --- a/xlators/encryption/crypt/src/data.c +++ b/xlators/encryption/crypt/src/data.c @@ -281,8 +281,8 @@ static void check_iovecs(struct iovec *vec, int cnt, char *s1, *s2; uint32_t size, asize; - size = iovec_get_size(vec, cnt); - asize = iovec_get_size(avec, acnt) - off_in_head; + size = iov_length(vec, cnt); + asize = iov_length(avec, acnt) - off_in_head; if (size != asize) { gf_log("crypt", GF_LOG_DEBUG, "size %d is not eq asize %d", size, asize); @@ -379,7 +379,7 @@ int32_t align_iov_by_atoms(xlator_t *this, size_t to_process; /* number of vec's bytes to copy and(or) re-use */ int32_t off_in_head = conf->off_in_head; - to_process = iovec_get_size(vec, count); + to_process = iov_length(vec, count); while (to_process > 0) { if (off_in_head || diff --git a/xlators/protocol/server/src/server-rpc-fops.c b/xlators/protocol/server/src/server-rpc-fops.c index 0ba4ffa6f94..3b7f4e61f11 100644 --- a/xlators/protocol/server/src/server-rpc-fops.c +++ b/xlators/protocol/server/src/server-rpc-fops.c @@ -4218,10 +4218,7 @@ server3_3_writev (rpcsvc_request_t *req) = req->msg[i]; } - len = 0; - for (i = 0; i < state->payload_count; i++) { - len += state->payload_vector[i].iov_len; - } + len = iov_length (state->payload_vector, state->payload_count); GF_ASSERT (state->size == len); @@ -6817,9 +6814,7 @@ server3_3_compound (rpcsvc_request_t *req) = req->msg[i]; } - for (i = 0; i < state->payload_count; i++) { - state->size += state->payload_vector[i].iov_len; - } + state->size = iov_length (state->payload_vector, state->payload_count); ret = server_get_compound_resolve (state, &args); |