* Copyright (c) 1982, 1986, 1989 Regents of the University of California.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* from: @(#)vfs_bio.c 7.40 (Berkeley) 5/8/91
* Initialize buffers and hash links for buffers.
* Find the block in the buffer pool.
* If the buffer is not present, allocate a new buffer and load
* its contents according to the filesystem fill routine.
bread(vp
, blkno
, size
, cred
, bpp
)
* Operates like bread, but also starts I/O on the specified
breada(vp
, blkno
, size
, rablkno
, rabsize
, cred
, bpp
)
daddr_t rablkno
; int rabsize
;
* Release buffer on completion.
* The buffer is marked dirty, but is not queued for I/O.
* This routine should be used when the buffer is expected
* to be modified again soon, typically a small write that
* partially fills a buffer.
* NB: magnetic tapes cannot be delayed; they must be
* written in the order that the writes are requested.
* Start I/O on a buffer, but do not wait for it to complete.
* The buffer is released when the I/O completes.
* Even if the buffer is dirty, no I/O is started.
* Check to see if a block is currently memory resident.
* Check to see if a block is currently memory resident.
* If it is resident, return it. If it is not resident,
* allocate a new buffer and assign it to the block.
register struct vnode
*vp
;
* The caller will assign it to a block.
* Expand or contract the actual memory allocated to a buffer.
* If no memory is available, release buffer and take error exit.
* Find a buffer which is available for use.
* Select something from a free list.
* Preference is to AGE list, then LRU list.
* Wait for I/O to complete.
* Extract and return any errors associated with the I/O.
* If the error flag is set, but no specific error is
* Mark I/O complete on a buffer.
* If a callback has been requested, e.g. the pageout
* daemon, do so. Otherwise, awaken waiting processes.