mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-25 16:13:17 +00:00
- Add a new 'flags' parameter to getblk().
- Define one flag GB_LOCK_NOWAIT that tells getblk() to pass the LK_NOWAIT flag to the initial BUF_LOCK(). This will eventually be used in cases were we want to use a buffer only if it is not currently in use. - Convert all consumers of the getblk() api to use this extra parameter. Reviwed by: arch Not objected to by: mckusick
This commit is contained in:
parent
f727171140
commit
7261f5f68e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=111856
@ -181,7 +181,7 @@ hpfs_allocalsec (
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
bp = getblk(hpmp->hpm_devvp, lsn, DEV_BSIZE, 0, 0);
|
||||
bp = getblk(hpmp->hpm_devvp, lsn, DEV_BSIZE, 0, 0, 0);
|
||||
clrbuf(bp);
|
||||
|
||||
/* Fill AlSec info */
|
||||
|
@ -75,7 +75,7 @@ hpfs_bmdeinit(
|
||||
dprintf(("[%d: 0x%x] ", i, hpmp->hpm_bmind[i]));
|
||||
|
||||
bp = getblk(hpmp->hpm_devvp, hpmp->hpm_bmind[i],
|
||||
BMSIZE, 0, 0);
|
||||
BMSIZE, 0, 0, 0);
|
||||
clrbuf(bp);
|
||||
|
||||
bcopy(hpmp->hpm_bitmap + BMSIZE * i, bp->b_data,
|
||||
@ -732,7 +732,7 @@ hpfs_update (
|
||||
if (!(hp->h_flag & H_CHANGE))
|
||||
return (0);
|
||||
|
||||
bp = getblk(hp->h_devvp, hp->h_no, FNODESIZE, 0, 0);
|
||||
bp = getblk(hp->h_devvp, hp->h_no, FNODESIZE, 0, 0, 0);
|
||||
clrbuf(bp);
|
||||
|
||||
bcopy (&hp->h_fn, bp->b_data, sizeof(struct fnode));
|
||||
|
@ -372,7 +372,7 @@ hpfs_write(ap)
|
||||
bn, runl, towrite, xfersz));
|
||||
|
||||
if ((off == 0) && (towrite == xfersz)) {
|
||||
bp = getblk(hp->h_devvp, bn, xfersz, 0, 0);
|
||||
bp = getblk(hp->h_devvp, bn, xfersz, 0, 0, 0);
|
||||
clrbuf(bp);
|
||||
} else {
|
||||
error = bread(hp->h_devvp, bn, xfersz, NOCRED, &bp);
|
||||
|
@ -398,7 +398,8 @@ updatefats(pmp, bp, fatbn)
|
||||
for (i = 1; i < pmp->pm_FATs; i++) {
|
||||
fatbn += pmp->pm_FATsecs;
|
||||
/* getblk() never fails */
|
||||
bpn = getblk(pmp->pm_devvp, fatbn, bp->b_bcount, 0, 0);
|
||||
bpn = getblk(pmp->pm_devvp, fatbn, bp->b_bcount,
|
||||
0, 0, 0);
|
||||
bcopy(bp->b_data, bpn->b_data, bp->b_bcount);
|
||||
if (pmp->pm_flags & MSDOSFSMNT_WAITONFAT)
|
||||
bwrite(bpn);
|
||||
@ -1074,11 +1075,13 @@ extendfile(dep, count, bpp, ncp, flags)
|
||||
* Get the buf header for the new block of the file.
|
||||
*/
|
||||
if (dep->de_Attributes & ATTR_DIRECTORY)
|
||||
bp = getblk(pmp->pm_devvp, cntobn(pmp, cn++),
|
||||
pmp->pm_bpcluster, 0, 0);
|
||||
bp = getblk(pmp->pm_devvp,
|
||||
cntobn(pmp, cn++),
|
||||
pmp->pm_bpcluster, 0, 0, 0);
|
||||
else {
|
||||
bp = getblk(DETOV(dep), de_cn2bn(pmp, frcn++),
|
||||
pmp->pm_bpcluster, 0, 0);
|
||||
bp = getblk(DETOV(dep),
|
||||
de_cn2bn(pmp, frcn++),
|
||||
pmp->pm_bpcluster, 0, 0, 0);
|
||||
/*
|
||||
* Do the bmap now, as in msdosfs_write
|
||||
*/
|
||||
|
@ -711,7 +711,7 @@ msdosfs_write(ap)
|
||||
* or we write the cluster from its start beyond EOF,
|
||||
* then no need to read data from disk.
|
||||
*/
|
||||
bp = getblk(thisvp, bn, pmp->pm_bpcluster, 0, 0);
|
||||
bp = getblk(thisvp, bn, pmp->pm_bpcluster, 0, 0, 0);
|
||||
clrbuf(bp);
|
||||
/*
|
||||
* Do the bmap now, since pcbmap needs buffers
|
||||
@ -1301,7 +1301,7 @@ msdosfs_mkdir(ap)
|
||||
*/
|
||||
bn = cntobn(pmp, newcluster);
|
||||
/* always succeeds */
|
||||
bp = getblk(pmp->pm_devvp, bn, pmp->pm_bpcluster, 0, 0);
|
||||
bp = getblk(pmp->pm_devvp, bn, pmp->pm_bpcluster, 0, 0, 0);
|
||||
bzero(bp->b_data, pmp->pm_bpcluster);
|
||||
bcopy(&dosdirtemplate, bp->b_data, sizeof dosdirtemplate);
|
||||
denp = (struct direntry *)bp->b_data;
|
||||
|
@ -1453,7 +1453,7 @@ ntfs_writentvattr_plain(
|
||||
if ((off == 0) && (tocopy == ntfs_cntob(cl)))
|
||||
{
|
||||
bp = getblk(ntmp->ntm_devvp, ntfs_cntobn(cn),
|
||||
ntfs_cntob(cl), 0, 0);
|
||||
ntfs_cntob(cl), 0, 0, 0);
|
||||
clrbuf(bp);
|
||||
} else {
|
||||
error = bread(ntmp->ntm_devvp, ntfs_cntobn(cn),
|
||||
|
@ -147,7 +147,7 @@ ext2_debug("ext2_balloc called (%d, %d, %d)\n",
|
||||
nsize, cred, &newb);
|
||||
if (error)
|
||||
return (error);
|
||||
bp = getblk(vp, bn, nsize, 0, 0);
|
||||
bp = getblk(vp, bn, nsize, 0, 0, 0);
|
||||
bp->b_blkno = fsbtodb(fs, newb);
|
||||
if (flags & B_CLRBUF)
|
||||
vfs_bio_clrbuf(bp);
|
||||
@ -194,7 +194,7 @@ ext2_debug("ext2_balloc called (%d, %d, %d)\n",
|
||||
cred, &newb)) != 0)
|
||||
return (error);
|
||||
nb = newb;
|
||||
bp = getblk(vp, indirs[1].in_lbn, fs->s_blocksize, 0, 0);
|
||||
bp = getblk(vp, indirs[1].in_lbn, fs->s_blocksize, 0, 0, 0);
|
||||
bp->b_blkno = fsbtodb(fs, newb);
|
||||
vfs_bio_clrbuf(bp);
|
||||
/*
|
||||
@ -246,7 +246,7 @@ ext2_debug("ext2_balloc called (%d, %d, %d)\n",
|
||||
return (error);
|
||||
}
|
||||
nb = newb;
|
||||
nbp = getblk(vp, indirs[i].in_lbn, fs->s_blocksize, 0, 0);
|
||||
nbp = getblk(vp, indirs[i].in_lbn, fs->s_blocksize, 0, 0, 0);
|
||||
nbp->b_blkno = fsbtodb(fs, nb);
|
||||
vfs_bio_clrbuf(nbp);
|
||||
/*
|
||||
@ -281,7 +281,7 @@ ext2_debug("ext2_balloc called (%d, %d, %d)\n",
|
||||
return (error);
|
||||
}
|
||||
nb = newb;
|
||||
nbp = getblk(vp, lbn, fs->s_blocksize, 0, 0);
|
||||
nbp = getblk(vp, lbn, fs->s_blocksize, 0, 0, 0);
|
||||
nbp->b_blkno = fsbtodb(fs, nb);
|
||||
if (flags & B_CLRBUF)
|
||||
vfs_bio_clrbuf(nbp);
|
||||
@ -306,7 +306,7 @@ ext2_debug("ext2_balloc called (%d, %d, %d)\n",
|
||||
return (error);
|
||||
}
|
||||
} else {
|
||||
nbp = getblk(vp, lbn, fs->s_blocksize, 0, 0);
|
||||
nbp = getblk(vp, lbn, fs->s_blocksize, 0, 0, 0);
|
||||
nbp->b_blkno = fsbtodb(fs, nb);
|
||||
}
|
||||
*bpp = nbp;
|
||||
|
@ -185,7 +185,7 @@ ext2_bmaparray(vp, bn, bnp, runp, runb)
|
||||
bqrelse(bp);
|
||||
|
||||
ap->in_exists = 1;
|
||||
bp = getblk(vp, metalbn, mp->mnt_stat.f_iosize, 0, 0);
|
||||
bp = getblk(vp, metalbn, mp->mnt_stat.f_iosize, 0, 0, 0);
|
||||
if ((bp->b_flags & B_CACHE) == 0) {
|
||||
#ifdef DIAGNOSTIC
|
||||
if (!daddr)
|
||||
|
@ -396,7 +396,7 @@ ext2_indirtrunc(ip, lbn, dbn, lastbn, level, countp)
|
||||
* explicitly instead of letting bread do everything for us.
|
||||
*/
|
||||
vp = ITOV(ip);
|
||||
bp = getblk(vp, lbn, (int)fs->s_blocksize, 0, 0);
|
||||
bp = getblk(vp, lbn, (int)fs->s_blocksize, 0, 0, 0);
|
||||
if (bp->b_flags & (B_DONE | B_DELWRI)) {
|
||||
} else {
|
||||
bp->b_iocmd = BIO_READ;
|
||||
|
@ -1179,7 +1179,7 @@ ext2_sbupdate(mp, waitfor)
|
||||
/*
|
||||
printf("\nupdating superblock, waitfor=%s\n", waitfor == MNT_WAIT ? "yes":"no");
|
||||
*/
|
||||
bp = getblk(mp->um_devvp, SBLOCK, SBSIZE, 0, 0);
|
||||
bp = getblk(mp->um_devvp, SBLOCK, SBSIZE, 0, 0, 0);
|
||||
bcopy((caddr_t)es, bp->b_data, (u_int)sizeof(struct ext2_super_block));
|
||||
if (waitfor == MNT_WAIT)
|
||||
error = bwrite(bp);
|
||||
|
@ -147,7 +147,7 @@ ext2_debug("ext2_balloc called (%d, %d, %d)\n",
|
||||
nsize, cred, &newb);
|
||||
if (error)
|
||||
return (error);
|
||||
bp = getblk(vp, bn, nsize, 0, 0);
|
||||
bp = getblk(vp, bn, nsize, 0, 0, 0);
|
||||
bp->b_blkno = fsbtodb(fs, newb);
|
||||
if (flags & B_CLRBUF)
|
||||
vfs_bio_clrbuf(bp);
|
||||
@ -194,7 +194,7 @@ ext2_debug("ext2_balloc called (%d, %d, %d)\n",
|
||||
cred, &newb)) != 0)
|
||||
return (error);
|
||||
nb = newb;
|
||||
bp = getblk(vp, indirs[1].in_lbn, fs->s_blocksize, 0, 0);
|
||||
bp = getblk(vp, indirs[1].in_lbn, fs->s_blocksize, 0, 0, 0);
|
||||
bp->b_blkno = fsbtodb(fs, newb);
|
||||
vfs_bio_clrbuf(bp);
|
||||
/*
|
||||
@ -246,7 +246,7 @@ ext2_debug("ext2_balloc called (%d, %d, %d)\n",
|
||||
return (error);
|
||||
}
|
||||
nb = newb;
|
||||
nbp = getblk(vp, indirs[i].in_lbn, fs->s_blocksize, 0, 0);
|
||||
nbp = getblk(vp, indirs[i].in_lbn, fs->s_blocksize, 0, 0, 0);
|
||||
nbp->b_blkno = fsbtodb(fs, nb);
|
||||
vfs_bio_clrbuf(nbp);
|
||||
/*
|
||||
@ -281,7 +281,7 @@ ext2_debug("ext2_balloc called (%d, %d, %d)\n",
|
||||
return (error);
|
||||
}
|
||||
nb = newb;
|
||||
nbp = getblk(vp, lbn, fs->s_blocksize, 0, 0);
|
||||
nbp = getblk(vp, lbn, fs->s_blocksize, 0, 0, 0);
|
||||
nbp->b_blkno = fsbtodb(fs, nb);
|
||||
if (flags & B_CLRBUF)
|
||||
vfs_bio_clrbuf(nbp);
|
||||
@ -306,7 +306,7 @@ ext2_debug("ext2_balloc called (%d, %d, %d)\n",
|
||||
return (error);
|
||||
}
|
||||
} else {
|
||||
nbp = getblk(vp, lbn, fs->s_blocksize, 0, 0);
|
||||
nbp = getblk(vp, lbn, fs->s_blocksize, 0, 0, 0);
|
||||
nbp->b_blkno = fsbtodb(fs, nb);
|
||||
}
|
||||
*bpp = nbp;
|
||||
|
@ -185,7 +185,7 @@ ext2_bmaparray(vp, bn, bnp, runp, runb)
|
||||
bqrelse(bp);
|
||||
|
||||
ap->in_exists = 1;
|
||||
bp = getblk(vp, metalbn, mp->mnt_stat.f_iosize, 0, 0);
|
||||
bp = getblk(vp, metalbn, mp->mnt_stat.f_iosize, 0, 0, 0);
|
||||
if ((bp->b_flags & B_CACHE) == 0) {
|
||||
#ifdef DIAGNOSTIC
|
||||
if (!daddr)
|
||||
|
@ -396,7 +396,7 @@ ext2_indirtrunc(ip, lbn, dbn, lastbn, level, countp)
|
||||
* explicitly instead of letting bread do everything for us.
|
||||
*/
|
||||
vp = ITOV(ip);
|
||||
bp = getblk(vp, lbn, (int)fs->s_blocksize, 0, 0);
|
||||
bp = getblk(vp, lbn, (int)fs->s_blocksize, 0, 0, 0);
|
||||
if (bp->b_flags & (B_DONE | B_DELWRI)) {
|
||||
} else {
|
||||
bp->b_iocmd = BIO_READ;
|
||||
|
@ -1179,7 +1179,7 @@ ext2_sbupdate(mp, waitfor)
|
||||
/*
|
||||
printf("\nupdating superblock, waitfor=%s\n", waitfor == MNT_WAIT ? "yes":"no");
|
||||
*/
|
||||
bp = getblk(mp->um_devvp, SBLOCK, SBSIZE, 0, 0);
|
||||
bp = getblk(mp->um_devvp, SBLOCK, SBSIZE, 0, 0, 0);
|
||||
bcopy((caddr_t)es, bp->b_data, (u_int)sizeof(struct ext2_super_block));
|
||||
if (waitfor == MNT_WAIT)
|
||||
error = bwrite(bp);
|
||||
|
@ -680,7 +680,7 @@ breadn(struct vnode * vp, daddr_t blkno, int size,
|
||||
int i;
|
||||
int rv = 0, readwait = 0;
|
||||
|
||||
*bpp = bp = getblk(vp, blkno, size, 0, 0);
|
||||
*bpp = bp = getblk(vp, blkno, size, 0, 0, 0);
|
||||
|
||||
/* if not found in cache, do some I/O */
|
||||
if ((bp->b_flags & B_CACHE) == 0) {
|
||||
@ -702,7 +702,7 @@ breadn(struct vnode * vp, daddr_t blkno, int size,
|
||||
for (i = 0; i < cnt; i++, rablkno++, rabsize++) {
|
||||
if (inmem(vp, *rablkno))
|
||||
continue;
|
||||
rabp = getblk(vp, *rablkno, *rabsize, 0, 0);
|
||||
rabp = getblk(vp, *rablkno, *rabsize, 0, 0, 0);
|
||||
|
||||
if ((rabp->b_flags & B_CACHE) == 0) {
|
||||
if (curthread != PCPU_GET(idlethread))
|
||||
@ -2367,7 +2367,8 @@ vfs_setdirty(struct buf *bp)
|
||||
* prior to issuing the READ. biodone() will *not* clear B_INVAL.
|
||||
*/
|
||||
struct buf *
|
||||
getblk(struct vnode * vp, daddr_t blkno, int size, int slpflag, int slptimeo)
|
||||
getblk(struct vnode * vp, daddr_t blkno, int size, int slpflag, int slptimeo,
|
||||
int flags)
|
||||
{
|
||||
struct buf *bp;
|
||||
int s;
|
||||
@ -2399,13 +2400,17 @@ getblk(struct vnode * vp, daddr_t blkno, int size, int slpflag, int slptimeo)
|
||||
|
||||
VI_LOCK(vp);
|
||||
if ((bp = gbincore(vp, blkno))) {
|
||||
int lockflags;
|
||||
/*
|
||||
* Buffer is in-core. If the buffer is not busy, it must
|
||||
* be on a queue.
|
||||
*/
|
||||
lockflags = LK_EXCLUSIVE | LK_SLEEPFAIL | LK_INTERLOCK;
|
||||
|
||||
error = BUF_TIMELOCK(bp,
|
||||
LK_EXCLUSIVE | LK_SLEEPFAIL | LK_INTERLOCK,
|
||||
if (flags & GB_LOCK_NOWAIT)
|
||||
lockflags |= LK_NOWAIT;
|
||||
|
||||
error = BUF_TIMELOCK(bp, lockflags,
|
||||
VI_MTX(vp), "getblk", slpflag, slptimeo);
|
||||
|
||||
/*
|
||||
|
@ -125,7 +125,7 @@ cluster_read(vp, filesize, lblkno, size, cred, totread, seqcount, bpp)
|
||||
/*
|
||||
* get the requested block
|
||||
*/
|
||||
*bpp = reqbp = bp = getblk(vp, lblkno, size, 0, 0);
|
||||
*bpp = reqbp = bp = getblk(vp, lblkno, size, 0, 0, 0);
|
||||
origblkno = lblkno;
|
||||
origtotread = totread;
|
||||
|
||||
@ -243,7 +243,7 @@ cluster_read(vp, filesize, lblkno, size, cred, totread, seqcount, bpp)
|
||||
rbp = cluster_rbuild(vp, filesize, lblkno,
|
||||
blkno, size, ntoread, NULL);
|
||||
} else {
|
||||
rbp = getblk(vp, lblkno, size, 0, 0);
|
||||
rbp = getblk(vp, lblkno, size, 0, 0, 0);
|
||||
rbp->b_flags |= B_ASYNC | B_RAM;
|
||||
rbp->b_iocmd = BIO_READ;
|
||||
rbp->b_blkno = blkno;
|
||||
@ -349,7 +349,7 @@ cluster_rbuild(vp, filesize, lbn, blkno, size, run, fbp)
|
||||
tbp = fbp;
|
||||
tbp->b_iocmd = BIO_READ;
|
||||
} else {
|
||||
tbp = getblk(vp, lbn, size, 0, 0);
|
||||
tbp = getblk(vp, lbn, size, 0, 0, 0);
|
||||
if (tbp->b_flags & B_CACHE)
|
||||
return tbp;
|
||||
tbp->b_flags |= B_ASYNC | B_RAM;
|
||||
@ -420,7 +420,7 @@ cluster_rbuild(vp, filesize, lbn, blkno, size, run, fbp)
|
||||
break;
|
||||
}
|
||||
|
||||
tbp = getblk(vp, lbn + i, size, 0, 0);
|
||||
tbp = getblk(vp, lbn + i, size, 0, 0, 0);
|
||||
|
||||
/*
|
||||
* Stop scanning if the buffer is fully valid
|
||||
|
@ -1032,14 +1032,14 @@ nfs_getcacheblk(struct vnode *vp, daddr_t bn, int size, struct thread *td)
|
||||
nmp = VFSTONFS(mp);
|
||||
|
||||
if (nmp->nm_flag & NFSMNT_INT) {
|
||||
bp = getblk(vp, bn, size, PCATCH, 0);
|
||||
bp = getblk(vp, bn, size, PCATCH, 0, 0);
|
||||
while (bp == NULL) {
|
||||
if (nfs_sigintr(nmp, NULL, td))
|
||||
return (NULL);
|
||||
bp = getblk(vp, bn, size, 0, 2 * hz);
|
||||
bp = getblk(vp, bn, size, 0, 2 * hz, 0);
|
||||
}
|
||||
} else {
|
||||
bp = getblk(vp, bn, size, 0, 0);
|
||||
bp = getblk(vp, bn, size, 0, 0, 0);
|
||||
}
|
||||
|
||||
if (vp->v_type == VREG) {
|
||||
|
@ -455,6 +455,11 @@ buf_countdeps(struct buf *bp, int i)
|
||||
(bp)->b_resid = 0; \
|
||||
}
|
||||
|
||||
/*
|
||||
* Flags for getblk's last parameter.
|
||||
*/
|
||||
#define GB_LOCK_NOWAIT 0x0001 /* Fail if we block on a buf lock. */
|
||||
|
||||
#ifdef _KERNEL
|
||||
extern int nbuf; /* The number of buffer headers */
|
||||
extern int maxswzone; /* Max KVA for swap structures */
|
||||
@ -489,7 +494,7 @@ struct buf * getpbuf(int *);
|
||||
struct buf *incore(struct vnode *, daddr_t);
|
||||
struct buf *gbincore(struct vnode *, daddr_t);
|
||||
int inmem(struct vnode *, daddr_t);
|
||||
struct buf *getblk(struct vnode *, daddr_t, int, int, int);
|
||||
struct buf *getblk(struct vnode *, daddr_t, int, int, int, int);
|
||||
struct buf *geteblk(int);
|
||||
int bufwait(struct buf *);
|
||||
void bufdone(struct buf *);
|
||||
|
@ -1626,7 +1626,7 @@ ffs_nodealloccg(ip, cg, ipref, mode)
|
||||
cgp->cg_initediblk < cgp->cg_niblk) {
|
||||
ibp = getblk(ip->i_devvp, fsbtodb(fs,
|
||||
ino_to_fsba(fs, cg * fs->fs_ipg + cgp->cg_initediblk)),
|
||||
(int)fs->fs_bsize, 0, 0);
|
||||
(int)fs->fs_bsize, 0, 0, 0);
|
||||
bzero(ibp->b_data, (int)fs->fs_bsize);
|
||||
dp2 = (struct ufs2_dinode *)(ibp->b_data);
|
||||
for (i = 0; i < INOPB(fs); i++) {
|
||||
|
@ -176,7 +176,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size,
|
||||
nsize, cred, &newb);
|
||||
if (error)
|
||||
return (error);
|
||||
bp = getblk(vp, lbn, nsize, 0, 0);
|
||||
bp = getblk(vp, lbn, nsize, 0, 0, 0);
|
||||
bp->b_blkno = fsbtodb(fs, newb);
|
||||
if (flags & BA_CLRBUF)
|
||||
vfs_bio_clrbuf(bp);
|
||||
@ -213,7 +213,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size,
|
||||
return (error);
|
||||
nb = newb;
|
||||
*allocblk++ = nb;
|
||||
bp = getblk(vp, indirs[1].in_lbn, fs->fs_bsize, 0, 0);
|
||||
bp = getblk(vp, indirs[1].in_lbn, fs->fs_bsize, 0, 0, 0);
|
||||
bp->b_blkno = fsbtodb(fs, nb);
|
||||
vfs_bio_clrbuf(bp);
|
||||
if (DOINGSOFTDEP(vp)) {
|
||||
@ -262,7 +262,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size,
|
||||
}
|
||||
nb = newb;
|
||||
*allocblk++ = nb;
|
||||
nbp = getblk(vp, indirs[i].in_lbn, fs->fs_bsize, 0, 0);
|
||||
nbp = getblk(vp, indirs[i].in_lbn, fs->fs_bsize, 0, 0, 0);
|
||||
nbp->b_blkno = fsbtodb(fs, nb);
|
||||
vfs_bio_clrbuf(nbp);
|
||||
if (DOINGSOFTDEP(vp)) {
|
||||
@ -314,7 +314,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size,
|
||||
}
|
||||
nb = newb;
|
||||
*allocblk++ = nb;
|
||||
nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0);
|
||||
nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0, 0);
|
||||
nbp->b_blkno = fsbtodb(fs, nb);
|
||||
if (flags & BA_CLRBUF)
|
||||
vfs_bio_clrbuf(nbp);
|
||||
@ -351,7 +351,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size,
|
||||
goto fail;
|
||||
}
|
||||
} else {
|
||||
nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0);
|
||||
nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0, 0);
|
||||
nbp->b_blkno = fsbtodb(fs, nb);
|
||||
}
|
||||
*bpp = nbp;
|
||||
@ -541,7 +541,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
|
||||
nsize, cred, &newb);
|
||||
if (error)
|
||||
return (error);
|
||||
bp = getblk(vp, -1 - lbn, nsize, 0, 0);
|
||||
bp = getblk(vp, -1 - lbn, nsize, 0, 0, 0);
|
||||
bp->b_blkno = fsbtodb(fs, newb);
|
||||
bp->b_xflags |= BX_ALTDATA;
|
||||
if (flags & BA_CLRBUF)
|
||||
@ -637,7 +637,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
|
||||
&dp->di_db[0]), nsize, cred, &newb);
|
||||
if (error)
|
||||
return (error);
|
||||
bp = getblk(vp, lbn, nsize, 0, 0);
|
||||
bp = getblk(vp, lbn, nsize, 0, 0, 0);
|
||||
bp->b_blkno = fsbtodb(fs, newb);
|
||||
if (flags & BA_CLRBUF)
|
||||
vfs_bio_clrbuf(bp);
|
||||
@ -674,7 +674,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
|
||||
return (error);
|
||||
nb = newb;
|
||||
*allocblk++ = nb;
|
||||
bp = getblk(vp, indirs[1].in_lbn, fs->fs_bsize, 0, 0);
|
||||
bp = getblk(vp, indirs[1].in_lbn, fs->fs_bsize, 0, 0, 0);
|
||||
bp->b_blkno = fsbtodb(fs, nb);
|
||||
vfs_bio_clrbuf(bp);
|
||||
if (DOINGSOFTDEP(vp)) {
|
||||
@ -723,7 +723,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
|
||||
}
|
||||
nb = newb;
|
||||
*allocblk++ = nb;
|
||||
nbp = getblk(vp, indirs[i].in_lbn, fs->fs_bsize, 0, 0);
|
||||
nbp = getblk(vp, indirs[i].in_lbn, fs->fs_bsize, 0, 0, 0);
|
||||
nbp->b_blkno = fsbtodb(fs, nb);
|
||||
vfs_bio_clrbuf(nbp);
|
||||
if (DOINGSOFTDEP(vp)) {
|
||||
@ -775,7 +775,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
|
||||
}
|
||||
nb = newb;
|
||||
*allocblk++ = nb;
|
||||
nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0);
|
||||
nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0, 0);
|
||||
nbp->b_blkno = fsbtodb(fs, nb);
|
||||
if (flags & BA_CLRBUF)
|
||||
vfs_bio_clrbuf(nbp);
|
||||
@ -818,7 +818,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
|
||||
goto fail;
|
||||
}
|
||||
} else {
|
||||
nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0);
|
||||
nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0, 0);
|
||||
nbp->b_blkno = fsbtodb(fs, nb);
|
||||
}
|
||||
*bpp = nbp;
|
||||
|
@ -549,7 +549,7 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, level, countp)
|
||||
* explicitly instead of letting bread do everything for us.
|
||||
*/
|
||||
vp = ITOV(ip);
|
||||
bp = getblk(vp, lbn, (int)fs->fs_bsize, 0, 0);
|
||||
bp = getblk(vp, lbn, (int)fs->fs_bsize, 0, 0, 0);
|
||||
if ((bp->b_flags & B_CACHE) == 0) {
|
||||
curproc->p_stats->p_ru.ru_inblock++; /* pay for read */
|
||||
bp->b_iocmd = BIO_READ;
|
||||
|
@ -899,7 +899,7 @@ indiracct_ufs1(snapvp, cancelvp, level, blkno, lbn, rlbn, remblks,
|
||||
* We have to expand bread here since it will deadlock looking
|
||||
* up the block number for any blocks that are not in the cache.
|
||||
*/
|
||||
bp = getblk(cancelvp, lbn, fs->fs_bsize, 0, 0);
|
||||
bp = getblk(cancelvp, lbn, fs->fs_bsize, 0, 0, 0);
|
||||
bp->b_blkno = fsbtodb(fs, blkno);
|
||||
if ((bp->b_flags & (B_DONE | B_DELWRI)) == 0 &&
|
||||
(error = readblock(bp, fragstoblks(fs, blkno)))) {
|
||||
@ -1174,7 +1174,7 @@ indiracct_ufs2(snapvp, cancelvp, level, blkno, lbn, rlbn, remblks,
|
||||
* We have to expand bread here since it will deadlock looking
|
||||
* up the block number for any blocks that are not in the cache.
|
||||
*/
|
||||
bp = getblk(cancelvp, lbn, fs->fs_bsize, 0, 0);
|
||||
bp = getblk(cancelvp, lbn, fs->fs_bsize, 0, 0, 0);
|
||||
bp->b_blkno = fsbtodb(fs, blkno);
|
||||
if ((bp->b_flags & (B_DONE | B_DELWRI)) == 0 &&
|
||||
(error = readblock(bp, fragstoblks(fs, blkno)))) {
|
||||
|
@ -1896,7 +1896,7 @@ setup_allocindir_phase2(bp, ip, aip)
|
||||
bp->b_blkno = blkno;
|
||||
}
|
||||
newindirdep->ir_savebp =
|
||||
getblk(ip->i_devvp, bp->b_blkno, bp->b_bcount, 0, 0);
|
||||
getblk(ip->i_devvp, bp->b_blkno, bp->b_bcount, 0, 0, 0);
|
||||
BUF_KERNPROC(newindirdep->ir_savebp);
|
||||
bcopy(bp->b_data, newindirdep->ir_savebp->b_data, bp->b_bcount);
|
||||
}
|
||||
|
@ -1483,7 +1483,7 @@ ffs_sbupdate(mp, waitfor)
|
||||
if (i + fs->fs_frag > blks)
|
||||
size = (blks - i) * fs->fs_fsize;
|
||||
bp = getblk(mp->um_devvp, fsbtodb(fs, fs->fs_csaddr + i),
|
||||
size, 0, 0);
|
||||
size, 0, 0, 0);
|
||||
bcopy(space, bp->b_data, (u_int)size);
|
||||
space = (char *)space + size;
|
||||
if (waitfor != MNT_WAIT)
|
||||
@ -1511,7 +1511,7 @@ ffs_sbupdate(mp, waitfor)
|
||||
fs->fs_sblockloc = SBLOCK_UFS2;
|
||||
}
|
||||
bp = getblk(mp->um_devvp, btodb(fs->fs_sblockloc), (int)fs->fs_sbsize,
|
||||
0, 0);
|
||||
0, 0, 0);
|
||||
fs->fs_fmod = 0;
|
||||
fs->fs_time = time_second;
|
||||
bcopy((caddr_t)fs, bp->b_data, (u_int)fs->fs_sbsize);
|
||||
|
@ -215,7 +215,7 @@ ufs_bmaparray(vp, bn, bnp, nbp, runp, runb)
|
||||
bqrelse(bp);
|
||||
|
||||
ap->in_exists = 1;
|
||||
bp = getblk(vp, metalbn, mp->mnt_stat.f_iosize, 0, 0);
|
||||
bp = getblk(vp, metalbn, mp->mnt_stat.f_iosize, 0, 0, 0);
|
||||
if ((bp->b_flags & B_CACHE) == 0) {
|
||||
#ifdef DIAGNOSTIC
|
||||
if (!daddr)
|
||||
|
Loading…
Reference in New Issue
Block a user