summaryrefslogtreecommitdiffstats
path: root/xlators/performance
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/performance')
-rw-r--r--xlators/performance/io-cache/src/io-cache.c10
-rw-r--r--xlators/performance/io-cache/src/page.c2
-rw-r--r--xlators/performance/io-threads/src/io-threads.c16
-rw-r--r--xlators/performance/quick-read/src/quick-read.c192
-rw-r--r--xlators/performance/read-ahead/src/page.c2
-rw-r--r--xlators/performance/read-ahead/src/read-ahead.c12
-rw-r--r--xlators/performance/stat-prefetch/src/stat-prefetch.c8
-rw-r--r--xlators/performance/write-behind/src/write-behind.c18
8 files changed, 122 insertions, 138 deletions
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c
index 65df006cfe4..0ab36454c86 100644
--- a/xlators/performance/io-cache/src/io-cache.c
+++ b/xlators/performance/io-cache/src/io-cache.c
@@ -1087,7 +1087,7 @@ out:
*/
int32_t
ioc_readv (call_frame_t *frame, xlator_t *this, fd_t *fd,
- size_t size, off_t offset)
+ size_t size, off_t offset, uint32_t flags)
{
uint64_t tmp_ioc_inode = 0;
ioc_inode_t *ioc_inode = NULL;
@@ -1108,7 +1108,7 @@ ioc_readv (call_frame_t *frame, xlator_t *this, fd_t *fd,
STACK_WIND (frame, ioc_readv_disabled_cbk,
FIRST_CHILD (frame->this),
FIRST_CHILD (frame->this)->fops->readv, fd, size,
- offset);
+ offset, flags);
return 0;
}
@@ -1167,7 +1167,7 @@ ioc_readv (call_frame_t *frame, xlator_t *this, fd_t *fd,
STACK_WIND (frame, ioc_readv_disabled_cbk,
FIRST_CHILD (frame->this),
FIRST_CHILD (frame->this)->fops->readv, fd, size,
- offset);
+ offset, flags);
return 0;
}
@@ -1251,7 +1251,7 @@ ioc_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t
ioc_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
struct iovec *vector, int32_t count, off_t offset,
- struct iobref *iobref)
+ uint32_t flags, struct iobref *iobref)
{
ioc_local_t *local = NULL;
uint64_t ioc_inode = 0;
@@ -1274,7 +1274,7 @@ ioc_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
STACK_WIND (frame, ioc_writev_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->writev, fd, vector, count, offset,
- iobref);
+ flags, iobref);
return 0;
}
diff --git a/xlators/performance/io-cache/src/page.c b/xlators/performance/io-cache/src/page.c
index 9afaf306235..93c4a51de3e 100644
--- a/xlators/performance/io-cache/src/page.c
+++ b/xlators/performance/io-cache/src/page.c
@@ -630,7 +630,7 @@ ioc_page_fault (ioc_inode_t *ioc_inode, call_frame_t *frame, fd_t *fd,
STACK_WIND (fault_frame, ioc_fault_cbk, FIRST_CHILD(fault_frame->this),
FIRST_CHILD(fault_frame->this)->fops->readv, fd,
- table->page_size, offset);
+ table->page_size, offset, 0);
return;
err:
diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c
index 2402f86d9f6..d3196d50b03 100644
--- a/xlators/performance/io-threads/src/io-threads.c
+++ b/xlators/performance/io-threads/src/io-threads.c
@@ -904,24 +904,24 @@ iot_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
iot_readv_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
- off_t offset)
+ off_t offset, uint32_t flags)
{
STACK_WIND (frame, iot_readv_cbk,
FIRST_CHILD(this),
FIRST_CHILD(this)->fops->readv,
- fd, size, offset);
+ fd, size, offset, flags);
return 0;
}
int
iot_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
- off_t offset)
+ off_t offset, uint32_t flags)
{
call_stub_t *stub = NULL;
int ret = -1;
- stub = fop_readv_stub (frame, iot_readv_wrapper, fd, size, offset);
+ stub = fop_readv_stub (frame, iot_readv_wrapper, fd, size, offset, flags);
if (!stub) {
gf_log (this->name, GF_LOG_ERROR,
"cannot create readv call stub"
@@ -1056,12 +1056,12 @@ iot_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
iot_writev_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd,
struct iovec *vector, int32_t count,
- off_t offset, struct iobref *iobref)
+ off_t offset, uint32_t flags, struct iobref *iobref)
{
STACK_WIND (frame, iot_writev_cbk,
FIRST_CHILD(this),
FIRST_CHILD(this)->fops->writev,
- fd, vector, count, offset, iobref);
+ fd, vector, count, offset, flags, iobref);
return 0;
}
@@ -1069,13 +1069,13 @@ iot_writev_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd,
int
iot_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
struct iovec *vector, int32_t count, off_t offset,
- struct iobref *iobref)
+ uint32_t flags, struct iobref *iobref)
{
call_stub_t *stub = NULL;
int ret = -1;
stub = fop_writev_stub (frame, iot_writev_wrapper,
- fd, vector, count, offset, iobref);
+ fd, vector, count, offset, flags, iobref);
if (!stub) {
gf_log (this->name, GF_LOG_ERROR,
diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c
index 6c9a0f0e5b5..14ff58b5157 100644
--- a/xlators/performance/quick-read/src/quick-read.c
+++ b/xlators/performance/quick-read/src/quick-read.c
@@ -48,7 +48,7 @@ out:
int32_t
qr_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
- off_t offset);
+ off_t offset, uint32_t flags);
static void
@@ -1026,7 +1026,7 @@ qr_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t
qr_readv_helper (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
- off_t offset)
+ off_t offset, uint32_t flags)
{
qr_local_t *local = NULL;
int32_t op_errno = EINVAL, ret = 0;
@@ -1055,7 +1055,7 @@ qr_readv_helper (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
}
STACK_WIND (frame, qr_readv_cbk, FIRST_CHILD (this),
- FIRST_CHILD (this)->fops->readv, fd, size, offset);
+ FIRST_CHILD (this)->fops->readv, fd, size, offset, flags);
return 0;
unwind:
@@ -1066,7 +1066,7 @@ unwind:
int32_t
qr_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
- off_t offset)
+ off_t offset, uint32_t read_flags)
{
qr_inode_t *qr_inode = NULL;
int32_t ret = -1, op_ret = -1, op_errno = -1;
@@ -1120,108 +1120,91 @@ qr_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
LOCK (&table->lock);
{
ret = inode_ctx_get (fd->inode, this, &value);
- if (ret == 0) {
- qr_inode = (qr_inode_t *)(long)value;
- if (qr_inode) {
- if (qr_inode->xattr){
- if (!just_validated
- && qr_need_validation (conf,
- qr_inode)) {
- need_validation = 1;
- goto unlock;
- }
+ if (ret)
+ goto unlock;
- content = dict_get (qr_inode->xattr,
- GF_CONTENT_KEY);
+ qr_inode = (qr_inode_t *)(long)value;
+ if (!qr_inode || !qr_inode->xattr)
+ goto unlock;
- stbuf = qr_inode->stbuf;
- content_cached = 1;
- list_move_tail (&qr_inode->lru,
- &table->lru[qr_inode->priority]);
-
- if (offset > content->len) {
- op_ret = 0;
- end = content->len;
- } else {
- if ((offset + size)
- > content->len) {
- op_ret = content->len
- - offset;
- end = content->len;
- } else {
- op_ret = size;
- end = offset + size;
- }
- }
+ if (!just_validated
+ && qr_need_validation (conf, qr_inode)) {
+ need_validation = 1;
+ goto unlock;
+ }
- count = (op_ret
- / iobuf_pool->default_page_size);
- if ((op_ret % iobuf_pool->default_page_size)
- != 0) {
- count++;
- }
+ content = dict_get (qr_inode->xattr, GF_CONTENT_KEY);
- if (count == 0) {
- op_ret = 0;
- goto unlock;
- }
+ stbuf = qr_inode->stbuf;
+ content_cached = 1;
+ list_move_tail (&qr_inode->lru,
+ &table->lru[qr_inode->priority]);
- vector = GF_CALLOC (count,
- sizeof (*vector),
- gf_qr_mt_iovec);
- if (vector == NULL) {
- op_ret = -1;
- op_errno = ENOMEM;
- need_unwind = 1;
- goto unlock;
- }
+ if (offset > content->len) {
+ op_ret = 0;
+ end = content->len;
+ } else {
+ if ((offset + size) > content->len) {
+ op_ret = content->len - offset;
+ end = content->len;
+ } else {
+ op_ret = size;
+ end = offset + size;
+ }
+ }
- iobref = iobref_new ();
- if (iobref == NULL) {
- op_ret = -1;
- op_errno = ENOMEM;
- need_unwind = 1;
- goto unlock;
- }
+ count = (op_ret / iobuf_pool->default_page_size);
+ if ((op_ret % iobuf_pool->default_page_size) != 0) {
+ count++;
+ }
- for (i = 0; i < count; i++) {
- iobuf = iobuf_get (iobuf_pool);
- if (iobuf == NULL) {
- op_ret = -1;
- op_errno = ENOMEM;
- need_unwind = 1;
- goto unlock;
- }
+ if (count == 0) {
+ op_ret = 0;
+ goto unlock;
+ }
- start = offset
- +
- (iobuf_pool->default_page_size
- * i);
-
- if (start > end) {
- len = 0;
- } else {
- len =
- (iobuf_pool->default_page_size
- > (end - start))
- ? (end - start)
- :
- iobuf_pool->default_page_size;
-
- memcpy (iobuf->ptr,
- content->data
- + start,
- len);
- }
+ vector = GF_CALLOC (count, sizeof (*vector), gf_qr_mt_iovec);
+ if (vector == NULL) {
+ op_ret = -1;
+ op_errno = ENOMEM;
+ need_unwind = 1;
+ goto unlock;
+ }
- iobref_add (iobref, iobuf);
- iobuf_unref (iobuf);
+ iobref = iobref_new ();
+ if (iobref == NULL) {
+ op_ret = -1;
+ op_errno = ENOMEM;
+ need_unwind = 1;
+ goto unlock;
+ }
- vector[i].iov_base = iobuf->ptr;
- vector[i].iov_len = len;
- }
- }
+ for (i = 0; i < count; i++) {
+ iobuf = iobuf_get (iobuf_pool);
+ if (iobuf == NULL) {
+ op_ret = -1;
+ op_errno = ENOMEM;
+ need_unwind = 1;
+ goto unlock;
+ }
+
+ start = offset + (iobuf_pool->default_page_size * i);
+
+ if (start > end) {
+ len = 0;
+ } else {
+ len = (iobuf_pool->default_page_size >
+ ((end - start)) ? (end - start) :
+ iobuf_pool->default_page_size);
+
+ memcpy (iobuf->ptr, content->data + start, len);
}
+
+ iobref_add (iobref, iobuf);
+ iobuf_unref (iobuf);
+
+ vector[i].iov_base = iobuf->ptr;
+ vector[i].iov_len = len;
}
}
unlock:
@@ -1233,7 +1216,8 @@ out:
count, &stbuf, iobref);
} else if (need_validation) {
- stub = fop_readv_stub (frame, qr_readv, fd, size, offset);
+ stub = fop_readv_stub (frame, qr_readv, fd, size, offset,
+ read_flags);
if (stub == NULL) {
op_ret = -1;
op_errno = ENOMEM;
@@ -1273,7 +1257,8 @@ out:
stub = fop_readv_stub (frame,
qr_readv_helper,
fd, size,
- offset);
+ offset,
+ read_flags);
if (stub == NULL) {
op_ret = -1;
op_errno = ENOMEM;
@@ -1319,9 +1304,8 @@ out:
} else if (can_wind) {
STACK_WIND (frame, qr_readv_cbk, FIRST_CHILD (this),
FIRST_CHILD (this)->fops->readv, fd, size,
- offset);
+ offset, read_flags);
}
-
}
ret:
@@ -1351,7 +1335,7 @@ qr_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t
qr_writev_helper (call_frame_t *frame, xlator_t *this, fd_t *fd,
struct iovec *vector, int32_t count, off_t off,
- struct iobref *iobref)
+ uint32_t flags, struct iobref *iobref)
{
qr_local_t *local = NULL;
qr_fd_ctx_t *fdctx = NULL;
@@ -1382,7 +1366,7 @@ qr_writev_helper (call_frame_t *frame, xlator_t *this, fd_t *fd,
STACK_WIND (frame, qr_writev_cbk, FIRST_CHILD (this),
FIRST_CHILD (this)->fops->writev, fd, vector, count, off,
- iobref);
+ flags, iobref);
return 0;
unwind:
@@ -1393,7 +1377,7 @@ unwind:
int32_t
qr_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector,
- int32_t count, off_t off, struct iobref *iobref)
+ int32_t count, off_t off, uint32_t wr_flags, struct iobref *iobref)
{
uint64_t value = 0;
int flags = 0;
@@ -1458,7 +1442,7 @@ qr_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector,
stub = fop_writev_stub (frame, qr_writev_helper,
fd, vector, count, off,
- iobref);
+ wr_flags, iobref);
if (stub == NULL) {
op_ret = -1;
op_errno = ENOMEM;
@@ -1482,7 +1466,7 @@ qr_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector,
} else if (can_wind) {
STACK_WIND (frame, qr_writev_cbk, FIRST_CHILD (this),
FIRST_CHILD (this)->fops->writev, fd, vector, count,
- off, iobref);
+ off, wr_flags, iobref);
} else if (need_open) {
op_ret = qr_loc_fill (&loc, fd->inode, path);
if (op_ret == -1) {
diff --git a/xlators/performance/read-ahead/src/page.c b/xlators/performance/read-ahead/src/page.c
index 0c9a61853c8..8aa55c065c5 100644
--- a/xlators/performance/read-ahead/src/page.c
+++ b/xlators/performance/read-ahead/src/page.c
@@ -278,7 +278,7 @@ ra_page_fault (ra_file_t *file, call_frame_t *frame, off_t offset)
STACK_WIND (fault_frame, ra_fault_cbk,
FIRST_CHILD (fault_frame->this),
FIRST_CHILD (fault_frame->this)->fops->readv,
- file->fd, file->page_size, offset);
+ file->fd, file->page_size, offset, 0);
return;
diff --git a/xlators/performance/read-ahead/src/read-ahead.c b/xlators/performance/read-ahead/src/read-ahead.c
index b77715490fe..f58c4078db9 100644
--- a/xlators/performance/read-ahead/src/read-ahead.c
+++ b/xlators/performance/read-ahead/src/read-ahead.c
@@ -449,7 +449,7 @@ dispatch_requests (call_frame_t *frame, ra_file_t *file)
STACK_WIND (ra_frame, ra_need_atime_cbk,
FIRST_CHILD (frame->this),
FIRST_CHILD (frame->this)->fops->readv,
- file->fd, 1, 1);
+ file->fd, 1, 1, 0);
}
out:
@@ -473,7 +473,7 @@ ra_readv_disabled_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
ra_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
- off_t offset)
+ off_t offset, uint32_t flags)
{
ra_file_t *file = NULL;
ra_local_t *local = NULL;
@@ -561,7 +561,7 @@ disabled:
STACK_WIND (frame, ra_readv_disabled_cbk,
FIRST_CHILD (frame->this),
FIRST_CHILD (frame->this)->fops->readv,
- fd, size, offset);
+ fd, size, offset, flags);
return 0;
}
@@ -666,7 +666,7 @@ ra_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
ra_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector,
- int32_t count, off_t offset, struct iobref *iobref)
+ int32_t count, off_t offset, uint32_t flags, struct iobref *iobref)
{
ra_file_t *file = NULL;
uint64_t tmp_file = 0;
@@ -688,7 +688,7 @@ ra_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector,
STACK_WIND (frame, ra_writev_cbk,
FIRST_CHILD(this),
FIRST_CHILD(this)->fops->writev,
- fd, vector, count, offset, iobref);
+ fd, vector, count, offset, flags, iobref);
return 0;
@@ -1030,12 +1030,10 @@ int
init (xlator_t *this)
{
ra_conf_t *conf = NULL;
- dict_t *options = NULL;
int32_t ret = -1;
GF_VALIDATE_OR_GOTO ("read-ahead", this, out);
- options = this->options;
if (!this->children || this->children->next) {
gf_log (this->name, GF_LOG_ERROR,
"FATAL: read-ahead not configured with exactly one"
diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c
index a760e97a9a5..25ed6fa57b9 100644
--- a/xlators/performance/stat-prefetch/src/stat-prefetch.c
+++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c
@@ -2793,7 +2793,7 @@ sp_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t
sp_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
- off_t offset)
+ off_t offset, uint32_t flags)
{
sp_fd_ctx_t *fd_ctx = NULL;
uint64_t value = 0;
@@ -2820,7 +2820,7 @@ sp_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
sp_remove_caches_from_all_fds_opened (this, parent, (char *)name);
STACK_WIND (frame, sp_readv_cbk, FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->readv, fd, size, offset);
+ FIRST_CHILD(this)->fops->readv, fd, size, offset, flags);
return 0;
unwind:
@@ -2831,7 +2831,7 @@ unwind:
int32_t
sp_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector,
- int32_t count, off_t off, struct iobref *iobref)
+ int32_t count, off_t off, uint32_t flags, struct iobref *iobref)
{
sp_fd_ctx_t *fd_ctx = NULL;
uint64_t value = 0;
@@ -2859,7 +2859,7 @@ sp_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector,
STACK_WIND (frame, sp_unlink_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->writev, fd, vector, count, off,
- iobref);
+ flags, iobref);
return 0;
unwind:
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c
index 52e03872026..7c666b40339 100644
--- a/xlators/performance/write-behind/src/write-behind.c
+++ b/xlators/performance/write-behind/src/write-behind.c
@@ -550,6 +550,7 @@ wb_sync (call_frame_t *frame, wb_file_t *file, list_head_t *winds)
FIRST_CHILD(sync_frame->this)->fops->writev,
fd, vector, count,
first_request->stub->args.writev.off,
+ first_request->stub->args.writev.flags,
iobref);
iobref_unref (iobref);
@@ -2071,7 +2072,7 @@ wb_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t
wb_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector,
- int32_t count, off_t offset, struct iobref *iobref)
+ int32_t count, off_t offset, uint32_t flags, struct iobref *iobref)
{
wb_file_t *file = NULL;
char wb_disabled = 0;
@@ -2139,7 +2140,7 @@ wb_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector,
if (wb_disabled) {
STACK_WIND (frame, wb_writev_cbk, FIRST_CHILD (frame->this),
FIRST_CHILD (frame->this)->fops->writev,
- fd, vector, count, offset, iobref);
+ fd, vector, count, offset, flags, iobref);
return 0;
}
@@ -2159,7 +2160,8 @@ wb_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector,
frame->local = local;
local->file = file;
- stub = fop_writev_stub (frame, NULL, fd, vector, count, offset, iobref);
+ stub = fop_writev_stub (frame, NULL, fd, vector, count, offset, flags,
+ iobref);
if (stub == NULL) {
op_errno = ENOMEM;
goto unwind;
@@ -2236,10 +2238,10 @@ wb_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
static int32_t
wb_readv_helper (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
- off_t offset)
+ off_t offset, uint32_t flags)
{
STACK_WIND (frame, wb_readv_cbk, FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->readv, fd, size, offset);
+ FIRST_CHILD(this)->fops->readv, fd, size, offset, flags);
return 0;
}
@@ -2247,7 +2249,7 @@ wb_readv_helper (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
int32_t
wb_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
- off_t offset)
+ off_t offset, uint32_t flags)
{
wb_file_t *file = NULL;
wb_local_t *local = NULL;
@@ -2286,7 +2288,7 @@ wb_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
frame->local = local;
if (file) {
stub = fop_readv_stub (frame, wb_readv_helper, fd, size,
- offset);
+ offset, flags);
if (stub == NULL) {
op_errno = ENOMEM;
goto unwind;
@@ -2307,7 +2309,7 @@ wb_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
} else {
STACK_WIND (frame, wb_readv_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->readv,
- fd, size, offset);
+ fd, size, offset, flags);
}
return 0;