summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorAnuradha Talur <atalur@redhat.com>2016-04-21 17:20:09 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-04-25 23:47:28 -0700
commit9996f95b28b3782887b7c233cdc0ba686c38b245 (patch)
tree5fa681f25b95dd9aeec88f3bf86adbc98bd2c1d3 /libglusterfs
parent2dc22adbf3361bdab10924943371492cc2817d8a (diff)
performance/decompounder: Introducing decompounder xlator
This xlator decompounds the compound fops received, and executes them serially. Change-Id: Ieddcec3c2983dd9ca7919ba9d7ecaa5192a5f489 BUG: 1303829 Signed-off-by: Anuradha Talur <atalur@redhat.com> Reviewed-on: http://review.gluster.org/13577 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/call-stub.c25
-rw-r--r--libglusterfs/src/common-utils.c5
-rw-r--r--libglusterfs/src/default-args.c34
-rw-r--r--libglusterfs/src/default-args.h3
-rw-r--r--libglusterfs/src/defaults.h16
-rw-r--r--libglusterfs/src/glfs-message-id.h4
-rw-r--r--libglusterfs/src/globals.c1
-rw-r--r--libglusterfs/src/glusterfs.h4
-rw-r--r--libglusterfs/src/mem-types.h5
-rw-r--r--libglusterfs/src/xlator.h8
10 files changed, 79 insertions, 26 deletions
diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c
index 42ebca6b3cc..99371ce8ff8 100644
--- a/libglusterfs/src/call-stub.c
+++ b/libglusterfs/src/call-stub.c
@@ -2360,32 +2360,9 @@ out:
static void
call_stub_wipe_args (call_stub_t *stub)
{
- loc_wipe (&stub->args.loc);
-
- loc_wipe (&stub->args.loc2);
-
- if (stub->args.fd)
- fd_unref (stub->args.fd);
-
- GF_FREE ((char *)stub->args.linkname);
-
- GF_FREE (stub->args.vector);
-
- if (stub->args.iobref)
- iobref_unref (stub->args.iobref);
-
- if (stub->args.xattr)
- dict_unref (stub->args.xattr);
-
- GF_FREE ((char *)stub->args.name);
-
- GF_FREE ((char *)stub->args.volume);
-
- if (stub->args.xdata)
- dict_unref (stub->args.xdata);
+ args_wipe (&stub->args);
}
-
static void
call_stub_wipe_args_cbk (call_stub_t *stub)
{
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index 21fe3841be9..bfddfc3124c 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -4327,8 +4327,9 @@ fop_enum_to_pri_string (glusterfs_fop_t fop)
case GF_FOP_MAXVALUE:
case GF_FOP_DISCARD:
return "LEAST";
+ default:
+ return "UNKNOWN";
}
- return "UNKNOWN";
}
const char *
@@ -4385,6 +4386,8 @@ fop_enum_to_string (glusterfs_fop_t fop)
"DISCARD",
"ZEROFILL",
"IPC",
+ "SEEK",
+ "COMPOUND",
"MAXVALUE"};
if (fop <= GF_FOP_MAXVALUE)
return str_map[fop];
diff --git a/libglusterfs/src/default-args.c b/libglusterfs/src/default-args.c
index 29c8aeae9fd..1ce907f6221 100644
--- a/libglusterfs/src/default-args.c
+++ b/libglusterfs/src/default-args.c
@@ -1486,3 +1486,37 @@ args_cbk_wipe (default_args_cbk_t *args_cbk)
if (!list_empty (&args_cbk->entries.list))
gf_dirent_free (&args_cbk->entries);
}
+
+void
+args_wipe (default_args_t *args)
+{
+ if (!args)
+ return;
+
+ if (&args->loc)
+ loc_wipe (&args->loc);
+
+ if (&args->loc2)
+ loc_wipe (&args->loc2);
+
+ if (args->fd)
+ fd_unref (args->fd);
+
+ GF_FREE ((char *)args->linkname);
+
+ GF_FREE (args->vector);
+
+ if (args->iobref)
+ iobref_unref (args->iobref);
+
+ if (args->xattr)
+ dict_unref (args->xattr);
+
+ if (args->xdata)
+ dict_unref (args->xdata);
+
+ GF_FREE ((char *)args->name);
+
+ GF_FREE ((char *)args->volume);
+
+}
diff --git a/libglusterfs/src/default-args.h b/libglusterfs/src/default-args.h
index a6ed0e484da..86dafe63e83 100644
--- a/libglusterfs/src/default-args.h
+++ b/libglusterfs/src/default-args.h
@@ -276,6 +276,9 @@ args_lease_cbk_store (default_args_cbk_t *args,
void
args_cbk_wipe (default_args_cbk_t *args_cbk);
+void
+args_wipe (default_args_t *args);
+
int
args_lookup_store (default_args_t *args, loc_t *loc,
dict_t *xdata);
diff --git a/libglusterfs/src/defaults.h b/libglusterfs/src/defaults.h
index 148dc84b1c5..cae69a536a3 100644
--- a/libglusterfs/src/defaults.h
+++ b/libglusterfs/src/defaults.h
@@ -78,6 +78,22 @@ typedef struct {
struct gf_lease lease;
} default_args_t;
+typedef struct {
+ int fop_enum;
+ int fop_length;
+ int *enum_list;
+ default_args_t *req_list;
+ dict_t *xdata;
+} compound_args_t;
+
+typedef struct {
+ int fop_enum;
+ int fop_length;
+ int *enum_list;
+ default_args_cbk_t *rsp_list;
+ dict_t *xdata;
+} compound_args_cbk_t;
+
int32_t default_notify (xlator_t *this,
int32_t event,
void *data,
diff --git a/libglusterfs/src/glfs-message-id.h b/libglusterfs/src/glfs-message-id.h
index 18104dab90f..d772dd37983 100644
--- a/libglusterfs/src/glfs-message-id.h
+++ b/libglusterfs/src/glfs-message-id.h
@@ -170,6 +170,10 @@ GLFS_MSGID_COMP_SYMLINK_CACHE_END
#define GLFS_MSGID_COMP_PL GLFS_MSGID_COMP_JBR_END
#define GLFS_MSGID_COMP_PL_END (GLFS_MSGID_COMP_PL +\
GLFS_MSGID_SEGMENT)
+
+#define GLFS_MSGID_COMP_DC GLFS_MSGID_COMP_PL_END
+#define GLFS_MSGID_COMP_DC_END (GLFS_MSGID_COMP_PL_END+\
+ GLFS_MSGID_SEGMENT)
/* --- new segments for messages goes above this line --- */
#endif /* !_GLFS_MESSAGE_ID_H_ */
diff --git a/libglusterfs/src/globals.c b/libglusterfs/src/globals.c
index 0645ffadb10..997994f049e 100644
--- a/libglusterfs/src/globals.c
+++ b/libglusterfs/src/globals.c
@@ -70,6 +70,7 @@ const char *gf_fop_list[GF_FOP_MAXVALUE] = {
[GF_FOP_IPC] = "IPC",
[GF_FOP_SEEK] = "SEEK",
[GF_FOP_LEASE] = "LEASE",
+ [GF_FOP_COMPOUND] = "COMPOUND",
};
/* THIS */
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
index 9d077e5ad61..d3be103d074 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -269,7 +269,8 @@
/* NOTE: add members ONLY at the end (just before _MAXVALUE) */
/*
- * OTHER NOTE: fop_enum_to_str and fop_enum_to_pri_str (in common-utils.h) also
+ * OTHER NOTE: fop_enum_to_str and fop_enum_to_pri_str (in common-utils.h)
+ * and gf_fop_list in globals.c also
* contain lists of fops, so if you update this list UPDATE THOSE TOO.
*/
typedef enum {
@@ -325,6 +326,7 @@ typedef enum {
GF_FOP_IPC,
GF_FOP_SEEK,
GF_FOP_LEASE,
+ GF_FOP_COMPOUND,
GF_FOP_MAXVALUE,
} glusterfs_fop_t;
diff --git a/libglusterfs/src/mem-types.h b/libglusterfs/src/mem-types.h
index 639ba3721f1..e185a49ec21 100644
--- a/libglusterfs/src/mem-types.h
+++ b/libglusterfs/src/mem-types.h
@@ -159,6 +159,11 @@ enum gf_common_mem_types_ {
gf_common_mt_syncenv,
gf_common_mt_scan_data,
gf_common_list_node,
+ gf_mt_default_args_t,
+ gf_mt_default_args_cbk_t,
+ /*used for compound fops*/
+ gf_mt_compound_req_t,
+ gf_mt_compound_rsp_t,
gf_common_mt_end
};
#endif
diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h
index 84f48edba2c..052dd978a63 100644
--- a/libglusterfs/src/xlator.h
+++ b/libglusterfs/src/xlator.h
@@ -452,6 +452,10 @@ typedef int32_t (*fop_lease_cbk_t) (call_frame_t *frame, void *cookie,
xlator_t *this, int32_t op_ret,
int32_t op_errno, struct gf_lease *lease,
dict_t *xdata);
+typedef int32_t (*fop_compound_cbk_t) (call_frame_t *frame,
+ void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno,
+ void *data, dict_t *xdata);
typedef int32_t (*fop_lookup_t) (call_frame_t *frame,
xlator_t *this,
@@ -702,6 +706,8 @@ typedef int32_t (*fop_seek_t) (call_frame_t *frame, xlator_t *this, fd_t *fd,
typedef int32_t (*fop_lease_t) (call_frame_t *frame, xlator_t *this, loc_t *loc,
struct gf_lease *lease, dict_t *xdata);
+typedef int32_t (*fop_compound_t) (call_frame_t *frame, xlator_t *this,
+ void *args, dict_t *xdata);
struct xlator_fops {
fop_lookup_t lookup;
fop_stat_t stat;
@@ -751,6 +757,7 @@ struct xlator_fops {
fop_ipc_t ipc;
fop_seek_t seek;
fop_lease_t lease;
+ fop_compound_t compound;
/* these entries are used for a typechecking hack in STACK_WIND _only_ */
fop_lookup_cbk_t lookup_cbk;
@@ -801,6 +808,7 @@ struct xlator_fops {
fop_ipc_cbk_t ipc_cbk;
fop_seek_cbk_t seek_cbk;
fop_lease_cbk_t lease_cbk;
+ fop_compound_cbk_t compound_cbk;
};
typedef int32_t (*cbk_forget_t) (xlator_t *this,