Page MenuHomeFreeBSD

cam iosched: Use the write queue for BIO_ZONE commands
ClosedPublic

Authored by fk_fabiankeil.de on Sep 13 2017, 7:27 AM.

Details

Summary

cam iosched: Use the write queue for BIO_ZONE commands

... so they can't get executed ahead of writes that were sent
after them.

As a side effect this prevents the kernel message:
kernel: Found bio_cmd = 0x9
which cam_iosched_next_bio() emits when finding commands
other than BIO_READ in the read queue.

PR: 221973
Obtained from: ElectroBSD

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

As mentioned in the PR I'm not completely sure about the patch but
believe that using the write queue for BIO_ZONE commands is less
likely to cause problems than putting them one the read queue.

As I currently don't use SMR drives the patch hasn't been properly tested.

It prevents the kernel message:
kernel: Found bio_cmd = 0x9
which cam_iosched_next_bio() emits when finding commands
other than BIO_READ in the read queue, though.

The fact that BIO_ZONE commands are sometimes sent to non-SMR
drives may indicate another problem but I haven't looked into this
yet.

This works. However, it points to a larger issue with the cam iosched. We're not careful about honoring BIO_ORDERED commands....

This revision is now accepted and ready to land.Sep 20 2017, 8:58 PM

On second thought, when I commit this, I'll change it to bp->bio_cmd != BIO_READ.

This revision was automatically updated to reflect the committed changes.
In D12353#257717, @imp wrote:

This works. However, it points to a larger issue with the cam iosched. We're not careful about honoring BIO_ORDERED commands....

I'm aware of this, mainly because you mentioned it in the commit message of r298002.

At the moment I'm only using cam iosched with ZFS and my impression is
that the ordering issue is sufficiently "masked" by ZFS's copy-on-write behaviour.

I suspect that other file systems are more likely to be negatively affected
by it than ZFS. I haven't looked into this, though, as I don't want to use
other file systems with cam iosched anyway.

In D12353#257717, @imp wrote:

This works. However, it points to a larger issue with the cam iosched. We're not careful about honoring BIO_ORDERED commands....

I'm aware of this, mainly because you mentioned it in the commit message of r298002.

At the moment I'm only using cam iosched with ZFS and my impression is
that the ordering issue is sufficiently "masked" by ZFS's copy-on-write behaviour.

I suspect that other file systems are more likely to be negatively affected
by it than ZFS. I haven't looked into this, though, as I don't want to use
other file systems with cam iosched anyway.

ZFS doesn't use BIO_ORDERED writes. g_io_flush() is the only thing it does that's ordered.

UFS also has some BIO_ORDERED I/O.