[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH v2] block: Cache total_sectors to reduce bdrv_ge
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] Re: [PATCH v2] block: Cache total_sectors to reduce bdrv_getlength calls |
Date: |
Tue, 20 Apr 2010 10:35:05 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100330 Fedora/3.0.4-1.fc12 Thunderbird/3.0.4 |
Am 19.04.2010 17:56, schrieb Stefan Hajnoczi:
> The BlockDriver bdrv_getlength function is called from the I/O code path
> when checking that the request falls within the device. Unfortunately
> this involves an lseek system call in the raw protocol; every read or
> write request will incur this lseek cost.
>
> Jan Kiszka <address@hidden> identified this issue and its
> latency overhead. This patch caches device length in the existing
> total_sectors variable so lseek calls can be avoided for fixed size
> devices.
>
> Growable devices fall back to the full bdrv_getlength code path because
> I have not added logic to detect extending the size of the device in a
> write.
>
> Signed-off-by: Stefan Hajnoczi <address@hidden>
> ---
> v2:
> - Introduced refresh_total_sectors() to clean up total_sectors updates
> - Added error handling for refresh_total_sectors() callers
Looks good, applied to the block branch.
Kevin