Deleted Added
full compact
vfs_bio.c (137168) vfs_bio.c (137186)
1/*-
2 * Copyright (c) 2004 Poul-Henning Kamp
3 * Copyright (c) 1994,1997 John S. Dyson
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

34 * Author: John S. Dyson
35 * Significant help during the development and debugging phases
36 * had been provided by David Greenman, also of the FreeBSD core team.
37 *
38 * see man buf(9) for more info.
39 */
40
41#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2004 Poul-Henning Kamp
3 * Copyright (c) 1994,1997 John S. Dyson
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

34 * Author: John S. Dyson
35 * Significant help during the development and debugging phases
36 * had been provided by David Greenman, also of the FreeBSD core team.
37 *
38 * see man buf(9) for more info.
39 */
40
41#include <sys/cdefs.h>
42__FBSDID("$FreeBSD: head/sys/kern/vfs_bio.c 137168 2004-11-03 20:17:31Z alc $");
42__FBSDID("$FreeBSD: head/sys/kern/vfs_bio.c 137186 2004-11-04 07:59:57Z phk $");
43
44#include <sys/param.h>
45#include <sys/systm.h>
46#include <sys/bio.h>
47#include <sys/conf.h>
48#include <sys/buf.h>
49#include <sys/devicestat.h>
50#include <sys/eventhandler.h>

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

