summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--xlators/performance/Makefile.am2
-rw-r--r--xlators/performance/quick-read/Makefile.am3
-rw-r--r--xlators/performance/quick-read/src/Makefile.am14
-rw-r--r--xlators/performance/quick-read/src/quick-read.c116
-rw-r--r--xlators/performance/quick-read/src/quick-read.h50
6 files changed, 186 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 1d72047ceab..630ace3ac45 100644
--- a/configure.ac
+++ b/configure.ac
@@ -74,6 +74,8 @@ AC_CONFIG_FILES([Makefile
xlators/performance/io-cache/src/Makefile
xlators/performance/symlink-cache/Makefile
xlators/performance/symlink-cache/src/Makefile
+ xlators/performance/quick-read/Makefile
+ xlators/performance/quick-read/src/Makefile
xlators/debug/Makefile
xlators/debug/trace/Makefile
xlators/debug/trace/src/Makefile
diff --git a/xlators/performance/Makefile.am b/xlators/performance/Makefile.am
index f7504bbe8f3..6b5facca51e 100644
--- a/xlators/performance/Makefile.am
+++ b/xlators/performance/Makefile.am
@@ -1,3 +1,3 @@
-SUBDIRS = write-behind read-ahead io-threads io-cache symlink-cache
+SUBDIRS = write-behind read-ahead io-threads io-cache symlink-cache quick-read
CLEANFILES =
diff --git a/xlators/performance/quick-read/Makefile.am b/xlators/performance/quick-read/Makefile.am
new file mode 100644
index 00000000000..d471a3f9243
--- /dev/null
+++ b/xlators/performance/quick-read/Makefile.am
@@ -0,0 +1,3 @@
+SUBDIRS = src
+
+CLEANFILES =
diff --git a/xlators/performance/quick-read/src/Makefile.am b/xlators/performance/quick-read/src/Makefile.am
new file mode 100644
index 00000000000..644f27e3f74
--- /dev/null
+++ b/xlators/performance/quick-read/src/Makefile.am
@@ -0,0 +1,14 @@
+xlator_LTLIBRARIES = quick-read.la
+xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/performance
+
+quick_read_la_LDFLAGS = -module -avoidversion
+
+quick_read_la_SOURCES = quick-read.c
+quick_read_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
+
+noinst_HEADERS = quick-read.h
+
+AM_CFLAGS = -fPIC -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -Wall -D$(GF_HOST_OS)\
+ -I$(top_srcdir)/libglusterfs/src -shared -nostartfiles $(GF_CFLAGS)
+
+CLEANFILES =
diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c
new file mode 100644
index 00000000000..4e85e6f377f
--- /dev/null
+++ b/xlators/performance/quick-read/src/quick-read.c
@@ -0,0 +1,116 @@
+/*
+ Copyright (c) 2009-2010 Z RESEARCH, Inc. <http://www.zresearch.com>
+ This file is part of GlusterFS.
+
+ GlusterFS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ GlusterFS is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+#include "quick-read.h"
+
+
+int32_t
+init (xlator_t *this)
+{
+ char *str = NULL;
+ int32_t ret = -1;
+ qr_conf_t *conf = NULL;
+
+ if (!this->children || this->children->next) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "FATAL: volume (%s) not configured with exactly one "
+ "child", this->name);
+ return -1;
+ }
+
+ if (!this->parents) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "dangling volume. check volfile ");
+ }
+
+ conf = CALLOC (1, sizeof (*conf));
+ if (conf == NULL) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "out of memory");
+ ret = -1;
+ goto out;
+ }
+
+ ret = dict_get_str (this->options, "max-file-size",
+ &str);
+ if (ret == 0) {
+ ret = gf_string2bytesize (str, &conf->max_file_size);
+ if (ret != 0) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "invalid number format \"%s\" of \"option "
+ "max-file-size\"",
+ str);
+ ret = -1;
+ goto out;
+ }
+ }
+
+ conf->cache_timeout = -1;
+ ret = dict_get_str (this->options, "cache-timeout", &str);
+ if (ret == 0) {
+ ret = gf_string2uint_base10 (str,
+ (unsigned int *)&conf->cache_timeout);
+ if (ret != 0) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "invalid cache-timeout value %s", str);
+ ret = -1;
+ goto out;
+ }
+ }
+
+ this->private = conf;
+out:
+ if ((ret == -1) && conf) {
+ FREE (conf);
+ }
+
+ return ret;
+}
+
+
+void
+fini (xlator_t *this)
+{
+ return;
+}
+
+
+struct xlator_fops fops = {
+};
+
+
+struct xlator_mops mops = {
+};
+
+
+struct xlator_cbks cbks = {
+};
+
+struct volume_options options[] = {
+ { .key = {"cache-timeout"},
+ .type = GF_OPTION_TYPE_INT,
+ .min = 1,
+ .max = 60
+ },
+ { .key = {"max-file-size"},
+ .type = GF_OPTION_TYPE_SIZET,
+ .min = 0,
+ .max = 1 * GF_UNIT_MB
+ },
+};
diff --git a/xlators/performance/quick-read/src/quick-read.h b/xlators/performance/quick-read/src/quick-read.h
new file mode 100644
index 00000000000..d3f4ecf0ca2
--- /dev/null
+++ b/xlators/performance/quick-read/src/quick-read.h
@@ -0,0 +1,50 @@
+/*
+ Copyright (c) 2009-2010 Z RESEARCH, Inc. <http://www.zresearch.com>
+ This file is part of GlusterFS.
+
+ GlusterFS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ GlusterFS is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __QUICK_READ_H
+#define __QUICK_READ_H
+
+#ifndef _CONFIG_H
+#define _CONFIG_H
+#include "config.h"
+#endif
+
+#include "glusterfs.h"
+#include "logging.h"
+#include "dict.h"
+#include "xlator.h"
+#include "list.h"
+#include "compat.h"
+#include "compat-errno.h"
+#include "common-utils.h"
+#include "call-stub.h"
+#include "defaults.h"
+#include <libgen.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+struct qr_conf {
+ uint64_t max_file_size;
+ int32_t cache_timeout;
+};
+typedef struct qr_conf qr_conf_t;
+
+#endif /* #ifndef __QUICK_READ_H */