diff options
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/features/quota/src/quota.c | 10 | ||||
-rw-r--r-- | xlators/features/shard/src/shard.c | 10 | ||||
-rw-r--r-- | xlators/performance/io-cache/src/io-cache.c | 20 | ||||
-rw-r--r-- | xlators/performance/io-cache/src/page.c | 10 | ||||
-rw-r--r-- | xlators/performance/read-ahead/src/page.c | 10 | ||||
-rw-r--r-- | xlators/performance/write-behind/src/write-behind.c | 3 |
6 files changed, 13 insertions, 50 deletions
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index 1335386a197..c787028e7b3 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -1769,19 +1769,13 @@ quota_writev_helper(call_frame_t *frame, xlator_t *this, fd_t *fd, if ((op_errno == EDQUOT) && (local->space_available > 0)) { new_count = iov_subset(vector, count, 0, local->space_available, - NULL); - - new_vector = GF_CALLOC(new_count, sizeof(struct iovec), - gf_common_mt_iovec); - if (new_vector == NULL) { + &new_vector, 0); + if (new_count < 0) { local->op_ret = -1; local->op_errno = ENOMEM; goto unwind; } - new_count = iov_subset(vector, count, 0, local->space_available, - new_vector); - vector = new_vector; count = new_count; } else if (op_errno == ENOENT || op_errno == ESTALE) { diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c index b6908c39ef5..6e78e967214 100644 --- a/xlators/features/shard/src/shard.c +++ b/xlators/features/shard/src/shard.c @@ -5476,21 +5476,17 @@ shard_common_inode_write_do(call_frame_t *frame, xlator_t *this) remaining_size -= shard_write_size; if (local->fop == GF_FOP_WRITE) { + vec = NULL; count = iov_subset(local->vector, local->count, vec_offset, - vec_offset + shard_write_size, NULL); - - vec = GF_CALLOC(count, sizeof(struct iovec), gf_shard_mt_iovec); - if (!vec) { + shard_write_size, &vec, 0); + if (count < 0) { local->op_ret = -1; local->op_errno = ENOMEM; wind_failed = _gf_true; - GF_FREE(vec); shard_common_inode_write_do_cbk(frame, (void *)(long)0, this, -1, ENOMEM, NULL, NULL, NULL); goto next; } - count = iov_subset(local->vector, local->count, vec_offset, - vec_offset + shard_write_size, vec); } if (cur_block == 0) { diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c index 95ba2e19b9e..711afdf700d 100644 --- a/xlators/performance/io-cache/src/io-cache.c +++ b/xlators/performance/io-cache/src/io-cache.c @@ -87,14 +87,6 @@ ioc_update_pages(call_frame_t *frame, ioc_inode_t *ioc_inode, write_offset = 0; off_t page_offset = 0, page_end = 0; ioc_page_t *trav = NULL; - struct iovec pagevector = - { - 0, - }, - writevector = { - 0, - }; - int pvcount = 0, wvcount; size = iov_length(vector, count); size = min(size, op_ret); @@ -120,16 +112,8 @@ ioc_update_pages(call_frame_t *frame, ioc_inode_t *ioc_inode, page_end = trav->size; } - wvcount = iov_subset(vector, count, write_offset, - write_offset + (page_end - page_offset), - &writevector); - if (wvcount) { - pvcount = iov_subset(trav->vector, trav->count, page_offset, - page_end, &pagevector); - if (pvcount) { - iov_copy(&pagevector, pvcount, &writevector, wvcount); - } - } + iov_range_copy(trav->vector, trav->count, page_offset, vector, + count, write_offset, page_end - page_offset); } else if (trav) { if (!trav->waitq) ioc_inode->table->cache_used -= __ioc_page_destroy(trav); diff --git a/xlators/performance/io-cache/src/page.c b/xlators/performance/io-cache/src/page.c index 4a9679cf0ce..69b4fc0573f 100644 --- a/xlators/performance/io-cache/src/page.c +++ b/xlators/performance/io-cache/src/page.c @@ -727,11 +727,8 @@ __ioc_frame_fill(ioc_page_t *page, call_frame_t *frame, off_t offset, new->size = copy_size; new->iobref = iobref_ref(page->iobref); new->count = iov_subset(page->vector, page->count, src_offset, - src_offset + copy_size, NULL); - - new->vector = GF_CALLOC(new->count, sizeof(struct iovec), - gf_ioc_mt_iovec); - if (new->vector == NULL) { + copy_size, &new->vector, 0); + if (new->count < 0) { local->op_ret = -1; local->op_errno = ENOMEM; @@ -740,9 +737,6 @@ __ioc_frame_fill(ioc_page_t *page, call_frame_t *frame, off_t offset, goto out; } - new->count = iov_subset(page->vector, page->count, src_offset, - src_offset + copy_size, new->vector); - /* add the ioc_fill to fill_list for this frame */ if (list_empty(&local->fill_list)) { /* if list is empty, then this is the first diff --git a/xlators/performance/read-ahead/src/page.c b/xlators/performance/read-ahead/src/page.c index 344026352f9..8a58ad8bb7a 100644 --- a/xlators/performance/read-ahead/src/page.c +++ b/xlators/performance/read-ahead/src/page.c @@ -347,19 +347,15 @@ ra_frame_fill(ra_page_t *page, call_frame_t *frame) new->size = copy_size; new->iobref = iobref_ref(page->iobref); new->count = iov_subset(page->vector, page->count, src_offset, - src_offset + copy_size, NULL); - new->vector = GF_CALLOC(new->count, sizeof(struct iovec), - gf_ra_mt_iovec); - if (new->vector == NULL) { + copy_size, &new->vector, 0); + if (new->count < 0) { local->op_ret = -1; local->op_errno = ENOMEM; + iobref_unref(new->iobref); GF_FREE(new); goto out; } - new->count = iov_subset(page->vector, page->count, src_offset, - src_offset + copy_size, new->vector); - new->next = fill; new->prev = new->next->prev; new->next->prev = new; diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c index 70e281a3c79..aade1c9c563 100644 --- a/xlators/performance/write-behind/src/write-behind.c +++ b/xlators/performance/write-behind/src/write-behind.c @@ -971,8 +971,7 @@ __wb_modify_write_request(wb_request_t *req, int synced_size) vector = req->stub->args.vector; count = req->stub->args.count; - req->stub->args.count = iov_subset(vector, count, synced_size, - iov_length(vector, count), vector); + req->stub->args.count = iov_skip(vector, count, synced_size); out: return; |