]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Clarify and reimplement the bioq API so that bioq_disksort() has
authorluigi <luigi@FreeBSD.org>
Fri, 13 Feb 2009 11:36:32 +0000 (11:36 +0000)
committerluigi <luigi@FreeBSD.org>
Fri, 13 Feb 2009 11:36:32 +0000 (11:36 +0000)
commit8faaf7bcde3cc3e6cf37c37c3652dd5196e47521
treedf791133eef4aebd113363e81de096bf1b08c891
parent58c99591c6bd3cd69de7784bd479ef26d45dc334
Clarify and reimplement the bioq API so that bioq_disksort() has
the correct behaviour (sorting by distance from the current head position
in the scan direction) and bioq_insert_head() and bioq_insert_tail()
have a well defined (and useful) behaviour, especially when intermixed
with calls to bioq_disksort().

In particular:
- fix a bug in the existing bioq_disksort() that did not use the
  current head position correctly;
- redefine semantics of bioq_insert_head() and bioq_insert_tail().
  bioq_insert_tail() can now be used as a barrier
  between previous and subsequent calls to bioq_disksort().

The code is heavily documented in the source code so please refer
to that for the details.

Much of this code comes from Fabio Checconi. Also thanks to Kirk
for feedback on the (re)definition of bioq_insert_tail().

NOTE: in the current tree there is only a handful of files which
intermix calls to bioq_disksort() with bioq_insert_head() and
bioq_insert_tail(). The ordering of the queue in these situation
was not specified (nor easy to figure out) before, so I doubt any
of that code could be affected by the specification of the API.

Also note that the current implementation is significantly simpler
than the previous one (also used in ata_sort_queue()).
It would be useful to reimplement ata_sort_queue() using
the same code used in bioq_disksort().

MFC after: 1 week
sys/kern/subr_disk.c