summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/ec/src/ec-inode-write.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-write.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-write.c')
-rw-r--r--xlators/cluster/ec/src/ec-inode-write.c55
1 files changed, 17 insertions, 38 deletions
diff --git a/xlators/cluster/ec/src/ec-inode-write.c b/xlators/cluster/ec/src/ec-inode-write.c
index c0694531151..06a2fef8d17 100644
--- a/xlators/cluster/ec/src/ec-inode-write.c
+++ b/xlators/cluster/ec/src/ec-inode-write.c
@@ -1932,18 +1932,10 @@ void ec_wind_writev(ec_t * ec, ec_fop_data_t * fop, int32_t idx)
{
ec_trace("WIND", fop, "idx=%d", idx);
- struct iovec vector[fop->int32];
- struct iobuf_pool * pool = NULL;
+ struct iovec vector[1];
struct iobref * iobref = NULL;
struct iobuf * iobuf = NULL;
- uint8_t * ptr = NULL;
- ssize_t size = 0, slice = 0, pagesize = 0, maxsize = 0;
- int32_t count = 0;
-
- pool = fop->xl->ctx->iobuf_pool;
-
- pagesize = iobpool_default_pagesize(pool);
- maxsize = pagesize * ec->fragments;
+ ssize_t size = 0, bufsize = 0;
iobref = iobref_new();
if (iobref == NULL)
@@ -1951,43 +1943,30 @@ void ec_wind_writev(ec_t * ec, ec_fop_data_t * fop, int32_t idx)
goto out;
}
- ptr = fop->vector[0].iov_base;
size = fop->vector[0].iov_len;
+ bufsize = size / ec->fragments;
- count = 0;
- while (size > 0)
+ iobuf = iobuf_get2(fop->xl->ctx->iobuf_pool, bufsize);
+ if (iobuf == NULL)
{
- iobuf = iobuf_get(pool);
- if (iobuf == NULL)
- {
- goto out;
- }
- if (iobref_add(iobref, iobuf) != 0)
- {
- goto out;
- }
-
- slice = size;
- if (slice > maxsize)
- {
- slice = maxsize;
- }
-
- ec_method_encode(slice, ec->fragments, idx, ptr, iobuf->ptr);
- ptr += slice;
+ goto out;
+ }
+ if (iobref_add(iobref, iobuf) != 0)
+ {
+ goto out;
+ }
- vector[count].iov_base = iobuf->ptr;
- vector[count].iov_len = slice / ec->fragments;
- count++;
+ ec_method_encode(size, ec->fragments, idx, fop->vector[0].iov_base,
+ iobuf->ptr);
- iobuf_unref(iobuf);
+ vector[0].iov_base = iobuf->ptr;
+ vector[0].iov_len = bufsize;
- size -= slice;
- }
+ iobuf_unref(iobuf);
STACK_WIND_COOKIE(fop->frame, ec_writev_cbk, (void *)(uintptr_t)idx,
ec->xl_list[idx], ec->xl_list[idx]->fops->writev,
- fop->fd, vector, count, fop->offset / ec->fragments,
+ fop->fd, vector, 1, fop->offset / ec->fragments,
fop->uint32, iobref, fop->xdata);
iobref_unref(iobref);