512-on-4k follow-up patches
cover 512-on-4k follow-up patches
Kevin Wolf (3):
block: Fix memory leaks in bdrv_co_do_pwritev()
block: bdrv_aligned_pwritev: Assert overlap range
block: Don't call ROUND_UP with negative values
block.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
Signature · 1 line
1.8.1.4
PATCH 1/3 block: Fix memory leaks in bdrv_co_do_pwritev()
The error path for a failure in one of the two bdrv_aligned_preadv() calls leaked head_buf or tail_buf, respectively. This fixes the memory leak.
--- block.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
block.c +2 -2
@@ -3279,9 +3279,9 @@ fail:if (use_local_qiov) {qemu_iovec_destroy (&local_qiov); -qemu_vfree (head_buf); -qemu_vfree (tail_buf); } +qemu_vfree (head_buf); +qemu_vfree (tail_buf);return ret; }
Signature · 1 line
1.8.1.4
PATCH 2/3 block: bdrv_aligned_pwritev: Assert overlap range
In reply to Kevin WolfThis adds assertions that the request that we actually end up passing to the block driver (which includes RMW data and has therefore potentially been rounded to alignment boundaries) is fully covered by the overlap_{offset,size} fields of the associated BdrvTrackedRequest.
--- block.c | 2 ++ 1 file changed, 2 insertions(+)
block.c +2 -0
@@ -3134,6 +3134,8 @@ static int coroutine_fn bdrv_aligned_pwritev(BlockDriverState *bs, waited =wait_serialising_requests (req);assert (!waited || !req->serialising); +assert (req->overlap_offset <= offset); +assert (offset + bytes <= req->overlap_offset + req->overlap_bytes); ret =notifier_with_return_list_notify (&bs->before_write_notifiers, req);
Signature · 1 line
1.8.1.4
PATCH 3/3 block: Don't call ROUND_UP with negative values
In reply to Kevin WolfThe behaviour of the ROUND_UP macro with negative numbers isn't obvious. It happens to do the right thing in this please, but better avoid it.
--- block.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
block.c +2 -2
@@ -2915,8 +2915,8 @@ static int coroutine_fn bdrv_aligned_preadv(BlockDriverState *bs, } total_sectors =DIV_ROUND_UP (len,BDRV_SECTOR_SIZE ); - max_nb_sectors =MAX (0 ,ROUND_UP (total_sectors - sector_num, - align >>BDRV_SECTOR_BITS )); + max_nb_sectors =ROUND_UP (MAX (0 , total_sectors - sector_num), + align >>BDRV_SECTOR_BITS );if (max_nb_sectors >0 ) { ret = drv->bdrv_co_readv (bs, sector_num,MIN (nb_sectors, max_nb_sectors), qiov);
Signature · 1 line
1.8.1.4
Re: [Qemu-devel] [PATCH 3/3] block: Don't call ROUND_UP with negative values
Quoted 2 lines · Kevin Wolf
The behaviour of the
ROUND_UPmacro with negative numbers isn't obvious. It happens to do the right thing in this please, but better avoid it.
s/please/place/
Quoted 6 lines
Suggested-by Laszlo Ersek <[email protected]>Signed-off-by Kevin Wolf <[email protected]>--- block.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Series: Reviewed-by: Eric Blake <[email protected]>
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Re: [Qemu-devel] [PATCH 3/3] block: Don't call ROUND_UP with negative values
Am 07.02.2014 um 17:27 hat Eric Blake geschrieben:
Quoted 5 lines · Kevin Wolf
Quoted 2 lines
The behaviour of the
ROUND_UPmacro with negative numbers isn't obvious. It happens to do the right thing in this please, but better avoid it.s/please/place/
Indeed... Thanks, fixed it locally.
Quoted 7 lines
Quoted 5 lines
Suggested-by Laszlo Ersek <[email protected]>Signed-off-by Kevin Wolf <[email protected]>--- block.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Series: Reviewed-by: Eric Blake <[email protected]>
Kevin
Laszlo Ersek
Reviewed-byRe: [Qemu-devel] [PATCH 3/3] block: Don't call ROUND_UP with negative values
Quoted 16 lines · Kevin Wolf
Am 07.02.2014 um 17:27 hat Eric Blake geschrieben:
Quoted 5 lines · Kevin Wolf
Quoted 2 lines
The behaviour of the
ROUND_UPmacro with negative numbers isn't obvious. It happens to do the right thing in this please, but better avoid it.s/please/place/
Indeed... Thanks, fixed it locally.
Quoted 7 lines
Quoted 5 lines
Suggested-by Laszlo Ersek <[email protected]>Signed-off-by Kevin Wolf <[email protected]>--- block.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Series: Reviewed-by: Eric Blake <[email protected]>
Not necessary after Eric's review, but here it is anyway:
series
Thanks!
Laszlo
Re: [Qemu-devel] [PATCH 3/3] block: Don't call ROUND_UP with negative values
Am 08.02.2014 um 00:24 hat Laszlo Ersek geschrieben:
Quoted 16 lines · Kevin Wolf
Quoted 15 lines
Am 07.02.2014 um 17:27 hat Eric Blake geschrieben:
Quoted 5 lines · Kevin Wolf
Quoted 2 lines
The behaviour of the
ROUND_UPmacro with negative numbers isn't obvious. It happens to do the right thing in this please, but better avoid it.s/please/place/
Indeed... Thanks, fixed it locally.
Quoted 6 lines
Quoted 5 lines
Suggested-by Laszlo Ersek <[email protected]>Signed-off-by Kevin Wolf <[email protected]>--- block.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Series: Reviewed-by: Eric Blake <[email protected]>
Not necessary after Eric's review, but here it is anyway:
series
Reviewed-by Laszlo Ersek <[email protected]>
Review is never unnecessary. Thanks, Laszlo.
Kevin