|
|
887953 |
From 668b55b7dd86b23e635cfb2264bc5e50f4cd888d Mon Sep 17 00:00:00 2001
|
|
|
887953 |
From: Krutika Dhananjay <kdhananj@redhat.com>
|
|
|
887953 |
Date: Tue, 9 Jan 2018 15:11:00 +0530
|
|
|
887953 |
Subject: [PATCH 461/493] mount/fuse: Add support for multi-threaded fuse
|
|
|
887953 |
readers
|
|
|
887953 |
|
|
|
887953 |
> Upstream: https://review.gluster.org/19226
|
|
|
887953 |
> Github issue #412
|
|
|
887953 |
> Change-Id: I94aa1505e5ae6a133683d473e0e4e0edd139b76b
|
|
|
887953 |
|
|
|
887953 |
Usage: Use 'reader-thread-count=<NUM>' as command line option to
|
|
|
887953 |
set the thread count at the time of mounting the volume.
|
|
|
887953 |
|
|
|
887953 |
Next task is to make these threads auto-scale based on the load,
|
|
|
887953 |
instead of having the user remount the volume everytime to change
|
|
|
887953 |
the thread count.
|
|
|
887953 |
|
|
|
887953 |
Change-Id: I94aa1505e5ae6a133683d473e0e4e0edd139b76b
|
|
|
887953 |
BUG: 1651040
|
|
|
887953 |
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
|
|
|
887953 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/158514
|
|
|
887953 |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
887953 |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
887953 |
---
|
|
|
887953 |
glusterfsd/src/glusterfsd.c | 26 ++++
|
|
|
887953 |
glusterfsd/src/glusterfsd.h | 1 +
|
|
|
887953 |
libglusterfs/src/glusterfs.h | 1 +
|
|
|
887953 |
xlators/mount/fuse/src/fuse-bridge.c | 231 ++++++++++++++++++----------
|
|
|
887953 |
xlators/mount/fuse/src/fuse-bridge.h | 9 +-
|
|
|
887953 |
xlators/mount/fuse/src/fuse-helpers.c | 3 +
|
|
|
887953 |
xlators/mount/fuse/src/fuse-mem-types.h | 1 +
|
|
|
887953 |
xlators/mount/fuse/utils/mount.glusterfs.in | 7 +
|
|
|
887953 |
8 files changed, 196 insertions(+), 83 deletions(-)
|
|
|
887953 |
|
|
|
887953 |
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
|
|
|
887953 |
index 78f3719..03bca24 100644
|
|
|
887953 |
--- a/glusterfsd/src/glusterfsd.c
|
|
|
887953 |
+++ b/glusterfsd/src/glusterfsd.c
|
|
|
887953 |
@@ -238,6 +238,8 @@ static struct argp_option gf_options[] = {
|
|
|
887953 |
"Enable localtime logging"},
|
|
|
887953 |
{"event-history", ARGP_FUSE_EVENT_HISTORY_KEY, "BOOL",
|
|
|
887953 |
OPTION_ARG_OPTIONAL, "disable/enable fuse event-history"},
|
|
|
887953 |
+ {"reader-thread-count", ARGP_READER_THREAD_COUNT_KEY, "INTEGER",
|
|
|
887953 |
+ OPTION_ARG_OPTIONAL, "set fuse reader thread count"},
|
|
|
887953 |
{0, 0, 0, 0, "Miscellaneous Options:"},
|
|
|
887953 |
{0, }
|
|
|
887953 |
};
|
|
|
887953 |
@@ -557,6 +559,17 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options)
|
|
|
887953 |
goto err;
|
|
|
887953 |
}
|
|
|
887953 |
}
|
|
|
887953 |
+ if (cmd_args->reader_thread_count) {
|
|
|
887953 |
+ ret = dict_set_uint32 (options, "reader-thread-count",
|
|
|
887953 |
+ cmd_args->reader_thread_count);
|
|
|
887953 |
+ if (ret < 0) {
|
|
|
887953 |
+ gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4,
|
|
|
887953 |
+ "failed to set dict value for key "
|
|
|
887953 |
+ "reader-thread-count");
|
|
|
887953 |
+ goto err;
|
|
|
887953 |
+ }
|
|
|
887953 |
+ }
|
|
|
887953 |
+
|
|
|
887953 |
ret = 0;
|
|
|
887953 |
err:
|
|
|
887953 |
return ret;
|
|
|
887953 |
@@ -1307,6 +1320,19 @@ no_oom_api:
|
|
|
887953 |
argp_failure (state, -1, 0,
|
|
|
887953 |
"unknown event-history setting \"%s\"", arg);
|
|
|
887953 |
break;
|
|
|
887953 |
+ case ARGP_READER_THREAD_COUNT_KEY:
|
|
|
887953 |
+ if (gf_string2uint32 (arg, &cmd_args->reader_thread_count)) {
|
|
|
887953 |
+ argp_failure (state, -1, 0,
|
|
|
887953 |
+ "unknown reader thread count option %s",
|
|
|
887953 |
+ arg);
|
|
|
887953 |
+ } else if ((cmd_args->reader_thread_count < 1) ||
|
|
|
887953 |
+ (cmd_args->reader_thread_count > 64)) {
|
|
|
887953 |
+ argp_failure (state, -1, 0,
|
|
|
887953 |
+ "Invalid reader thread count %s. "
|
|
|
887953 |
+ "Valid range: [\"1, 64\"]", arg);
|
|
|
887953 |
+ }
|
|
|
887953 |
+
|
|
|
887953 |
+ break;
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
return 0;
|
|
|
887953 |
diff --git a/glusterfsd/src/glusterfsd.h b/glusterfsd/src/glusterfsd.h
|
|
|
887953 |
index f66947b..75cb1d8 100644
|
|
|
887953 |
--- a/glusterfsd/src/glusterfsd.h
|
|
|
887953 |
+++ b/glusterfsd/src/glusterfsd.h
|
|
|
887953 |
@@ -99,6 +99,7 @@ enum argp_option_keys {
|
|
|
887953 |
ARGP_LOCALTIME_LOGGING_KEY = 177,
|
|
|
887953 |
ARGP_SUBDIR_MOUNT_KEY = 178,
|
|
|
887953 |
ARGP_FUSE_EVENT_HISTORY_KEY = 179,
|
|
|
887953 |
+ ARGP_READER_THREAD_COUNT_KEY = 180,
|
|
|
887953 |
};
|
|
|
887953 |
|
|
|
887953 |
struct _gfd_vol_top_priv {
|
|
|
887953 |
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
|
|
|
887953 |
index 5e641fd..3e2f426 100644
|
|
|
887953 |
--- a/libglusterfs/src/glusterfs.h
|
|
|
887953 |
+++ b/libglusterfs/src/glusterfs.h
|
|
|
887953 |
@@ -446,6 +446,7 @@ struct _cmd_args {
|
|
|
887953 |
char *subdir_mount;
|
|
|
887953 |
|
|
|
887953 |
char *event_history;
|
|
|
887953 |
+ uint32_t reader_thread_count;
|
|
|
887953 |
};
|
|
|
887953 |
typedef struct _cmd_args cmd_args_t;
|
|
|
887953 |
|
|
|
887953 |
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
|
|
|
887953 |
index fbb4c53..8d1e3a0 100644
|
|
|
887953 |
--- a/xlators/mount/fuse/src/fuse-bridge.c
|
|
|
887953 |
+++ b/xlators/mount/fuse/src/fuse-bridge.c
|
|
|
887953 |
@@ -665,7 +665,8 @@ fuse_lookup_resume (fuse_state_t *state)
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_lookup (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_lookup (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
char *name = msg;
|
|
|
887953 |
fuse_state_t *state = NULL;
|
|
|
887953 |
@@ -693,7 +694,8 @@ do_forget(xlator_t *this, uint64_t unique, uint64_t nodeid, uint64_t nlookup)
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_forget (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_forget (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
|
|
|
887953 |
{
|
|
|
887953 |
struct fuse_forget_in *ffi = msg;
|
|
|
887953 |
@@ -714,7 +716,8 @@ fuse_forget (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
|
|
|
887953 |
#if FUSE_KERNEL_MINOR_VERSION >= 16
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_batch_forget(xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_batch_forget(xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
struct fuse_batch_forget_in *fbfi = msg;
|
|
|
887953 |
struct fuse_forget_one *ffo = (struct fuse_forget_one *) (fbfi + 1);
|
|
|
887953 |
@@ -932,7 +935,8 @@ fuse_getattr_resume (fuse_state_t *state)
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_getattr (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_getattr (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
#if FUSE_KERNEL_MINOR_VERSION >= 9
|
|
|
887953 |
struct fuse_getattr_in *fgi = msg;
|
|
|
887953 |
@@ -1265,7 +1269,8 @@ fuse_setattr_resume (fuse_state_t *state)
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_setattr (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_setattr (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
struct fuse_setattr_in *fsi = msg;
|
|
|
887953 |
|
|
|
887953 |
@@ -1492,7 +1497,8 @@ fuse_access_resume (fuse_state_t *state)
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_access (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_access (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
struct fuse_access_in *fai = msg;
|
|
|
887953 |
fuse_state_t *state = NULL;
|
|
|
887953 |
@@ -1566,7 +1572,8 @@ fuse_readlink_resume (fuse_state_t *state)
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_readlink (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_readlink (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
fuse_state_t *state = NULL;
|
|
|
887953 |
|
|
|
887953 |
@@ -1616,7 +1623,8 @@ fuse_mknod_resume (fuse_state_t *state)
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_mknod (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_mknod (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
struct fuse_mknod_in *fmi = msg;
|
|
|
887953 |
char *name = (char *)(fmi + 1);
|
|
|
887953 |
@@ -1686,7 +1694,8 @@ fuse_mkdir_resume (fuse_state_t *state)
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_mkdir (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_mkdir (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
struct fuse_mkdir_in *fmi = msg;
|
|
|
887953 |
char *name = (char *)(fmi + 1);
|
|
|
887953 |
@@ -1738,7 +1747,8 @@ fuse_unlink_resume (fuse_state_t *state)
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_unlink (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_unlink (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
char *name = msg;
|
|
|
887953 |
fuse_state_t *state = NULL;
|
|
|
887953 |
@@ -1775,7 +1785,8 @@ fuse_rmdir_resume (fuse_state_t *state)
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_rmdir (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_rmdir (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
char *name = msg;
|
|
|
887953 |
fuse_state_t *state = NULL;
|
|
|
887953 |
@@ -1825,7 +1836,8 @@ fuse_symlink_resume (fuse_state_t *state)
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_symlink (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_symlink (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
char *name = msg;
|
|
|
887953 |
char *linkname = name + strlen (name) + 1;
|
|
|
887953 |
@@ -1947,7 +1959,8 @@ fuse_rename_resume (fuse_state_t *state)
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_rename (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_rename (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
struct fuse_rename_in *fri = msg;
|
|
|
887953 |
char *oldname = (char *)(fri + 1);
|
|
|
887953 |
@@ -1997,7 +2010,8 @@ fuse_link_resume (fuse_state_t *state)
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_link (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_link (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
struct fuse_link_in *fli = msg;
|
|
|
887953 |
char *name = (char *)(fli + 1);
|
|
|
887953 |
@@ -2186,7 +2200,8 @@ fuse_create_resume (fuse_state_t *state)
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_create (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_create (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
#if FUSE_KERNEL_MINOR_VERSION >= 12
|
|
|
887953 |
struct fuse_create_in *fci = msg;
|
|
|
887953 |
@@ -2280,7 +2295,8 @@ fuse_open_resume (fuse_state_t *state)
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_open (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_open (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
struct fuse_open_in *foi = msg;
|
|
|
887953 |
fuse_state_t *state = NULL;
|
|
|
887953 |
@@ -2357,7 +2373,8 @@ fuse_readv_resume (fuse_state_t *state)
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_readv (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_readv (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
struct fuse_read_in *fri = msg;
|
|
|
887953 |
|
|
|
887953 |
@@ -2433,8 +2450,6 @@ void
|
|
|
887953 |
fuse_write_resume (fuse_state_t *state)
|
|
|
887953 |
{
|
|
|
887953 |
struct iobref *iobref = NULL;
|
|
|
887953 |
- struct iobuf *iobuf = NULL;
|
|
|
887953 |
-
|
|
|
887953 |
|
|
|
887953 |
iobref = iobref_new ();
|
|
|
887953 |
if (!iobref) {
|
|
|
887953 |
@@ -2447,8 +2462,7 @@ fuse_write_resume (fuse_state_t *state)
|
|
|
887953 |
return;
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
- iobuf = ((fuse_private_t *) (state->this->private))->iobuf;
|
|
|
887953 |
- iobref_add (iobref, iobuf);
|
|
|
887953 |
+ iobref_add (iobref, state->iobuf);
|
|
|
887953 |
|
|
|
887953 |
gf_log ("glusterfs-fuse", GF_LOG_TRACE,
|
|
|
887953 |
"%"PRIu64": WRITE (%p, size=%"GF_PRI_SIZET", offset=%"PRId64")",
|
|
|
887953 |
@@ -2462,7 +2476,8 @@ fuse_write_resume (fuse_state_t *state)
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_write (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_write (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
/* WRITE is special, metadata is attached to in_header,
|
|
|
887953 |
* and msg is the payload as-is.
|
|
|
887953 |
@@ -2505,6 +2520,7 @@ fuse_write (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
|
|
|
887953 |
state->vector.iov_base = msg;
|
|
|
887953 |
state->vector.iov_len = fwi->size;
|
|
|
887953 |
+ state->iobuf = iobuf;
|
|
|
887953 |
|
|
|
887953 |
fuse_resolve_and_resume (state, fuse_write_resume);
|
|
|
887953 |
|
|
|
887953 |
@@ -2543,7 +2559,8 @@ fuse_lseek_resume (fuse_state_t *state)
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_lseek (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_lseek (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
struct fuse_lseek_in *ffi = msg;
|
|
|
887953 |
fuse_state_t *state = NULL;
|
|
|
887953 |
@@ -2579,7 +2596,8 @@ fuse_flush_resume (fuse_state_t *state)
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_flush (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_flush (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
struct fuse_flush_in *ffi = msg;
|
|
|
887953 |
|
|
|
887953 |
@@ -2615,7 +2633,8 @@ fuse_internal_release (xlator_t *this, fd_t *fd)
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_release (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_release (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
struct fuse_release_in *fri = msg;
|
|
|
887953 |
fd_t *fd = NULL;
|
|
|
887953 |
@@ -2660,7 +2679,8 @@ fuse_fsync_resume (fuse_state_t *state)
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_fsync (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_fsync (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
struct fuse_fsync_in *fsi = msg;
|
|
|
887953 |
|
|
|
887953 |
@@ -2735,7 +2755,8 @@ fuse_opendir_resume (fuse_state_t *state)
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_opendir (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_opendir (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
/*
|
|
|
887953 |
struct fuse_open_in *foi = msg;
|
|
|
887953 |
@@ -2877,7 +2898,8 @@ fuse_readdir_resume (fuse_state_t *state)
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_readdir (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_readdir (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
struct fuse_read_in *fri = msg;
|
|
|
887953 |
|
|
|
887953 |
@@ -3028,7 +3050,8 @@ fuse_readdirp_resume (fuse_state_t *state)
|
|
|
887953 |
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_readdirp (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_readdirp (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
struct fuse_read_in *fri = msg;
|
|
|
887953 |
|
|
|
887953 |
@@ -3075,7 +3098,8 @@ fuse_fallocate_resume(fuse_state_t *state)
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_fallocate(xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_fallocate(xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
struct fuse_fallocate_in *ffi = msg;
|
|
|
887953 |
fuse_state_t *state = NULL;
|
|
|
887953 |
@@ -3093,7 +3117,8 @@ fuse_fallocate(xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
#endif /* FUSE minor version >= 19 */
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_releasedir (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_releasedir (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
struct fuse_release_in *fri = msg;
|
|
|
887953 |
fuse_state_t *state = NULL;
|
|
|
887953 |
@@ -3134,7 +3159,8 @@ fuse_fsyncdir_resume (fuse_state_t *state)
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_fsyncdir (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_fsyncdir (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
struct fuse_fsync_in *fsi = msg;
|
|
|
887953 |
|
|
|
887953 |
@@ -3221,7 +3247,8 @@ fuse_statfs_resume (fuse_state_t *state)
|
|
|
887953 |
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_statfs (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_statfs (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
fuse_state_t *state = NULL;
|
|
|
887953 |
|
|
|
887953 |
@@ -3273,7 +3300,8 @@ fuse_setxattr_resume (fuse_state_t *state)
|
|
|
887953 |
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_setxattr (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_setxattr (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
struct fuse_setxattr_in *fsi = msg;
|
|
|
887953 |
char *name = (char *)(fsi + 1);
|
|
|
887953 |
@@ -3604,7 +3632,8 @@ fuse_getxattr_resume (fuse_state_t *state)
|
|
|
887953 |
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_getxattr (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_getxattr (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
struct fuse_getxattr_in *fgxi = msg;
|
|
|
887953 |
char *name = (char *)(fgxi + 1);
|
|
|
887953 |
@@ -3710,7 +3739,8 @@ fuse_listxattr_resume (fuse_state_t *state)
|
|
|
887953 |
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_listxattr (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_listxattr (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
struct fuse_getxattr_in *fgxi = msg;
|
|
|
887953 |
fuse_state_t *state = NULL;
|
|
|
887953 |
@@ -3766,7 +3796,8 @@ fuse_removexattr_resume (fuse_state_t *state)
|
|
|
887953 |
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_removexattr (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_removexattr (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
char *name = msg;
|
|
|
887953 |
|
|
|
887953 |
@@ -3865,7 +3896,8 @@ fuse_getlk_resume (fuse_state_t *state)
|
|
|
887953 |
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_getlk (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_getlk (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
struct fuse_lk_in *fli = msg;
|
|
|
887953 |
|
|
|
887953 |
@@ -3957,7 +3989,8 @@ fuse_setlk_resume (fuse_state_t *state)
|
|
|
887953 |
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_setlk (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_setlk (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
struct fuse_lk_in *fli = msg;
|
|
|
887953 |
|
|
|
887953 |
@@ -4056,7 +4089,8 @@ notify_kernel_loop (void *data)
|
|
|
887953 |
#endif
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_init (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_init (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
struct fuse_init_in *fini = msg;
|
|
|
887953 |
struct fuse_init_out fino = {0,};
|
|
|
887953 |
@@ -4227,7 +4261,8 @@ fuse_init (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_enosys (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_enosys (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
send_fuse_err (this, finh, ENOSYS);
|
|
|
887953 |
|
|
|
887953 |
@@ -4236,7 +4271,8 @@ fuse_enosys (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_destroy (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_destroy (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
send_fuse_err (this, finh, 0);
|
|
|
887953 |
|
|
|
887953 |
@@ -4826,6 +4862,7 @@ fuse_graph_sync (xlator_t *this)
|
|
|
887953 |
new_graph_id = priv->next_graph->id;
|
|
|
887953 |
priv->next_graph = NULL;
|
|
|
887953 |
need_first_lookup = 1;
|
|
|
887953 |
+ priv->handle_graph_switch = _gf_true;
|
|
|
887953 |
|
|
|
887953 |
while (!priv->event_recvd) {
|
|
|
887953 |
ret = pthread_cond_wait (&priv->sync_cond,
|
|
|
887953 |
@@ -4854,6 +4891,8 @@ unlock:
|
|
|
887953 |
{
|
|
|
887953 |
old_subvol->switched = 1;
|
|
|
887953 |
winds_on_old_subvol = old_subvol->winds;
|
|
|
887953 |
+ priv->handle_graph_switch = _gf_false;
|
|
|
887953 |
+ pthread_cond_broadcast (&priv->migrate_cond);
|
|
|
887953 |
}
|
|
|
887953 |
pthread_mutex_unlock (&priv->sync_mutex);
|
|
|
887953 |
|
|
|
887953 |
@@ -4861,6 +4900,13 @@ unlock:
|
|
|
887953 |
xlator_notify (old_subvol, GF_EVENT_PARENT_DOWN,
|
|
|
887953 |
old_subvol, NULL);
|
|
|
887953 |
}
|
|
|
887953 |
+ } else {
|
|
|
887953 |
+ pthread_mutex_lock (&priv->sync_mutex);
|
|
|
887953 |
+ {
|
|
|
887953 |
+ priv->handle_graph_switch = _gf_false;
|
|
|
887953 |
+ pthread_cond_broadcast (&priv->migrate_cond);
|
|
|
887953 |
+ }
|
|
|
887953 |
+ pthread_mutex_unlock (&priv->sync_mutex);
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
return 0;
|
|
|
887953 |
@@ -4897,7 +4943,6 @@ fuse_thread_proc (void *data)
|
|
|
887953 |
const size_t msg0_size = sizeof (*finh) + 128;
|
|
|
887953 |
fuse_handler_t **fuse_ops = NULL;
|
|
|
887953 |
struct pollfd pfd[2] = {{0,}};
|
|
|
887953 |
- gf_boolean_t mount_finished = _gf_false;
|
|
|
887953 |
|
|
|
887953 |
this = data;
|
|
|
887953 |
priv = this->private;
|
|
|
887953 |
@@ -4914,32 +4959,40 @@ fuse_thread_proc (void *data)
|
|
|
887953 |
/* THIS has to be reset here */
|
|
|
887953 |
THIS = this;
|
|
|
887953 |
|
|
|
887953 |
- if (!mount_finished) {
|
|
|
887953 |
- memset(pfd,0,sizeof(pfd));
|
|
|
887953 |
- pfd[0].fd = priv->status_pipe[0];
|
|
|
887953 |
- pfd[0].events = POLLIN | POLLHUP | POLLERR;
|
|
|
887953 |
- pfd[1].fd = priv->fd;
|
|
|
887953 |
- pfd[1].events = POLLIN | POLLHUP | POLLERR;
|
|
|
887953 |
- if (poll(pfd,2,-1) < 0) {
|
|
|
887953 |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
887953 |
- "poll error %s", strerror(errno));
|
|
|
887953 |
- break;
|
|
|
887953 |
- }
|
|
|
887953 |
- if (pfd[0].revents & POLLIN) {
|
|
|
887953 |
- if (fuse_get_mount_status(this) != 0) {
|
|
|
887953 |
+ pthread_mutex_lock (&priv->sync_mutex);
|
|
|
887953 |
+ {
|
|
|
887953 |
+ if (!priv->mount_finished) {
|
|
|
887953 |
+ memset(pfd, 0, sizeof(pfd));
|
|
|
887953 |
+ pfd[0].fd = priv->status_pipe[0];
|
|
|
887953 |
+ pfd[0].events = POLLIN | POLLHUP | POLLERR;
|
|
|
887953 |
+ pfd[1].fd = priv->fd;
|
|
|
887953 |
+ pfd[1].events = POLLIN | POLLHUP | POLLERR;
|
|
|
887953 |
+ if (poll(pfd, 2, -1) < 0) {
|
|
|
887953 |
+ gf_log (this->name, GF_LOG_ERROR,
|
|
|
887953 |
+ "poll error %s",
|
|
|
887953 |
+ strerror(errno));
|
|
|
887953 |
+ pthread_mutex_unlock (&priv->sync_mutex);
|
|
|
887953 |
break;
|
|
|
887953 |
}
|
|
|
887953 |
- mount_finished = _gf_true;
|
|
|
887953 |
- }
|
|
|
887953 |
- else if (pfd[0].revents) {
|
|
|
887953 |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
887953 |
- "mount pipe closed without status");
|
|
|
887953 |
- break;
|
|
|
887953 |
- }
|
|
|
887953 |
- if (!pfd[1].revents) {
|
|
|
887953 |
- continue;
|
|
|
887953 |
+ if (pfd[0].revents & POLLIN) {
|
|
|
887953 |
+ if (fuse_get_mount_status(this) != 0) {
|
|
|
887953 |
+ pthread_mutex_unlock (&priv->sync_mutex);
|
|
|
887953 |
+ break;
|
|
|
887953 |
+ }
|
|
|
887953 |
+ priv->mount_finished = _gf_true;
|
|
|
887953 |
+ } else if (pfd[0].revents) {
|
|
|
887953 |
+ gf_log (this->name, GF_LOG_ERROR,
|
|
|
887953 |
+ "mount pipe closed without status");
|
|
|
887953 |
+ pthread_mutex_unlock (&priv->sync_mutex);
|
|
|
887953 |
+ break;
|
|
|
887953 |
+ }
|
|
|
887953 |
+ if (!pfd[1].revents) {
|
|
|
887953 |
+ pthread_mutex_unlock (&priv->sync_mutex);
|
|
|
887953 |
+ continue;
|
|
|
887953 |
+ }
|
|
|
887953 |
}
|
|
|
887953 |
}
|
|
|
887953 |
+ pthread_mutex_unlock (&priv->sync_mutex);
|
|
|
887953 |
|
|
|
887953 |
/*
|
|
|
887953 |
* We don't want to block on readv while we're still waiting
|
|
|
887953 |
@@ -5034,8 +5087,6 @@ fuse_thread_proc (void *data)
|
|
|
887953 |
break;
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
- priv->iobuf = iobuf;
|
|
|
887953 |
-
|
|
|
887953 |
/*
|
|
|
887953 |
* This can be moved around a bit, but it's important to do it
|
|
|
887953 |
* *after* the readv. Otherwise, a graph switch could occur
|
|
|
887953 |
@@ -5078,9 +5129,9 @@ fuse_thread_proc (void *data)
|
|
|
887953 |
|
|
|
887953 |
if (finh->opcode >= FUSE_OP_HIGH)
|
|
|
887953 |
/* turn down MacFUSE specific messages */
|
|
|
887953 |
- fuse_enosys (this, finh, msg);
|
|
|
887953 |
+ fuse_enosys (this, finh, msg, NULL);
|
|
|
887953 |
else
|
|
|
887953 |
- fuse_ops[finh->opcode] (this, finh, msg);
|
|
|
887953 |
+ fuse_ops[finh->opcode] (this, finh, msg, iobuf);
|
|
|
887953 |
|
|
|
887953 |
iobuf_unref (iobuf);
|
|
|
887953 |
continue;
|
|
|
887953 |
@@ -5152,8 +5203,6 @@ fuse_priv_dump (xlator_t *this)
|
|
|
887953 |
private->volfile_size);
|
|
|
887953 |
gf_proc_dump_write("mount_point", "%s",
|
|
|
887953 |
private->mount_point);
|
|
|
887953 |
- gf_proc_dump_write("iobuf", "%p",
|
|
|
887953 |
- private->iobuf);
|
|
|
887953 |
gf_proc_dump_write("fuse_thread_started", "%d",
|
|
|
887953 |
(int)private->fuse_thread_started);
|
|
|
887953 |
gf_proc_dump_write("direct_io_mode", "%d",
|
|
|
887953 |
@@ -5279,6 +5328,7 @@ unlock:
|
|
|
887953 |
int
|
|
|
887953 |
notify (xlator_t *this, int32_t event, void *data, ...)
|
|
|
887953 |
{
|
|
|
887953 |
+ int i = 0;
|
|
|
887953 |
int32_t ret = 0;
|
|
|
887953 |
fuse_private_t *private = NULL;
|
|
|
887953 |
gf_boolean_t start_thread = _gf_false;
|
|
|
887953 |
@@ -5327,14 +5377,21 @@ notify (xlator_t *this, int32_t event, void *data, ...)
|
|
|
887953 |
pthread_mutex_unlock (&private->sync_mutex);
|
|
|
887953 |
|
|
|
887953 |
if (start_thread) {
|
|
|
887953 |
- ret = gf_thread_create (&private->fuse_thread, NULL,
|
|
|
887953 |
- fuse_thread_proc, this,
|
|
|
887953 |
- "fuseproc");
|
|
|
887953 |
- if (ret != 0) {
|
|
|
887953 |
- gf_log (this->name, GF_LOG_DEBUG,
|
|
|
887953 |
- "pthread_create() failed (%s)",
|
|
|
887953 |
- strerror (errno));
|
|
|
887953 |
- break;
|
|
|
887953 |
+ private->fuse_thread = GF_CALLOC (private->reader_thread_count,
|
|
|
887953 |
+ sizeof (pthread_t),
|
|
|
887953 |
+ gf_fuse_mt_pthread_t);
|
|
|
887953 |
+ for (i = 0; i < private->reader_thread_count; i++) {
|
|
|
887953 |
+
|
|
|
887953 |
+ ret = gf_thread_create (&private->fuse_thread[i],
|
|
|
887953 |
+ NULL,
|
|
|
887953 |
+ fuse_thread_proc, this,
|
|
|
887953 |
+ "fuseproc");
|
|
|
887953 |
+ if (ret != 0) {
|
|
|
887953 |
+ gf_log (this->name, GF_LOG_DEBUG,
|
|
|
887953 |
+ "pthread_create() failed (%s)",
|
|
|
887953 |
+ strerror (errno));
|
|
|
887953 |
+ break;
|
|
|
887953 |
+ }
|
|
|
887953 |
}
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
@@ -5441,7 +5498,8 @@ static fuse_handler_t *fuse_dump_ops[FUSE_OP_HIGH];
|
|
|
887953 |
|
|
|
887953 |
|
|
|
887953 |
static void
|
|
|
887953 |
-fuse_dumper (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
+fuse_dumper (xlator_t *this, fuse_in_header_t *finh, void *msg,
|
|
|
887953 |
+ struct iobuf *iobuf)
|
|
|
887953 |
{
|
|
|
887953 |
fuse_private_t *priv = NULL;
|
|
|
887953 |
struct iovec diov[6] = {{0,},};
|
|
|
887953 |
@@ -5473,7 +5531,7 @@ fuse_dumper (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
|
|
887953 |
"failed to dump fuse message (R): %s",
|
|
|
887953 |
strerror (errno));
|
|
|
887953 |
|
|
|
887953 |
- priv->fuse_ops0[finh->opcode] (this, finh, msg);
|
|
|
887953 |
+ priv->fuse_ops0[finh->opcode] (this, finh, msg, NULL);
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
|
|
|
887953 |
@@ -5578,6 +5636,9 @@ init (xlator_t *this_xl)
|
|
|
887953 |
GF_OPTION_INIT (ZR_ATTR_TIMEOUT_OPT, priv->attribute_timeout, double,
|
|
|
887953 |
cleanup_exit);
|
|
|
887953 |
|
|
|
887953 |
+ GF_OPTION_INIT ("reader-thread-count", priv->reader_thread_count, uint32,
|
|
|
887953 |
+ cleanup_exit);
|
|
|
887953 |
+
|
|
|
887953 |
GF_OPTION_INIT (ZR_ENTRY_TIMEOUT_OPT, priv->entry_timeout, double,
|
|
|
887953 |
cleanup_exit);
|
|
|
887953 |
|
|
|
887953 |
@@ -5793,6 +5854,7 @@ init (xlator_t *this_xl)
|
|
|
887953 |
|
|
|
887953 |
pthread_mutex_init (&priv->fuse_dump_mutex, NULL);
|
|
|
887953 |
pthread_cond_init (&priv->sync_cond, NULL);
|
|
|
887953 |
+ pthread_cond_init (&priv->migrate_cond, NULL);
|
|
|
887953 |
pthread_mutex_init (&priv->sync_mutex, NULL);
|
|
|
887953 |
priv->event_recvd = 0;
|
|
|
887953 |
|
|
|
887953 |
@@ -5992,5 +6054,12 @@ struct volume_options options[] = {
|
|
|
887953 |
.description = "This option can be used to enable or disable fuse "
|
|
|
887953 |
"event history.",
|
|
|
887953 |
},
|
|
|
887953 |
+ { .key = {"reader-thread-count"},
|
|
|
887953 |
+ .type = GF_OPTION_TYPE_INT,
|
|
|
887953 |
+ .default_value = "1",
|
|
|
887953 |
+ .min = 1,
|
|
|
887953 |
+ .max = 64,
|
|
|
887953 |
+ .description = "Sets fuse reader thread count.",
|
|
|
887953 |
+ },
|
|
|
887953 |
{ .key = {NULL} },
|
|
|
887953 |
};
|
|
|
887953 |
diff --git a/xlators/mount/fuse/src/fuse-bridge.h b/xlators/mount/fuse/src/fuse-bridge.h
|
|
|
887953 |
index 2dfef64..4ca76e9 100644
|
|
|
887953 |
--- a/xlators/mount/fuse/src/fuse-bridge.h
|
|
|
887953 |
+++ b/xlators/mount/fuse/src/fuse-bridge.h
|
|
|
887953 |
@@ -52,7 +52,7 @@
|
|
|
887953 |
|
|
|
887953 |
typedef struct fuse_in_header fuse_in_header_t;
|
|
|
887953 |
typedef void (fuse_handler_t) (xlator_t *this, fuse_in_header_t *finh,
|
|
|
887953 |
- void *msg);
|
|
|
887953 |
+ void *msg, struct iobuf *iobuf);
|
|
|
887953 |
|
|
|
887953 |
struct fuse_private {
|
|
|
887953 |
int fd;
|
|
|
887953 |
@@ -62,7 +62,8 @@ struct fuse_private {
|
|
|
887953 |
char *mount_point;
|
|
|
887953 |
struct iobuf *iobuf;
|
|
|
887953 |
|
|
|
887953 |
- pthread_t fuse_thread;
|
|
|
887953 |
+ pthread_t *fuse_thread;
|
|
|
887953 |
+ uint32_t reader_thread_count;
|
|
|
887953 |
char fuse_thread_started;
|
|
|
887953 |
|
|
|
887953 |
uint32_t direct_io_mode;
|
|
|
887953 |
@@ -140,6 +141,9 @@ struct fuse_private {
|
|
|
887953 |
|
|
|
887953 |
/* whether to run the unmount daemon */
|
|
|
887953 |
gf_boolean_t auto_unmount;
|
|
|
887953 |
+ gf_boolean_t mount_finished;
|
|
|
887953 |
+ gf_boolean_t handle_graph_switch;
|
|
|
887953 |
+ pthread_cond_t migrate_cond;
|
|
|
887953 |
};
|
|
|
887953 |
typedef struct fuse_private fuse_private_t;
|
|
|
887953 |
|
|
|
887953 |
@@ -391,6 +395,7 @@ typedef struct {
|
|
|
887953 |
int32_t fd_no;
|
|
|
887953 |
|
|
|
887953 |
gf_seek_what_t whence;
|
|
|
887953 |
+ struct iobuf *iobuf;
|
|
|
887953 |
} fuse_state_t;
|
|
|
887953 |
|
|
|
887953 |
typedef struct {
|
|
|
887953 |
diff --git a/xlators/mount/fuse/src/fuse-helpers.c b/xlators/mount/fuse/src/fuse-helpers.c
|
|
|
887953 |
index c59ff77..c2d4d0c 100644
|
|
|
887953 |
--- a/xlators/mount/fuse/src/fuse-helpers.c
|
|
|
887953 |
+++ b/xlators/mount/fuse/src/fuse-helpers.c
|
|
|
887953 |
@@ -123,6 +123,9 @@ get_fuse_state (xlator_t *this, fuse_in_header_t *finh)
|
|
|
887953 |
|
|
|
887953 |
pthread_mutex_lock (&priv->sync_mutex);
|
|
|
887953 |
{
|
|
|
887953 |
+ while (priv->handle_graph_switch)
|
|
|
887953 |
+ pthread_cond_wait (&priv->migrate_cond,
|
|
|
887953 |
+ &priv->sync_mutex);
|
|
|
887953 |
active_subvol = fuse_active_subvol (state->this);
|
|
|
887953 |
active_subvol->winds++;
|
|
|
887953 |
}
|
|
|
887953 |
diff --git a/xlators/mount/fuse/src/fuse-mem-types.h b/xlators/mount/fuse/src/fuse-mem-types.h
|
|
|
887953 |
index 2b4b473..721b9a3 100644
|
|
|
887953 |
--- a/xlators/mount/fuse/src/fuse-mem-types.h
|
|
|
887953 |
+++ b/xlators/mount/fuse/src/fuse-mem-types.h
|
|
|
887953 |
@@ -23,6 +23,7 @@ enum gf_fuse_mem_types_ {
|
|
|
887953 |
gf_fuse_mt_graph_switch_args_t,
|
|
|
887953 |
gf_fuse_mt_gids_t,
|
|
|
887953 |
gf_fuse_mt_invalidate_node_t,
|
|
|
887953 |
+ gf_fuse_mt_pthread_t,
|
|
|
887953 |
gf_fuse_mt_end
|
|
|
887953 |
};
|
|
|
887953 |
#endif
|
|
|
887953 |
diff --git a/xlators/mount/fuse/utils/mount.glusterfs.in b/xlators/mount/fuse/utils/mount.glusterfs.in
|
|
|
887953 |
index b39bb98..817619e 100755
|
|
|
887953 |
--- a/xlators/mount/fuse/utils/mount.glusterfs.in
|
|
|
887953 |
+++ b/xlators/mount/fuse/utils/mount.glusterfs.in
|
|
|
887953 |
@@ -221,6 +221,10 @@ start_glusterfs ()
|
|
|
887953 |
cmd_line=$(echo "$cmd_line --event-history=$event_history");
|
|
|
887953 |
fi
|
|
|
887953 |
|
|
|
887953 |
+ if [ -n "$reader_thread_count" ]; then
|
|
|
887953 |
+ cmd_line=$(echo "$cmd_line --reader-thread-count=$reader_thread_count");
|
|
|
887953 |
+ fi
|
|
|
887953 |
+
|
|
|
887953 |
if [ -n "$volume_name" ]; then
|
|
|
887953 |
cmd_line=$(echo "$cmd_line --volume-name=$volume_name");
|
|
|
887953 |
fi
|
|
|
887953 |
@@ -496,6 +500,9 @@ with_options()
|
|
|
887953 |
"event-history")
|
|
|
887953 |
event_history=$value
|
|
|
887953 |
;;
|
|
|
887953 |
+ "reader-thread-count")
|
|
|
887953 |
+ reader_thread_count=$value
|
|
|
887953 |
+ ;;
|
|
|
887953 |
"no-root-squash")
|
|
|
887953 |
if [ $value = "yes" ] ||
|
|
|
887953 |
[ $value = "on" ] ||
|
|
|
887953 |
--
|
|
|
887953 |
1.8.3.1
|
|
|
887953 |
|