Deleted Added
full compact
subr_disk.c (302408) subr_disk.c (344072)
1/*-
2 * ----------------------------------------------------------------------------
3 * "THE BEER-WARE LICENSE" (Revision 42):
4 * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you
5 * can do whatever you want with this stuff. If we meet some day, and you think
6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
7 * ----------------------------------------------------------------------------
8 *
9 * The bioq_disksort() (and the specification of the bioq API)
10 * have been written by Luigi Rizzo and Fabio Checconi under the same
11 * license as above.
12 */
13
14#include <sys/cdefs.h>
1/*-
2 * ----------------------------------------------------------------------------
3 * "THE BEER-WARE LICENSE" (Revision 42):
4 * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you
5 * can do whatever you want with this stuff. If we meet some day, and you think
6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
7 * ----------------------------------------------------------------------------
8 *
9 * The bioq_disksort() (and the specification of the bioq API)
10 * have been written by Luigi Rizzo and Fabio Checconi under the same
11 * license as above.
12 */
13
14#include <sys/cdefs.h>
15__FBSDID("$FreeBSD: stable/11/sys/kern/subr_disk.c 212160 2010-09-02 19:40:28Z gibbs $");
15__FBSDID("$FreeBSD: stable/11/sys/kern/subr_disk.c 344072 2019-02-13 00:35:09Z mav $");
16
17#include "opt_geom.h"
18
19#include <sys/param.h>
20#include <sys/systm.h>
21#include <sys/bio.h>
22#include <sys/conf.h>
23#include <sys/disk.h>

--- 217 unchanged lines hidden (view full) ---

241 * after any currently queued transactions. They
242 * also have barrier semantics - no transactions
243 * queued in the future can pass them.
244 */
245 bioq_insert_tail(head, bp);
246 return;
247 }
248
16
17#include "opt_geom.h"
18
19#include <sys/param.h>
20#include <sys/systm.h>
21#include <sys/bio.h>
22#include <sys/conf.h>
23#include <sys/disk.h>

--- 217 unchanged lines hidden (view full) ---

241 * after any currently queued transactions. They
242 * also have barrier semantics - no transactions
243 * queued in the future can pass them.
244 */
245 bioq_insert_tail(head, bp);
246 return;
247 }
248
249 /*
250 * We should only sort requests of types that have concept of offset.
251 * Other types, such as BIO_FLUSH or BIO_ZONE, may imply some degree
252 * of ordering even if strict ordering is not requested explicitly.
253 */
254 if (bp->bio_cmd != BIO_READ && bp->bio_cmd != BIO_WRITE &&
255 bp->bio_cmd != BIO_DELETE) {
256 bioq_insert_tail(head, bp);
257 return;
258 }
259
249 prev = NULL;
250 key = bioq_bio_key(head, bp);
251 cur = TAILQ_FIRST(&head->queue);
252
253 if (head->insert_point) {
254 prev = head->insert_point;
255 cur = TAILQ_NEXT(head->insert_point, bio_queue);
256 }
257
258 while (cur != NULL && key >= bioq_bio_key(head, cur)) {
259 prev = cur;
260 cur = TAILQ_NEXT(cur, bio_queue);
261 }
262
263 if (prev == NULL)
264 TAILQ_INSERT_HEAD(&head->queue, bp, bio_queue);
265 else
266 TAILQ_INSERT_AFTER(&head->queue, prev, bp, bio_queue);
267}
260 prev = NULL;
261 key = bioq_bio_key(head, bp);
262 cur = TAILQ_FIRST(&head->queue);
263
264 if (head->insert_point) {
265 prev = head->insert_point;
266 cur = TAILQ_NEXT(head->insert_point, bio_queue);
267 }
268
269 while (cur != NULL && key >= bioq_bio_key(head, cur)) {
270 prev = cur;
271 cur = TAILQ_NEXT(cur, bio_queue);
272 }
273
274 if (prev == NULL)
275 TAILQ_INSERT_HEAD(&head->queue, bp, bio_queue);
276 else
277 TAILQ_INSERT_AFTER(&head->queue, prev, bp, bio_queue);
278}