diff --git a/sys/arch/xen/xen/xbd_xenbus.c b/sys/arch/xen/xen/xbd_xenbus.c index 59598022b16d..073ca9a4f6ab 100644 --- a/sys/arch/xen/xen/xbd_xenbus.c +++ b/sys/arch/xen/xen/xbd_xenbus.c @@ -1006,8 +1006,8 @@ xbd_diskstart(device_t self, struct buf *bp) va = (vaddr_t)xbdreq->req_data & ~PAGE_MASK; off = (vaddr_t)xbdreq->req_data & PAGE_MASK; - bcount = bp->b_bcount; - bp->b_resid = 0; + bcount = MIN(bp->b_bcount, XBD_MAX_XFER); + bp->b_resid = bp->b_bcount - bcount; for (seg = 0; bcount > 0;) { pmap_extract_ma(pmap_kernel(), va, &ma); KASSERT((ma & (XEN_BSIZE - 1)) == 0);