mbox series

[v3,0/2] Optimize alignment probing

Message ID 20190827010528.8818-1-nsoffer@redhat.com (mailing list archive)
Headers show
Series Optimize alignment probing | expand

Message

Nir Soffer Aug. 27, 2019, 1:05 a.m. UTC
When probing unallocated area on remote XFS filesystem we cannot detect request
alignment and we fallback to safe value which may not be optimal. Avoid this
fallback by always allocating the first block when creating a new image or
resizing empty image.

Tested with all formats:

    for fmt in raw bochs cloop parallels qcow qcow2 qed vdi vpc vhdx vmdk luks dmg; do
        ./check -$fmt
    done

Changes in v3:
- Allocating first block works now when 512 <= size < 4096, storage sector size
  is 512 bytes, and using block_resize with O_DIRECT (Max)
- Fix return value on errors if qemu_vfree() modified errno (Eric)
- Improve comment about using allocate_first_block in FALLOC mode (Max)
- Remove unneeded $(()) in _filter_block (Max)
- Add _default_cache_mode and _supported_cache_mode to new test (Max)
- Fix disk size in vmdk tests

v2 was here:
https://lists.nongnu.org/archive/html/qemu-block/2019-08/msg01265.html

Changes in v2:
- Support file descriptor opened with O_DIRECT (e.g. in block_resize) (Max)
- Remove unneeded change in 160 (Max)
- Fix block filter in 175 on filesystem allocating extra blocks (Max)
- Comment why we ignore errors in allocte_first_block() (Max)
- Comment why allocate_first_block() is needed in FALLOC mode (Max)
- Clarify commit message about user visible changes (Maxim)
- Fix 178.out.qcow2
- Fix 150.out with -qcow2 by splitting to 150.out.{raw,qcow2}
- Add test for allocate_first_block() with block_resize (Max)
- Drop provisioning tests results since I ran them only once

v1 was here:
https://lists.nongnu.org/archive/html/qemu-block/2019-08/msg00821.html

Nir Soffer (2):
  block: posix: Always allocate the first block
  iotests: Test allocate_first_block() with O_DIRECT

 block/file-posix.c                            | 51 +++++++++++++++++++
 tests/qemu-iotests/059.out                    |  2 +-
 tests/qemu-iotests/{150.out => 150.out.qcow2} |  0
 tests/qemu-iotests/150.out.raw                | 12 +++++
 tests/qemu-iotests/175                        | 47 ++++++++++++++---
 tests/qemu-iotests/175.out                    | 16 ++++--
 tests/qemu-iotests/178.out.qcow2              |  4 +-
 tests/qemu-iotests/221.out                    | 12 +++--
 tests/qemu-iotests/253.out                    | 12 +++--
 9 files changed, 135 insertions(+), 21 deletions(-)
 rename tests/qemu-iotests/{150.out => 150.out.qcow2} (100%)
 create mode 100644 tests/qemu-iotests/150.out.raw

Comments

Nir Soffer Aug. 27, 2019, 3:06 p.m. UTC | #1
Adding Eric

On Tue, Aug 27, 2019 at 4:05 AM Nir Soffer <nirsof@gmail.com> wrote:

> When probing unallocated area on remote XFS filesystem we cannot detect
> request
> alignment and we fallback to safe value which may not be optimal. Avoid
> this
> fallback by always allocating the first block when creating a new image or
> resizing empty image.
>
> Tested with all formats:
>
>     for fmt in raw bochs cloop parallels qcow qcow2 qed vdi vpc vhdx vmdk
> luks dmg; do
>         ./check -$fmt
>     done
>
> Changes in v3:
> - Allocating first block works now when 512 <= size < 4096, storage sector
> size
>   is 512 bytes, and using block_resize with O_DIRECT (Max)
> - Fix return value on errors if qemu_vfree() modified errno (Eric)
> - Improve comment about using allocate_first_block in FALLOC mode (Max)
> - Remove unneeded $(()) in _filter_block (Max)
> - Add _default_cache_mode and _supported_cache_mode to new test (Max)
> - Fix disk size in vmdk tests
>
> v2 was here:
> https://lists.nongnu.org/archive/html/qemu-block/2019-08/msg01265.html
>
> Changes in v2:
> - Support file descriptor opened with O_DIRECT (e.g. in block_resize) (Max)
> - Remove unneeded change in 160 (Max)
> - Fix block filter in 175 on filesystem allocating extra blocks (Max)
> - Comment why we ignore errors in allocte_first_block() (Max)
> - Comment why allocate_first_block() is needed in FALLOC mode (Max)
> - Clarify commit message about user visible changes (Maxim)
> - Fix 178.out.qcow2
> - Fix 150.out with -qcow2 by splitting to 150.out.{raw,qcow2}
> - Add test for allocate_first_block() with block_resize (Max)
> - Drop provisioning tests results since I ran them only once
>
> v1 was here:
> https://lists.nongnu.org/archive/html/qemu-block/2019-08/msg00821.html
>
> Nir Soffer (2):
>   block: posix: Always allocate the first block
>   iotests: Test allocate_first_block() with O_DIRECT
>
>  block/file-posix.c                            | 51 +++++++++++++++++++
>  tests/qemu-iotests/059.out                    |  2 +-
>  tests/qemu-iotests/{150.out => 150.out.qcow2} |  0
>  tests/qemu-iotests/150.out.raw                | 12 +++++
>  tests/qemu-iotests/175                        | 47 ++++++++++++++---
>  tests/qemu-iotests/175.out                    | 16 ++++--
>  tests/qemu-iotests/178.out.qcow2              |  4 +-
>  tests/qemu-iotests/221.out                    | 12 +++--
>  tests/qemu-iotests/253.out                    | 12 +++--
>  9 files changed, 135 insertions(+), 21 deletions(-)
>  rename tests/qemu-iotests/{150.out => 150.out.qcow2} (100%)
>  create mode 100644 tests/qemu-iotests/150.out.raw
>
> --
> 2.20.1
>
>
Max Reitz Aug. 27, 2019, 5 p.m. UTC | #2
On 27.08.19 03:05, Nir Soffer wrote:
> When probing unallocated area on remote XFS filesystem we cannot detect request
> alignment and we fallback to safe value which may not be optimal. Avoid this
> fallback by always allocating the first block when creating a new image or
> resizing empty image.
> 
> Tested with all formats:
> 
>     for fmt in raw bochs cloop parallels qcow qcow2 qed vdi vpc vhdx vmdk luks dmg; do
>         ./check -$fmt
>     done

Thanks, applied to my block branch:

https://git.xanclic.moe/XanClic/qemu/commits/branch/block

Max