diff options
author | Laurent Vivier <lvivier@redhat.com> | 2016-05-31 18:35:53 +0200 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2016-06-07 18:19:24 +0300 |
commit | c41a73ffaf40aadc2c1e038ae4d12b62cd578e7f (patch) | |
tree | 04c3d19dc758f1d2318ab1dacfca59af41997cdd /block/qed.c | |
parent | d737b78cc13d2ab94ffa4478da59931165cb1f4e (diff) | |
download | qemu-c41a73ffaf40aadc2c1e038ae4d12b62cd578e7f.zip qemu-c41a73ffaf40aadc2c1e038ae4d12b62cd578e7f.tar.gz qemu-c41a73ffaf40aadc2c1e038ae4d12b62cd578e7f.tar.bz2 |
qed: Use DIV_ROUND_UP
Replace (((n) + (d) - 1) /(d)) by DIV_ROUND_UP(n,d).
This patch is the result of coccinelle script
scripts/coccinelle/round.cocci
CC: qemu-block@nongnu.org
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'block/qed.c')
-rw-r--r-- | block/qed.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/block/qed.c b/block/qed.c index b591d4a..0f62192 100644 --- a/block/qed.c +++ b/block/qed.c @@ -143,8 +143,7 @@ static void qed_write_header(BDRVQEDState *s, BlockCompletionFunc cb, * them, and write back. */ - int nsectors = (sizeof(QEDHeader) + BDRV_SECTOR_SIZE - 1) / - BDRV_SECTOR_SIZE; + int nsectors = DIV_ROUND_UP(sizeof(QEDHeader), BDRV_SECTOR_SIZE); size_t len = nsectors * BDRV_SECTOR_SIZE; QEDWriteHeaderCB *write_header_cb = gencb_alloc(sizeof(*write_header_cb), cb, opaque); |