FreeBSD/sys/fs/nfsclient/nfs_clbio.c
/*
 * Get an nfs cache block.
 *
 * Allocate a new one if the block isn't currently in the cache
 * and return the block marked busy. If the calling process is
 * interrupted by a signal for an interruptible mount point, return
 * NULL.
 *
 * The caller must carefully deal with the possible B_INVAL state of
 * the buffer.  ncl_doio() clears B_INVAL (and ncl_asyncio() clears it
 * indirectly), so synchronous reads can be issued without worrying about
 * the B_INVAL state.  We have to be a little more careful when dealing
 * with writes (see comments in nfs_write()) when extending a file past
 * its EOF.
 */
Get an nfs cache block.
Allocate a new one if the block isn't currently in the cache
and return the block marked busy. If the calling process is
interrupted by a signal for an interruptible mount point, return
NULL.

The caller must carefully deal with the possible B_INVAL state of
the buffer.  ncl_doio() clears B_INVAL (and ncl_asyncio() clears it
indirectly), so synchronous reads can be issued without worrying about
the B_INVAL state.  We have to be a little more careful when dealing
with writes ) when extending a file past
its EOF.
Get an nfs cache block . Allocate a new one if the block isn ' t currently in the cache and return the block marked busy . If the calling process is interrupted by a signal for an interruptible mount point return NULL . The caller must carefully deal with the possible B_INVAL state of the buffer . ncl_doio () clears B_INVAL ( and ncl_asyncio () clears it indirectly ) so synchronous reads can be issued without worrying about the B_INVAL state . We have to be a little more careful when dealing with writes ) when extending a file past its EOF .
static struct buf *
nfs_getcacheblk(struct vnode *vp, daddr_t bn, int size, struct thread *td)
{
	struct buf *bp;
	struct mount *mp;
	struct nfsmount *nmp;
	mp = vp->v_mount;
	nmp = VFSTONFS(mp);
	if (nmp->nm_flag & NFSMNT_INT) {
		sigset_t oldset;
		newnfs_set_sigmask(td, &oldset);
		bp = getblk(vp, bn, size, PCATCH, 0, 0);
		newnfs_restore_sigmask(td, &oldset);
		while (bp == NULL) {
			if (newnfs_sigintr(nmp, td))
				return (NULL);
			bp = getblk(vp, bn, size, 0, 2 * hz, 0);
		}
	} else {
		bp = getblk(vp, bn, size, 0, 0, 0);
	}
	if (vp->v_type == VREG)
		bp->b_blkno = bn * (vp->v_bufobj.bo_bsize / DEV_BSIZE);
	return (bp);
}
static struct buf * nfs_getcacheblk ( struct vnode * vp , daddr_t bn , int size , struct thread * td ) { struct buf * bp ; struct mount * mp ; struct nfsmount * nmp ; mp = vp -> v_mount ; nmp = VFSTONFS ( mp ) ; if ( nmp -> nm_flag & NFSMNT_INT ) { sigset_t oldset ; newnfs_set_sigmask ( td , & oldset ) ; bp = getblk ( vp , bn , size , PCATCH , 0 , 0 ) ; newnfs_restore_sigmask ( td , & oldset ) ; while ( bp == NULL ) { if ( newnfs_sigintr ( nmp , td ) ) return ( NULL ) ; bp = getblk ( vp , bn , size , 0 , 2 * hz , 0 ) ; } } else { bp = getblk ( vp , bn , size , 0 , 0 , 0 ) ; } if ( vp -> v_type == VREG ) bp -> b_blkno = bn * ( vp -> v_bufobj . bo_bsize / DEV_BSIZE ) ; return ( bp ) ; }
Get an nfs cache block.
Get an nfs cache block .