qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v14 07/13] block: include supported_read_flags into BDS struc


From: Vladimir Sementsov-Ogievskiy
Subject: Re: [PATCH v14 07/13] block: include supported_read_flags into BDS structure
Date: Fri, 11 Dec 2020 16:31:47 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1

11.12.2020 16:20, Max Reitz wrote:
On 04.12.20 23:07, Vladimir Sementsov-Ogievskiy wrote:
From: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>

Add the new member supported_read_flags to the BlockDriverState
structure. It will control the flags set for copy-on-read operations.
Make the block generic layer evaluate supported read flags before they
go to a block driver.

Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
  include/block/block_int.h |  4 ++++
  block/io.c                | 12 ++++++++++--
  2 files changed, 14 insertions(+), 2 deletions(-)

[...]

diff --git a/block/io.c b/block/io.c
index ec5e152bb7..e28b11c42b 100644
--- a/block/io.c
+++ b/block/io.c

[...]

@@ -1426,9 +1429,13 @@ static int coroutine_fn bdrv_aligned_preadv(BdrvChild 
*child,
          goto out;
      }
+    if (flags & ~bs->supported_read_flags) {
+        abort();
+    }

I’d prefer an assert(!(flags & ~bs->supported_read_flags)), so in case we do 
abort, there’s going to be an error message that immediately tells what the problem is.

agree. and one-line check is shorter than three-line


Apart from that:

Reviewed-by: Max Reitz <mreitz@redhat.com>

+
      max_bytes = ROUND_UP(MAX(0, total_bytes - offset), align);
      if (bytes <= max_bytes && bytes <= max_transfer) {
-        ret = bdrv_driver_preadv(bs, offset, bytes, qiov, qiov_offset, 0);
+        ret = bdrv_driver_preadv(bs, offset, bytes, qiov, qiov_offset, flags);
          goto out;
      }



--
Best regards,
Vladimir



reply via email to

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