[Top][All Lists]

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

Re: [PATCH] block/backup-top: fix flags handling

From: Vladimir Sementsov-Ogievskiy
Subject: Re: [PATCH] block/backup-top: fix flags handling
Date: Mon, 3 Feb 2020 16:32:46 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1

31.01.2020 22:38, Eric Blake wrote:
On 1/31/20 12:48 PM, Vladimir Sementsov-Ogievskiy wrote:
backup-top "supports" write-unchanged, by skipping CBW operation in
backup_top_co_pwritev. But it forgets to do the same in
backup_top_co_pwrite_zeroes, as well as declare support for

Fix this, and, while being here, declare also support for flags
supported by source child.

Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
  block/backup-top.c | 28 ++++++++++++++++++----------
  1 file changed, 18 insertions(+), 10 deletions(-)

@@ -197,6 +201,10 @@ BlockDriverState *bdrv_backup_top_append(BlockDriverState 
      top->total_sectors = source->total_sectors;
      state = top->opaque;
+    top->supported_write_flags =
+        BDRV_REQ_WRITE_UNCHANGED | source->supported_write_flags;
+    top->supported_zero_flags =
+        BDRV_REQ_WRITE_UNCHANGED | source->supported_zero_flags;

Elsewhere, in block/filter-compress.c we do:

     bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED |
         (BDRV_REQ_FUA & bs->file->bs->supported_write_flags);

     bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED |

I've looked at this too, but didn't understand, why we need it. Now with your 
description, I see that this make sense. I'll resend with same pattern, thanks.

That's slightly more robust (if the block layer adds new BDRV_REQ_ bits, we 
don't have to revisit filter-compress.c to decide if blindly exposing those 
bits breaks for some reason, but rahter DO have to amend the line to opt-in to 
supporting the new bits).  Whereas your code does NOT need editing if passing 
on the new bit is safe, but risks a subtle breakage if we forget to filter out 
the new bit when passing it on would be unsafe.  I tend to lean towards safety 
and opt-in over blind pass-through that works with the current set of defined 
bits, but not enough to withhold:

Reviewed-by: Eric Blake <address@hidden>

Best regards,

reply via email to

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