diff mbox

[Qemu-block,PULL,76/76] block: move I/O request processing to block/io.c

Message ID 553FC01B.5030802@redhat.com
State New
Headers show

Commit Message

Eric Blake April 28, 2015, 5:15 p.m. UTC
On 04/28/2015 09:00 AM, Kevin Wolf wrote:
> From: Stefan Hajnoczi <stefanha@redhat.com>
> 
> The block.c file has grown to over 6000 lines.  It is time to split this
> file so there are fewer conflicts and the code is easier to maintain.
> 
> Extract I/O request processing code:
>  * Read
>  * Write
>  * Zero writes and making the image empty
>  * Flush
>  * Discard
>  * ioctl
>  * Tracked requests and queuing
>  * Throttling and copy-on-read
>  * Block status and allocated functions
>  * Refreshing block limits
>  * Reading/writing vmstate
>  * qemu_blockalign() and friends
> 
> The patch simply moves code from block.c into block/io.c.
> 
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block.c             | 3394 +++++++--------------------------------------------
>  block/Makefile.objs |    2 +-
>  block/io.c          | 2540 ++++++++++++++++++++++++++++++++++++++
>  3 files changed, 2982 insertions(+), 2954 deletions(-)
>  create mode 100644 block/io.c

Kevin, compare your diff to Stefan's:

> ---
>  block.c             | 2512 --------------------------------------------------
>  block/Makefile.objs |    2 +-
>  block/io.c          | 2540 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 2541 insertions(+), 2513 deletions(-)
>  create mode 100644 block/io.c

The difference is that Stefan has done 'git config diff.algorithm
patience', which makes for MUCH more legible diffs on a code motion
patch.  http://wiki.qemu.org/Contribute/SubmitAPatch mentions this as a
hint for a nicer setup.

At any rate, you've already sent the pull request, so I'm probably too
late; but for the record, here's why I would add:
Reviewed-by: Eric Blake <eblake@redhat.com>
when reviewing Stefan's version of the patch (the two versions give the
same end result, but my review technique falls flat on Kevin's replay of
the patch)

$ diff -u <(sed -n 's/^-//p' patch) <(sed -n 's/^+//p' patch)
+#include "trace.h"
 #include "sysemu/qtest.h"
+#include "block/blockjob.h"
+#include "block/block_int.h"
+
+#define NOT_DONE 0x7fffffff /* used while emulated sync operation in
progress */
+
 static BlockAIOCB *bdrv_aio_readv_em(BlockDriverState *bs,
         int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
         BlockCompletionFunc *cb, void *opaque);
@@ -465,7 +497,6 @@
     return waited;
 }

-
 static int bdrv_check_byte_request(BlockDriverState *bs, int64_t offset,
                                    size_t size)
 {
@@ -2511,8 +2542,3 @@
         bdrv_flush_io_queue(bs->file);
     }
 }
-
--- a/block/Makefile.objs
-block-obj-y += null.o mirror.o
--- /dev/null

Comments

Kevin Wolf April 29, 2015, 8:27 a.m. UTC | #1
Am 28.04.2015 um 19:15 hat Eric Blake geschrieben:
> On 04/28/2015 09:00 AM, Kevin Wolf wrote:
> > From: Stefan Hajnoczi <stefanha@redhat.com>
> > 
> > The block.c file has grown to over 6000 lines.  It is time to split this
> > file so there are fewer conflicts and the code is easier to maintain.
> > 
> > Extract I/O request processing code:
> >  * Read
> >  * Write
> >  * Zero writes and making the image empty
> >  * Flush
> >  * Discard
> >  * ioctl
> >  * Tracked requests and queuing
> >  * Throttling and copy-on-read
> >  * Block status and allocated functions
> >  * Refreshing block limits
> >  * Reading/writing vmstate
> >  * qemu_blockalign() and friends
> > 
> > The patch simply moves code from block.c into block/io.c.
> > 
> > Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> > Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> > ---
> >  block.c             | 3394 +++++++--------------------------------------------
> >  block/Makefile.objs |    2 +-
> >  block/io.c          | 2540 ++++++++++++++++++++++++++++++++++++++
> >  3 files changed, 2982 insertions(+), 2954 deletions(-)
> >  create mode 100644 block/io.c
> 
> Kevin, compare your diff to Stefan's:
> 
> > ---
> >  block.c             | 2512 --------------------------------------------------
> >  block/Makefile.objs |    2 +-
> >  block/io.c          | 2540 +++++++++++++++++++++++++++++++++++++++++++++++++++
> >  3 files changed, 2541 insertions(+), 2513 deletions(-)
> >  create mode 100644 block/io.c
> 
> The difference is that Stefan has done 'git config diff.algorithm
> patience', which makes for MUCH more legible diffs on a code motion
> patch.  http://wiki.qemu.org/Contribute/SubmitAPatch mentions this as a
> hint for a nicer setup.

Indeed, it does. I used --patience for reviewing the patch but neglected
to add it when sending the pull request. That said, I don't think I
could have enabled it for a single patch, and I'm not sure if it's
universally better (if so, why wouldn't it be the default?)

> At any rate, you've already sent the pull request, so I'm probably too
> late; but for the record, here's why I would add:
> Reviewed-by: Eric Blake <eblake@redhat.com>
> when reviewing Stefan's version of the patch (the two versions give the
> same end result, but my review technique falls flat on Kevin's replay of
> the patch)

You could apply both series and diff the result if you wanted.

But this one was easy enough to review on my own (...famous last words?)

Kevin
diff mbox

Patch

--- /dev/fd/63	2015-04-28 11:13:24.696901797 -0600
+++ /dev/fd/62	2015-04-28 11:13:24.697901792 -0600
@@ -1,6 +1,38 @@ 
---
--- a/block.c
+++ b/block.c
+++ b/block/Makefile.objs
+block-obj-y += null.o mirror.o io.o
+++ b/block/io.c
+/*
+ * Block layer I/O functions
+ *
+ * Copyright (c) 2003 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person
obtaining a copy
+ * of this software and associated documentation files (the
"Software"), to deal
+ * in the Software without restriction, including without limitation
the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN
+ * THE SOFTWARE.
+ */
+