diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2015-07-09 10:56:47 +0100 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2015-12-22 16:01:07 +0800 |
commit | 3515727f31a2377ec94d0adb450cc175f33138f7 (patch) | |
tree | a49bd361daca336fea900a4eb39bbd8df3d96df5 /block/mirror.c | |
parent | 222565f65c3fba6825912c2561de7831e514ef3c (diff) |
block/mirror: replace IOV_MAX with blk_get_max_iov()
Use blk_get_max_iov() instead of hardcoding IOV_MAX, which may not apply
to all BlockDrivers.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block/mirror.c')
-rw-r--r-- | block/mirror.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/block/mirror.c b/block/mirror.c index fc34a9c491..f201f2b18a 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -161,13 +161,15 @@ static void mirror_read_complete(void *opaque, int ret) static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s) { BlockDriverState *source = s->common.bs; - int nb_sectors, sectors_per_chunk, nb_chunks; + int nb_sectors, sectors_per_chunk, nb_chunks, max_iov; int64_t end, sector_num, next_chunk, next_sector, hbitmap_next_sector; uint64_t delay_ns = 0; MirrorOp *op; int pnum; int64_t ret; + max_iov = MIN(source->bl.max_iov, s->target->bl.max_iov); + s->sector_num = hbitmap_iter_next(&s->hbi); if (s->sector_num < 0) { bdrv_dirty_iter_init(s->dirty_bitmap, &s->hbi); @@ -248,7 +250,7 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s) trace_mirror_break_buf_busy(s, nb_chunks, s->in_flight); break; } - if (IOV_MAX < nb_chunks + added_chunks) { + if (max_iov < nb_chunks + added_chunks) { trace_mirror_break_iov_max(s, nb_chunks, added_chunks); break; } |