mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
block: Add bdrv_get_request_alignment()
The next patch needs access to a device's minimum permitted alignment, since NBD wants to advertise this to clients. Add an accessor function, borrowing from blk_get_max_transfer() for accessing a backend's block limits. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20190329042750.14704-6-eblake@redhat.com>
This commit is contained in:
parent
9cf638508c
commit
4841211e0d
2 changed files with 8 additions and 0 deletions
|
@ -1764,6 +1764,13 @@ int blk_get_flags(BlockBackend *blk)
|
|||
}
|
||||
}
|
||||
|
||||
/* Returns the minimum request alignment, in bytes; guaranteed nonzero */
|
||||
uint32_t blk_get_request_alignment(BlockBackend *blk)
|
||||
{
|
||||
BlockDriverState *bs = blk_bs(blk);
|
||||
return bs ? bs->bl.request_alignment : BDRV_SECTOR_SIZE;
|
||||
}
|
||||
|
||||
/* Returns the maximum transfer length, in bytes; guaranteed nonzero */
|
||||
uint32_t blk_get_max_transfer(BlockBackend *blk)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue