mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
block: Convert bdrv_co_discard() to byte-based
Another step towards byte-based interfaces everywhere. Replace the sector-based bdrv_co_discard() with a new byte-based bdrv_co_pdiscard(), which silently ignores any unaligned head or tail. Driver callbacks will be converted in followup patches. By calculating the alignment outside of the loop, and clamping the max discard to an aligned value, we can simplify the actions done within the loop. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1468624988-423-2-git-send-email-eblake@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
6bd01f14db
commit
9f1963b3f7
5 changed files with 42 additions and 36 deletions
|
@ -1113,7 +1113,8 @@ int blk_co_discard(BlockBackend *blk, int64_t sector_num, int nb_sectors)
|
|||
return ret;
|
||||
}
|
||||
|
||||
return bdrv_co_discard(blk_bs(blk), sector_num, nb_sectors);
|
||||
return bdrv_co_pdiscard(blk_bs(blk), sector_num << BDRV_SECTOR_BITS,
|
||||
nb_sectors << BDRV_SECTOR_BITS);
|
||||
}
|
||||
|
||||
int blk_co_flush(BlockBackend *blk)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue