qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v2 0/6] rfc: 9pfs-proxy simplification/cleanup


From: Michael Tokarev
Subject: [Qemu-devel] [PATCH v2 0/6] rfc: 9pfs-proxy simplification/cleanup
Date: Fri, 6 Mar 2015 23:18:39 +0300

9pfs-proxy code is terrible.  Not only it does lots of memory
allocations for every filesystem operation, the code is also
badly written.

For example, all filesystem operation methods call a common
function, v9fs_request(), and passes all info about method
arguments, including argument types, to it.  However, the
common v9fs_request() function has a switch(filesystem method),
unpacks method arguments from the argument stack, and re-
request marshalling with a new list of argument types,
ignoring what the individual method handler passed to it.

When receiving a response, this common function has another
per-filesystem-method switch which, in some cases, calls
v9fs_read_response(), which also has the same per-method
switch.

As a result, processing of each request is badly split
between several functions, and the whole thing is just
ugly.

Error handling is also of the same sort.  Common v9fs_request()
return -errno, and every filesystem method which calls it
stores result in errno, instead of letting the common
code to do that.  Error handling is inconsistent too,
some methods return -1 and some return -errno.

This is one small attempt to fix this all.  So far,
addressed is the error handling and arguments of
filesystem methods.

Note: I haven't actually tested this code, only compile-tested it.

Michael Tokarev (6):
  9pfs-proxy: simplify v9fs_request() a bit
  9pfs-proxy: simplify error handling
  9pfs-proxy: rename a few local variables for consistency
  fsdev: introduce v9fs_vmarshal() and v9fs_vunmarshal()
  9pfs-proxy: remove one half of redundrand code
  9pfs-proxy: tiny cleanups in proxy_pwritev and proxy_preadv

 fsdev/virtio-9p-marshal.c |  38 +++--
 fsdev/virtio-9p-marshal.h |   6 +
 hw/9pfs/virtio-9p-proxy.c | 411 +++++-----------------------------------------
 3 files changed, 79 insertions(+), 376 deletions(-)

-- 
2.1.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]