summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/ec/src/ec-inode-read.c
diff options
context:
space:
mode:
authorXavier Hernandez <xhernandez@datalab.es>2014-07-08 17:52:57 +0200
committerVijay Bellur <vbellur@redhat.com>2014-08-02 00:23:24 -0700
commitf3204a06eb8156743110b1613b4b4b63b70572b6 (patch)
tree5123ac07ca0fa0d540f7193c2dcb978c4a0065f1 /xlators/cluster/ec/src/ec-inode-read.c
parentd9fbc8518962c8607cc741626c2e197098e749b5 (diff)
cluster/ec: Fix incorrect management of NFS requests
Some operations, specially those comming from NFS, do not use a regular fd and use an anonymous fd (i.e. a previous open call has not been sent). Any context information created during open or create will not be present on these fd's, so we simply return NULL for contexts of those fd. Also it seems that NFS can send write requests with a very big buffer (higher that the default value of 128 KB). Some changes have been made to correctly handle these large buffers. Change-Id: I281476bd0d2cbaad231822248d6a616fcf5d4003 BUG: 1122417 Signed-off-by: Xavier Hernandez <xhernandez@datalab.es> Reviewed-on: http://review.gluster.org/8367 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/cluster/ec/src/ec-inode-read.c')
-rw-r--r--xlators/cluster/ec/src/ec-inode-read.c71
1 files changed, 23 insertions, 48 deletions
diff --git a/xlators/cluster/ec/src/ec-inode-read.c b/xlators/cluster/ec/src/ec-inode-read.c
index 46f904cf321..484c5e40189 100644
--- a/xlators/cluster/ec/src/ec-inode-read.c
+++ b/xlators/cluster/ec/src/ec-inode-read.c
@@ -973,11 +973,10 @@ out:
int32_t ec_readv_rebuild(ec_t * ec, ec_fop_data_t * fop, ec_cbk_data_t * cbk)
{
ec_cbk_data_t * ans = NULL;
- struct iobuf_pool * pool = NULL;
struct iobref * iobref = NULL;
struct iobuf * iobuf = NULL;
uint8_t * ptr = NULL, * buff = NULL;
- size_t fsize = 0, size = 0, max = 0, slice = 0;
+ size_t fsize = 0, size = 0, max = 0;
int32_t i = 0;
if (cbk->op_ret < 0)
@@ -989,7 +988,7 @@ int32_t ec_readv_rebuild(ec_t * ec, ec_fop_data_t * fop, ec_cbk_data_t * cbk)
if (cbk->op_ret > 0)
{
- struct iovec vector[cbk->int32 * cbk->count];
+ struct iovec vector[1];
uint8_t * blocks[cbk->count];
uint32_t values[cbk->count];
@@ -1001,50 +1000,33 @@ int32_t ec_readv_rebuild(ec_t * ec, ec_fop_data_t * fop, ec_cbk_data_t * cbk)
goto out;
}
buff = GF_ALIGN_BUF(ptr, EC_BUFFER_ALIGN_SIZE);
+ for (i = 0, ans = cbk; ans != NULL; i++, ans = ans->next)
+ {
+ values[i] = ans->idx;
+ blocks[i] = buff;
+ buff += ec_iov_copy_to(buff, ans->vector, ans->int32, 0, fsize);
+ }
iobref = iobref_new();
if (iobref == NULL)
{
goto out;
}
-
- for (i = 0, ans = cbk; ans != NULL; i++, ans = ans->next)
+ iobuf = iobuf_get2(fop->xl->ctx->iobuf_pool, size);
+ if (iobuf == NULL)
{
- values[i] = ans->idx;
- blocks[i] = buff;
- buff += ec_iov_copy_to(buff, ans->vector, ans->int32, 0, fsize);
+ goto out;
}
-
- pool = fop->xl->ctx->iobuf_pool;
- max = iobpool_default_pagesize(pool) / ec->stripe_size;
- max *= ec->fragment_size;
- i = 0;
- do
+ if (iobref_add(iobref, iobuf) != 0)
{
- iobuf = iobuf_get(pool);
- if (iobuf == NULL)
- {
- goto out;
- }
- if (iobref_add(iobref, iobuf) != 0)
- {
- goto out;
- }
-
- slice = fsize;
- if (slice > max)
- {
- slice = max;
- }
- fsize -= slice;
+ goto out;
+ }
- vector[i].iov_base = iobuf->ptr;
- vector[i].iov_len = ec_method_decode(slice, ec->fragments, values,
- blocks, iobuf->ptr);
- i++;
+ vector[0].iov_base = iobuf->ptr;
+ vector[0].iov_len = ec_method_decode(fsize, ec->fragments, values,
+ blocks, iobuf->ptr);
- iobuf_unref(iobuf);
- } while (fsize > 0);
+ iobuf_unref(iobuf);
GF_FREE(ptr);
ptr = NULL;
@@ -1063,27 +1045,20 @@ int32_t ec_readv_rebuild(ec_t * ec, ec_fop_data_t * fop, ec_cbk_data_t * cbk)
max = fop->user_size;
}
size -= fop->head;
- while (size > max)
+ if (size > max)
{
- if (size - max >= vector[i - 1].iov_len)
- {
- size -= vector[--i].iov_len;
- }
- else
- {
- vector[i - 1].iov_len -= size - max;
- size = max;
- }
+ vector[0].iov_len -= size - max;
+ size = max;
}
cbk->op_ret = size;
- cbk->int32 = i;
+ cbk->int32 = 1;
iobref_unref(cbk->buffers);
cbk->buffers = iobref;
GF_FREE(cbk->vector);
- cbk->vector = iov_dup(vector, i);
+ cbk->vector = iov_dup(vector, 1);
if (cbk->vector == NULL)
{
cbk->op_ret = -1;