From: Jonathan Davies <jonathan.davies@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Jonathan Davies <jonathan.davies@citrix.com>,
Jon Ludlam <jonathan.ludlam@citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Euan Harris <euan.harris@citrix.com>,
Dave Scott <dave@recoil.org>
Subject: [PATCH 3/7] oxenstored: refactor request processing
Date: Thu, 17 Mar 2016 17:51:11 +0000 [thread overview]
Message-ID: <1458237075-13777-4-git-send-email-jonathan.davies@citrix.com> (raw)
In-Reply-To: <1458237075-13777-1-git-send-email-jonathan.davies@citrix.com>
Encapsulate the request in a record that is passed from do_input to
process_packet and input_handle_error.
This will be helpful when keeping track of the requests made as part of a
transaction.
Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jon Ludlam <jonathan.ludlam@citrix.com>
Reviewed-by: Euan Harris <euan.harris@citrix.com>
---
tools/ocaml/xenstored/process.ml | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/tools/ocaml/xenstored/process.ml b/tools/ocaml/xenstored/process.ml
index 7a73669..c92bec7 100644
--- a/tools/ocaml/xenstored/process.ml
+++ b/tools/ocaml/xenstored/process.ml
@@ -344,11 +344,11 @@ let function_of_type ty =
| Xenbus.Xb.Op.Invalid -> reply_ack do_error
| _ -> reply_ack do_error
-let input_handle_error ~cons ~doms ~fct ~ty ~con ~t ~rid ~data =
+let input_handle_error ~cons ~doms ~fct ~con ~t ~req =
let reply_error e =
Packet.Error e in
try
- fct con t doms cons data
+ fct con t doms cons req.Packet.data
with
| Define.Invalid_path -> reply_error "EINVAL"
| Define.Already_exist -> reply_error "EEXIST"
@@ -370,7 +370,10 @@ let input_handle_error ~cons ~doms ~fct ~ty ~con ~t ~rid ~data =
(**
* Nothrow guarantee.
*)
-let process_packet ~store ~cons ~doms ~con ~tid ~rid ~ty ~data =
+let process_packet ~store ~cons ~doms ~con ~req =
+ let ty = req.Packet.ty in
+ let tid = req.Packet.tid in
+ let rid = req.Packet.rid in
try
let fct = function_of_type ty in
let t =
@@ -379,7 +382,7 @@ let process_packet ~store ~cons ~doms ~con ~tid ~rid ~ty ~data =
else
Connection.get_transaction con tid
in
- let response = input_handle_error ~cons ~doms ~fct ~ty ~con ~t ~rid ~data in
+ let response = input_handle_error ~cons ~doms ~fct ~con ~t ~req in
(* Put the response on the wire *)
send_response ty con t rid response
@@ -412,11 +415,13 @@ let do_input store cons doms con =
if newpacket then (
let packet = Connection.pop_in con in
let tid, rid, ty, data = Xenbus.Xb.Packet.unpack packet in
+ let req = {Packet.tid; Packet.rid; Packet.ty; Packet.data} in
+
(* As we don't log IO, do not call an unnecessary sanitize_data
info "[%s] -> [%d] %s \"%s\""
(Connection.get_domstr con) tid
(Xenbus.Xb.Op.to_string ty) (sanitize_data data); *)
- process_packet ~store ~cons ~doms ~con ~tid ~rid ~ty ~data;
+ process_packet ~store ~cons ~doms ~con ~req;
write_access_log ~ty ~tid ~con ~data;
Connection.incr_ops con;
)
--
1.7.10.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-03-17 17:51 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-17 17:51 [PATCH 0/7] oxenstored: improve transaction conflict handling Jonathan Davies
2016-03-17 17:51 ` [PATCH 1/7] oxenstored: refactor putting response on wire Jonathan Davies
2016-03-17 17:51 ` [PATCH 2/7] oxenstored: remove some unused parameters Jonathan Davies
2016-03-17 17:51 ` Jonathan Davies [this message]
2016-03-24 22:22 ` [PATCH 3/7] oxenstored: refactor request processing Boris Ostrovsky
2016-03-24 22:49 ` Andrew Cooper
2016-03-24 23:57 ` Boris Ostrovsky
2016-03-29 9:08 ` Jonathan Davies
2016-03-29 12:45 ` Boris Ostrovsky
2016-03-29 16:38 ` Wei Liu
2016-03-29 19:41 ` David Scott
2016-03-30 15:46 ` Jonathan Davies
2016-03-30 15:53 ` Wei Liu
2016-03-17 17:51 ` [PATCH 4/7] oxenstored: keep track of each transaction's operations Jonathan Davies
2016-03-17 17:51 ` [PATCH 5/7] oxenstored: move functions that process simple operations Jonathan Davies
2016-03-17 17:51 ` [PATCH 6/7] oxenstored: replay transaction upon conflict Jonathan Davies
2016-03-17 17:51 ` [PATCH 7/7] oxenstored: log request and response during transaction replay Jonathan Davies
2016-03-18 14:33 ` [PATCH 0/7] oxenstored: improve transaction conflict handling Konrad Rzeszutek Wilk
2016-03-18 16:21 ` Jonathan Davies
2016-03-18 16:36 ` Wei Liu
2016-03-19 11:30 ` David Scott
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1458237075-13777-4-git-send-email-jonathan.davies@citrix.com \
--to=jonathan.davies@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=dave@recoil.org \
--cc=euan.harris@citrix.com \
--cc=jonathan.ludlam@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).