Hello,
sys/dev/dksubr.c:dk_start() has this code:
while ((bp = bufq_get(dksc->sc_bufq)) != NULL) {
if (di->di_diskstart(dksc, bp) != 0) {
bufq_put(dksc->sc_bufq, bp);
break;
}
}
This potentially causes a buffer to be dequeued and requeued.
Even with disksort strategy, it seems that the order is not preserved.
I noticed this with xbd(4) (xen's virtual disk driver), where its start
routine
would get out of order requests as the pagedaemon (or the filesystem)
generate
properly ordered writes. The attached patch fixes this issue, and with
on a Xen guest I can see a dd if=/dev/zero of=file bs=1m count=1000
bump from
less to 30MB/s to more than 100MB/s. This is likely because the
underlying
disk has a strategy to detect sequential writes, which fails with the
reordering caused by dk_start().
It looks like xbd(4) is the only user of sys/dev/dksubr.c, which may be
why
is has not been noticed earlier.
Any objection to the attached patch ?