1/* 2 * Copyright (c) 1994,1997 John S. Dyson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice immediately at the beginning of the file, without modification, 10 * this list of conditions, and the following disclaimer. 11 * 2. Absolutely no warranty of function or purpose is made by the author 12 * John S. Dyson. 13 * |
14 * $FreeBSD: head/sys/kern/vfs_bio.c 59249 2000-04-15 05:54:02Z phk $ |
15 */ 16 17/* 18 * this file contains a new buffer I/O scheme implementing a coherent 19 * VM object and buffer cache scheme. Pains have been taken to make 20 * sure that the performance degradation associated with schemes such 21 * as this is not realized. 22 * --- 675 unchanged lines hidden (view full) --- 698 * This buffer is marked B_NOCACHE, so when it is released 699 * by biodone, it will be tossed. We mark it with BIO_READ 700 * to avoid biodone doing a second vwakeup. 701 */ 702 bp->b_flags |= B_NOCACHE; 703 bp->b_iocmd = BIO_READ; 704 bp->b_flags &= ~(B_CACHE | B_DONE); 705 bp->b_iodone = 0; |
706 bufdone(bp); |
707} 708 709/* 710 * Delayed write. (Buffer is marked dirty). Do not bother writing 711 * anything if the buffer is marked invalid. 712 * 713 * Note that since the buffer must be completely valid, we can safely 714 * set B_CACHE. In fact, we have to set B_CACHE here rather then in --- 1907 unchanged lines hidden (view full) --- 2622 * read error occured, or if the op was a write. B_CACHE is never 2623 * set if the buffer is invalid or otherwise uncacheable. 2624 * 2625 * biodone does not mess with B_INVAL, allowing the I/O routine or the 2626 * initiator to leave B_INVAL set to brelse the buffer out of existance 2627 * in the biodone routine. 2628 */ 2629void |
2630biodone(struct bio * bip) |
2631{ |
2632 bufdone((struct buf *)bip); 2633} 2634 2635void 2636bufdone(struct buf *bp) 2637{ |
2638 int s; 2639 void (*biodone) __P((struct buf *)); 2640 2641 s = splbio(); 2642 2643 KASSERT(BUF_REFCNT(bp) > 0, ("biodone: bp %p not busy %d", bp, BUF_REFCNT(bp))); 2644 KASSERT(!(bp->b_flags & B_DONE), ("biodone: bp %p already done", bp)); 2645 --- 537 unchanged lines hidden --- |