qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [Qemu-stable] [PATCH 1/2] block: Fix unaligned zero wri


From: Peter Lieven
Subject: Re: [Qemu-devel] [Qemu-stable] [PATCH 1/2] block: Fix unaligned zero write
Date: Mon, 23 Mar 2015 15:35:42 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0

Am 23.03.2015 um 15:14 schrieb Stefan Hajnoczi:
On Mon, Mar 23, 2015 at 12:46:09PM +0800, Fam Zheng wrote:
@@ -3435,6 +3446,10 @@ static int coroutine_fn 
bdrv_co_do_pwritev(BlockDriverState *bs,
          bytes = ROUND_UP(bytes, align);
      }
+ if (use_local_qiov) {
+        /* Local buffer may have non-zero data. */
+        flags &= ~BDRV_REQ_ZERO_WRITE;
+    }
      ret = bdrv_aligned_pwritev(bs, &req, offset, bytes,
                                 use_local_qiov ? &local_qiov : qiov,
                                 flags);
@@ -3475,14 +3490,32 @@ int coroutine_fn bdrv_co_write_zeroes(BlockDriverState 
*bs,
                                        int64_t sector_num, int nb_sectors,
                                        BdrvRequestFlags flags)
  {
+    int ret;
+
      trace_bdrv_co_write_zeroes(bs, sector_num, nb_sectors, flags);
- if (!(bs->open_flags & BDRV_O_UNMAP)) {
-        flags &= ~BDRV_REQ_MAY_UNMAP;
-    }
Why is it okay to drop this when the request is aligned?

I also think it is not. This is the only point in the code that clears the
MAY_UNMAP flag when we do not open with discard=on

Peter



reply via email to

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