qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCHv4 4/4] block: avoid creating oversized writes in


From: Max Reitz
Subject: Re: [Qemu-devel] [PATCHv4 4/4] block: avoid creating oversized writes in multiwrite_merge
Date: Thu, 23 Oct 2014 13:23:35 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 2014-10-16 at 09:54, Peter Lieven wrote:
Signed-off-by: Peter Lieven <address@hidden>
Reviewed-by: Ronnie Sahlberg <address@hidden>
---
  block.c |    5 +++++
  1 file changed, 5 insertions(+)

diff --git a/block.c b/block.c
index 0fbf916..9ad2287 100644
--- a/block.c
+++ b/block.c
@@ -4554,6 +4554,11 @@ static int multiwrite_merge(BlockDriverState *bs, 
BlockRequest *reqs,
              merge = 0;
          }
+ if (bs->bl.max_transfer_length && reqs[outidx].nb_sectors +
+            reqs[i].nb_sectors > bs->bl.max_transfer_length) {
+            merge = 0;
+        }
+
          if (merge) {
              size_t size;
              QEMUIOVector *qiov = g_malloc0(sizeof(*qiov));

Reviewed-by: Max Reitz <address@hidden>

I feel like we should respect max_transfer_length in more than just this function, though. Every block device (or block driver) that sets a maximum transfer length should check requests against it as well, so we don't need to duplicate the same tests in the block layer functions, but maybe if at some point there are no things left to be done on the block layer, we could do that.

Max



reply via email to

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