diff options
author | phk <phk@FreeBSD.org> | 2000-03-20 10:44:49 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2000-03-20 10:44:49 +0000 |
commit | a246e10f55686681d4b6bd4dba5ca661b4e34bb0 (patch) | |
tree | 13a3ded179bf1de0aff7c33b0eba0534aa2dcf09 /sys/ufs/mfs/mfs_vnops.c | |
parent | f274a82c1448c090620cb35f8516831602a12658 (diff) | |
download | FreeBSD-src-a246e10f55686681d4b6bd4dba5ca661b4e34bb0.zip FreeBSD-src-a246e10f55686681d4b6bd4dba5ca661b4e34bb0.tar.gz |
Remove B_READ, B_WRITE and B_FREEBUF and replace them with a new
field in struct buf: b_iocmd. The b_iocmd is enforced to have
exactly one bit set.
B_WRITE was bogusly defined as zero giving rise to obvious coding
mistakes.
Also eliminate the redundant struct buf flag B_CALL, it can just
as efficiently be done by comparing b_iodone to NULL.
Should you get a panic or drop into the debugger, complaining about
"b_iocmd", don't continue. It is likely to write on your disk
where it should have been reading.
This change is a step in the direction towards a stackable BIO capability.
A lot of this patch were machine generated (Thanks to style(9) compliance!)
Vinum users: Greg has not had time to test this yet, be careful.
Diffstat (limited to 'sys/ufs/mfs/mfs_vnops.c')
-rw-r--r-- | sys/ufs/mfs/mfs_vnops.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/sys/ufs/mfs/mfs_vnops.c b/sys/ufs/mfs/mfs_vnops.c index ad691df..8f00850 100644 --- a/sys/ufs/mfs/mfs_vnops.c +++ b/sys/ufs/mfs/mfs_vnops.c @@ -123,7 +123,7 @@ mfs_fsync(ap) /* * mfs_freeblks() - hook to allow us to free physical memory. * - * We implement the B_FREEBUF strategy. We can't just madvise() + * We implement the BIO_DELETE strategy. We can't just madvise() * here because we have to do it in the correct order vs other bio * requests, so we queue it. * @@ -146,7 +146,8 @@ mfs_freeblks(ap) panic("mfs_freeblks: bad dev"); bp = geteblk(ap->a_length); - bp->b_flags |= B_FREEBUF | B_ASYNC; + bp->b_flags |= B_ASYNC; + bp->b_iocmd = BIO_DELETE; bp->b_dev = ap->a_vp->v_rdev; bp->b_blkno = ap->a_addr; bp->b_offset = dbtob(ap->a_addr); @@ -185,15 +186,15 @@ mfs_strategy(ap) if (mfsp->mfs_pid == 0) { /* - * mini-root. Note: B_FREEBUF not supported at the moment, + * mini-root. Note: BIO_DELETE not supported at the moment, * I'm not sure what kind of dataspace b_data is in. */ caddr_t base; base = mfsp->mfs_baseoff + (bp->b_blkno << DEV_BSHIFT); - if (bp->b_flags & B_FREEBUF) + if (bp->b_iocmd == BIO_DELETE) ; - if (bp->b_flags & B_READ) + if (bp->b_iocmd == BIO_READ) bcopy(base, bp->b_data, bp->b_bcount); else bcopy(bp->b_data, base, bp->b_bcount); @@ -224,7 +225,7 @@ mfs_strategy(ap) * * Read and Write are handled with a simple copyin and copyout. * - * We also partially support VOP_FREEBLKS() via B_FREEBUF. We can't implement + * We also partially support VOP_FREEBLKS() via BIO_DELETE. We can't implement * completely -- for example, on fragments or inode metadata, but we can * implement it for page-aligned requests. */ @@ -235,9 +236,9 @@ mfs_doio(bp, mfsp) { caddr_t base = mfsp->mfs_baseoff + (bp->b_blkno << DEV_BSHIFT); - if (bp->b_flags & B_FREEBUF) { + if (bp->b_iocmd == BIO_DELETE) { /* - * Implement B_FREEBUF, which allows the filesystem to tell + * Implement BIO_DELETE, which allows the filesystem to tell * a block device when blocks are no longer needed (like when * a file is deleted). We use the hook to MADV_FREE the VM. * This makes an MFS filesystem work as well or better then @@ -263,7 +264,7 @@ mfs_doio(bp, mfsp) } } bp->b_error = 0; - } else if (bp->b_flags & B_READ) { + } else if (bp->b_iocmd == BIO_READ) { /* * Read data from our 'memory' disk */ |