mirror of
https://github.com/utmapp/qemu.git
synced 2026-12-01 22:23:23 -10:00
block/raw-posix: use seek_hole ahead of fiemap
try_fiemap() uses FIEMAP_FLAG_SYNC which has a significant performance impact. Prefer seek_hole() over fiemap() to avoid this impact where possible. seek_hole is more widely used and, arguably, has potential to be optimised in the kernel. Reported-By: Michael Steffens <[email protected]> Signed-off-by: Tony Breeds <[email protected]> Cc: Kevin Wolf <[email protected]> Cc: Markus Armbruster <[email protected]> Cc: Stefan Hajnoczi <[email protected]> Cc: Max Reitz <[email protected]> Cc: Pádraig Brady <[email protected]> Cc: Eric Blake <[email protected]> Reviewed-by: Eric Blake <[email protected]> Reviewed-by: Max Reitz <[email protected]> Signed-off-by: Kevin Wolf <[email protected]>
This commit is contained in:
1 parent
38c4d0aea3
commit
7c15903789
1 file changed
+2
-2
+2
-2
@@ -1571,9 +1571,9 @@ static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs,
|
||||
|
||||
start = sector_num * BDRV_SECTOR_SIZE;
|
||||
|
||||
ret = try_fiemap(bs, start, &data, &hole, nb_sectors, pnum);
|
||||
ret = try_seek_hole(bs, start, &data, &hole, pnum);
|
||||
if (ret < 0) {
|
||||
ret = try_seek_hole(bs, start, &data, &hole, pnum);
|
||||
ret = try_fiemap(bs, start, &data, &hole, nb_sectors, pnum);
|
||||
if (ret < 0) {
|
||||
/* Assume everything is allocated. */
|
||||
data = 0;
|
||||
|
||||
Reference in new issue
Block a user