535 for (i = 0; i < BUFFER_QUEUES; i++)
536 TAILQ_INIT(&bufqueues[i]);
537
538 /* finally, initialize each buffer header and stick on empty q */
539 for (i = 0; i < nbuf; i++) {
540 bp = &buf[i];
541 bzero(bp, sizeof *bp);
542 bp->b_flags = B_INVAL; /* we're just an empty header */
43
44#include <sys/param.h>
45#include <sys/systm.h>
46#include <sys/bio.h>
47#include <sys/conf.h>
48#include <sys/buf.h>
49#include <sys/devicestat.h>
50#include <sys/eventhandler.h>

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

535 for (i = 0; i < BUFFER_QUEUES; i++)
536 TAILQ_INIT(&bufqueues[i]);
537
538 /* finally, initialize each buffer header and stick on empty q */
539 for (i = 0; i < nbuf; i++) {
540 bp = &buf[i];
541 bzero(bp, sizeof *bp);
542 bp->b_flags = B_INVAL; /* we're just an empty header */
543 bp->b_dev = NULL;
544 bp->b_rcred = NOCRED;
545 bp->b_wcred = NOCRED;
546 bp->b_qindex = QUEUE_EMPTY;
547 bp->b_vflags = 0;
548 bp->b_xflags = 0;
549 LIST_INIT(&bp->b_dep);
550 BUF_LOCKINIT(bp);
551 TAILQ_INSERT_TAIL(&bufqueues[QUEUE_EMPTY], bp, b_freelist);

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

1417 if (bp->b_vflags & BV_BKGRDINPROG)
1418 panic("losing buffer 1");
1419 if (bp->b_kvasize) {
1420 bp->b_qindex = QUEUE_EMPTYKVA;
1421 } else {
1422 bp->b_qindex = QUEUE_EMPTY;
1423 }
1424 TAILQ_INSERT_HEAD(&bufqueues[bp->b_qindex], bp, b_freelist);
543 bp->b_rcred = NOCRED;
544 bp->b_wcred = NOCRED;
545 bp->b_qindex = QUEUE_EMPTY;
546 bp->b_vflags = 0;
547 bp->b_xflags = 0;
548 LIST_INIT(&bp->b_dep);
549 BUF_LOCKINIT(bp);
550 TAILQ_INSERT_TAIL(&bufqueues[QUEUE_EMPTY], bp, b_freelist);

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

1416 if (bp->b_vflags & BV_BKGRDINPROG)
1417 panic("losing buffer 1");
1418 if (bp->b_kvasize) {
1419 bp->b_qindex = QUEUE_EMPTYKVA;
1420 } else {
1421 bp->b_qindex = QUEUE_EMPTY;
1422 }
1423 TAILQ_INSERT_HEAD(&bufqueues[bp->b_qindex], bp, b_freelist);
1425 bp->b_dev = NULL;
1426 /* buffers with junk contents */
1427 } else if (bp->b_flags & (B_INVAL | B_NOCACHE | B_RELBUF) ||
1428 (bp->b_ioflags & BIO_ERROR)) {
1429 bp->b_flags |= B_INVAL;
1430 bp->b_xflags &= ~(BX_BKGRDWRITE | BX_ALTDATA);
1431 if (bp->b_vflags & BV_BKGRDINPROG)
1432 panic("losing buffer 2");
1433 bp->b_qindex = QUEUE_CLEAN;
1434 TAILQ_INSERT_HEAD(&bufqueues[QUEUE_CLEAN], bp, b_freelist);
1424 /* buffers with junk contents */
1425 } else if (bp->b_flags & (B_INVAL | B_NOCACHE | B_RELBUF) ||
1426 (bp->b_ioflags & BIO_ERROR)) {
1427 bp->b_flags |= B_INVAL;
1428 bp->b_xflags &= ~(BX_BKGRDWRITE | BX_ALTDATA);
1429 if (bp->b_vflags & BV_BKGRDINPROG)
1430 panic("losing buffer 2");
1431 bp->b_qindex = QUEUE_CLEAN;
1432 TAILQ_INSERT_HEAD(&bufqueues[QUEUE_CLEAN], bp, b_freelist);
1435 bp->b_dev = NULL;
1436 /* remaining buffers */
1437 } else {
1438 if (bp->b_flags & B_DELWRI)
1439 bp->b_qindex = QUEUE_DIRTY;
1440 else
1441 bp->b_qindex = QUEUE_CLEAN;
1442 if (bp->b_flags & B_AGE)
1443 TAILQ_INSERT_HEAD(&bufqueues[bp->b_qindex], bp, b_freelist);

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

1920
1921 if (bp->b_bufsize)
1922 allocbuf(bp, 0);
1923
1924 bp->b_flags = 0;
1925 bp->b_ioflags = 0;
1926 bp->b_xflags = 0;
1927 bp->b_vflags = 0;
1433 /* remaining buffers */
1434 } else {
1435 if (bp->b_flags & B_DELWRI)
1436 bp->b_qindex = QUEUE_DIRTY;
1437 else
1438 bp->b_qindex = QUEUE_CLEAN;
1439 if (bp->b_flags & B_AGE)
1440 TAILQ_INSERT_HEAD(&bufqueues[bp->b_qindex], bp, b_freelist);

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

1917
1918 if (bp->b_bufsize)
1919 allocbuf(bp, 0);
1920
1921 bp->b_flags = 0;
1922 bp->b_ioflags = 0;
1923 bp->b_xflags = 0;
1924 bp->b_vflags = 0;
1928 bp->b_dev = NULL;
1929 bp->b_vp = NULL;
1930 bp->b_blkno = bp->b_lblkno = 0;
1931 bp->b_offset = NOOFFSET;
1932 bp->b_iodone = 0;
1933 bp->b_error = 0;
1934 bp->b_resid = 0;
1935 bp->b_bcount = 0;
1936 bp->b_npages = 0;

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

3868 if (!have_addr) {
3869 db_printf("usage: show buffer <addr>\n");
3870 return;
3871 }
3872
3873 db_printf("b_flags = 0x%b\n", (u_int)bp->b_flags, PRINT_BUF_FLAGS);
3874 db_printf(
3875 "b_error = %d, b_bufsize = %ld, b_bcount = %ld, b_resid = %ld\n"
1925 bp->b_vp = NULL;
1926 bp->b_blkno = bp->b_lblkno = 0;
1927 bp->b_offset = NOOFFSET;
1928 bp->b_iodone = 0;
1929 bp->b_error = 0;
1930 bp->b_resid = 0;
1931 bp->b_bcount = 0;
1932 bp->b_npages = 0;

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

3864 if (!have_addr) {
3865 db_printf("usage: show buffer <addr>\n");
3866 return;
3867 }
3868
3869 db_printf("b_flags = 0x%b\n", (u_int)bp->b_flags, PRINT_BUF_FLAGS);
3870 db_printf(
3871 "b_error = %d, b_bufsize = %ld, b_bcount = %ld, b_resid = %ld\n"
3876 "b_dev = (%d,%d), b_data = %p, b_blkno = %jd\n",
3872 "b_bufobj = (%p), b_data = %p, b_blkno = %jd\n",
3877 bp->b_error, bp->b_bufsize, bp->b_bcount, bp->b_resid,
3873 bp->b_error, bp->b_bufsize, bp->b_bcount, bp->b_resid,
3878 major(bp->b_dev), minor(bp->b_dev), bp->b_data,
3879 (intmax_t)bp->b_blkno);
3874 bp->b_bufobj, bp->b_data, (intmax_t)bp->b_blkno);
3880 if (bp->b_npages) {
3881 int i;
3882 db_printf("b_npages = %d, pages(OBJ, IDX, PA): ", bp->b_npages);
3883 for (i = 0; i < bp->b_npages; i++) {
3884 vm_page_t m;
3885 m = bp->b_pages[i];
3886 db_printf("(%p, 0x%lx, 0x%lx)", (void *)m->object,
3887 (u_long)m->pindex, (u_long)VM_PAGE_TO_PHYS(m));
3888 if ((i + 1) < bp->b_npages)
3889 db_printf(",");
3890 }
3891 db_printf("\n");
3892 }
3893}
3894#endif /* DDB */
3875 if (bp->b_npages) {
3876 int i;
3877 db_printf("b_npages = %d, pages(OBJ, IDX, PA): ", bp->b_npages);
3878 for (i = 0; i < bp->b_npages; i++) {
3879 vm_page_t m;
3880 m = bp->b_pages[i];
3881 db_printf("(%p, 0x%lx, 0x%lx)", (void *)m->object,
3882 (u_long)m->pindex, (u_long)VM_PAGE_TO_PHYS(m));
3883 if ((i + 1) < bp->b_npages)
3884 db_printf(",");
3885 }
3886 db_printf("\n");
3887 }
3888}
3889#endif /* DDB */