diff options
author | phk <phk@FreeBSD.org> | 2001-04-29 12:36:52 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2001-04-29 12:36:52 +0000 |
commit | 8e3fa89968253688c69354328c0c8c9aa765ee6b (patch) | |
tree | a9929c6714ce54047cee9e12f32d2b8f21654fe7 /sys/ufs/ffs | |
parent | 608c1caf3bebcc3d9b0a01af62a7f57d2c6427ea (diff) | |
download | FreeBSD-src-8e3fa89968253688c69354328c0c8c9aa765ee6b.zip FreeBSD-src-8e3fa89968253688c69354328c0c8c9aa765ee6b.tar.gz |
VOP_BALLOC was never really a VOP in the first place, so convert it
to UFS_BALLOC like the other "between UFS and FFS function interfaces".
Diffstat (limited to 'sys/ufs/ffs')
-rw-r--r-- | sys/ufs/ffs/ffs_balloc.c | 33 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_extern.h | 3 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_inode.c | 4 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_snapshot.c | 42 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_vfsops.c | 1 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_vnops.c | 1 |
6 files changed, 39 insertions, 45 deletions
diff --git a/sys/ufs/ffs/ffs_balloc.c b/sys/ufs/ffs/ffs_balloc.c index 92fe379..cf57bc7 100644 --- a/sys/ufs/ffs/ffs_balloc.c +++ b/sys/ufs/ffs/ffs_balloc.c @@ -55,15 +55,8 @@ * the inode and the logical block number in a file. */ int -ffs_balloc(ap) - struct vop_balloc_args /* { - struct vnode *a_vp; - ufs_daddr_t a_lbn; - int a_size; - struct ucred *a_cred; - int a_flags; - struct buf *a_bpp; - } */ *ap; +ffs_balloc(struct vnode *a_vp, off_t a_startoffset, int a_size, + struct ucred *a_cred, int a_flags, struct buf **a_bpp) { struct inode *ip; ufs_daddr_t lbn; @@ -81,18 +74,18 @@ ffs_balloc(ap) int unwindidx = -1; struct proc *p = curproc; /* XXX */ - vp = ap->a_vp; + vp = a_vp; ip = VTOI(vp); fs = ip->i_fs; - lbn = lblkno(fs, ap->a_startoffset); - size = blkoff(fs, ap->a_startoffset) + ap->a_size; + lbn = lblkno(fs, a_startoffset); + size = blkoff(fs, a_startoffset) + a_size; if (size > fs->fs_bsize) panic("ffs_balloc: blk too big"); - *ap->a_bpp = NULL; + *a_bpp = NULL; if (lbn < 0) return (EFBIG); - cred = ap->a_cred; - flags = ap->a_flags; + cred = a_cred; + flags = a_flags; /* * If the next write will extend the file into a new block, @@ -135,7 +128,7 @@ ffs_balloc(ap) return (error); } bp->b_blkno = fsbtodb(fs, nb); - *ap->a_bpp = bp; + *a_bpp = bp; return (0); } if (nb != 0) { @@ -182,7 +175,7 @@ ffs_balloc(ap) } ip->i_db[lbn] = dbtofsb(fs, bp->b_blkno); ip->i_flag |= IN_CHANGE | IN_UPDATE; - *ap->a_bpp = bp; + *a_bpp = bp; return (0); } /* @@ -294,7 +287,7 @@ ffs_balloc(ap) * If asked only for the indirect block, then return it. */ if (flags & B_METAONLY) { - *ap->a_bpp = bp; + *a_bpp = bp; return (0); } /* @@ -329,7 +322,7 @@ ffs_balloc(ap) bp->b_flags |= B_CLUSTEROK; bdwrite(bp); } - *ap->a_bpp = nbp; + *a_bpp = nbp; return (0); } brelse(bp); @@ -343,7 +336,7 @@ ffs_balloc(ap) nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0); nbp->b_blkno = fsbtodb(fs, nb); } - *ap->a_bpp = nbp; + *a_bpp = nbp; return (0); fail: /* diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h index 36f1b27..a4da25a 100644 --- a/sys/ufs/ffs/ffs_extern.h +++ b/sys/ufs/ffs/ffs_extern.h @@ -55,7 +55,8 @@ struct vop_copyonwrite_args; int ffs_alloc __P((struct inode *, ufs_daddr_t, ufs_daddr_t, int, struct ucred *, ufs_daddr_t *)); -int ffs_balloc __P((struct vop_balloc_args *)); +int ffs_balloc __P((struct vnode *a_vp, off_t a_startoffset, int a_size, + struct ucred *a_cred, int a_flags, struct buf **a_bpp)); int ffs_blkatoff __P((struct vnode *, off_t, char **, struct buf **)); void ffs_blkfree __P((struct inode *, ufs_daddr_t, long)); ufs_daddr_t ffs_blkpref __P((struct inode *, ufs_daddr_t, int, ufs_daddr_t *)); diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index 2395ec4..7a3c7ee 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -214,7 +214,7 @@ ffs_truncate(vp, length, flags, cred, p) aflags = B_CLRBUF; if (flags & IO_SYNC) aflags |= B_SYNC; - error = VOP_BALLOC(ovp, length - 1, 1, + error = UFS_BALLOC(ovp, length - 1, 1, cred, aflags, &bp); if (error) return (error); @@ -244,7 +244,7 @@ ffs_truncate(vp, length, flags, cred, p) aflags = B_CLRBUF; if (flags & IO_SYNC) aflags |= B_SYNC; - error = VOP_BALLOC(ovp, length - 1, 1, cred, aflags, &bp); + error = UFS_BALLOC(ovp, length - 1, 1, cred, aflags, &bp); if (error) { return (error); } diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index 28086cc..44c7257 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -161,7 +161,7 @@ restart: * to set size to that of the filesystem. */ numblks = howmany(fs->fs_size, fs->fs_frag); - error = VOP_BALLOC(vp, lblktosize(fs, (off_t)(numblks - 1)), + error = UFS_BALLOC(vp, lblktosize(fs, (off_t)(numblks - 1)), fs->fs_bsize, KERNCRED, B_CLRBUF, &bp); if (error) goto out; @@ -182,7 +182,7 @@ restart: * needing to be copied. */ for (blkno = NDADDR; blkno < numblks; blkno += NINDIR(fs)) { - error = VOP_BALLOC(vp, lblktosize(fs, (off_t)blkno), + error = UFS_BALLOC(vp, lblktosize(fs, (off_t)blkno), fs->fs_bsize, p->p_ucred, B_METAONLY, &ibp); if (error) goto out; @@ -193,7 +193,7 @@ restart: panic("ffs_snapshot: lost direct block"); ip->i_db[iblkno] = BLK_NOCOPY; } else { - error = VOP_BALLOC(vp, lblktosize(fs, (off_t)iblkno), + error = UFS_BALLOC(vp, lblktosize(fs, (off_t)iblkno), fs->fs_bsize, KERNCRED, B_METAONLY, &ibp); if (error) goto out; @@ -219,7 +219,7 @@ restart: break; if (i == inoblkcnt) { inoblks[inoblkcnt++] = blkno; - error = VOP_BALLOC(vp, lblktosize(fs, (off_t)blkno), + error = UFS_BALLOC(vp, lblktosize(fs, (off_t)blkno), fs->fs_bsize, KERNCRED, 0, &nbp); if (error) goto out; @@ -230,7 +230,7 @@ restart: * Allocate all cylinder group blocks. */ for (cg = 0; cg < fs->fs_ncg; cg++) { - error = VOP_BALLOC(vp, (off_t)(cgtod(fs, cg)) << fs->fs_fshift, + error = UFS_BALLOC(vp, (off_t)(cgtod(fs, cg)) << fs->fs_fshift, fs->fs_bsize, KERNCRED, 0, &nbp); if (error) goto out; @@ -239,13 +239,13 @@ restart: /* * Allocate copies for the superblock and its summary information. */ - if ((error = VOP_BALLOC(vp, (off_t)(SBOFF), SBSIZE, KERNCRED, 0, &nbp))) + if ((error = UFS_BALLOC(vp, (off_t)(SBOFF), SBSIZE, KERNCRED, 0, &nbp))) goto out; bawrite(nbp); blkno = fragstoblks(fs, fs->fs_csaddr); len = howmany(fs->fs_cssize, fs->fs_bsize); for (loc = 0; loc < len; loc++) { - error = VOP_BALLOC(vp, lblktosize(fs, (off_t)(blkno + loc)), + error = UFS_BALLOC(vp, lblktosize(fs, (off_t)(blkno + loc)), fs->fs_bsize, KERNCRED, 0, &nbp); if (error) goto out; @@ -316,7 +316,7 @@ restart: ip->i_db[loc] = BLK_NOCOPY; } } - error = VOP_BALLOC(vp, lblktosize(fs, (off_t)(base + loc)), + error = UFS_BALLOC(vp, lblktosize(fs, (off_t)(base + loc)), fs->fs_bsize, KERNCRED, B_METAONLY, &ibp); if (error) { brelse(bp); @@ -327,7 +327,7 @@ restart: if (indiroff >= NINDIR(fs)) { ibp->b_flags |= B_VALIDSUSPWRT; bawrite(ibp); - error = VOP_BALLOC(vp, + error = UFS_BALLOC(vp, lblktosize(fs, (off_t)(base + loc)), fs->fs_bsize, KERNCRED, B_METAONLY, &ibp); if (error) { @@ -349,7 +349,7 @@ restart: /* * Snapshot the superblock and its summary information. */ - if ((error = VOP_BALLOC(vp, SBOFF, SBSIZE, KERNCRED, 0, &nbp)) != 0) + if ((error = UFS_BALLOC(vp, SBOFF, SBSIZE, KERNCRED, 0, &nbp)) != 0) goto out1; copy_fs = (struct fs *)(nbp->b_data + blkoff(fs, SBOFF)); bcopy(fs, copy_fs, fs->fs_sbsize); @@ -365,7 +365,7 @@ restart: size = fs->fs_bsize; space = fs->fs_csp; for (loc = 0; loc <= len; loc++) { - error = VOP_BALLOC(vp, lblktosize(fs, (off_t)(blkno + loc)), + error = UFS_BALLOC(vp, lblktosize(fs, (off_t)(blkno + loc)), fs->fs_bsize, KERNCRED, 0, &nbp); if (error) goto out1; @@ -383,7 +383,7 @@ restart: * the copies can can be expunged. */ for (loc = 0; loc < inoblkcnt; loc++) { - error = VOP_BALLOC(vp, lblktosize(fs, (off_t)inoblks[loc]), + error = UFS_BALLOC(vp, lblktosize(fs, (off_t)inoblks[loc]), fs->fs_bsize, KERNCRED, 0, &nbp); if (error) goto out1; @@ -424,7 +424,7 @@ restart: * Set copied snapshot inode to be a zero length file. */ blkno = fragstoblks(fs, ino_to_fsba(fs, xp->i_number)); - error = VOP_BALLOC(vp, lblktosize(fs, (off_t)blkno), + error = UFS_BALLOC(vp, lblktosize(fs, (off_t)blkno), fs->fs_bsize, KERNCRED, 0, &nbp); if (error) goto out1; @@ -563,7 +563,7 @@ snapacct(vp, oldblkp, lastblkp) blkp = &ip->i_db[lbn]; ip->i_flag |= IN_CHANGE | IN_UPDATE; } else { - error = VOP_BALLOC(vp, lblktosize(fs, (off_t)lbn), + error = UFS_BALLOC(vp, lblktosize(fs, (off_t)lbn), fs->fs_bsize, KERNCRED, B_METAONLY, &ibp); if (error) return (error); @@ -665,7 +665,7 @@ ffs_snapremove(vp) ip->i_db[blkno] = 0; } for (blkno = NDADDR; blkno < fs->fs_size; blkno += NINDIR(fs)) { - error = VOP_BALLOC(vp, lblktosize(fs, (off_t)blkno), + error = UFS_BALLOC(vp, lblktosize(fs, (off_t)blkno), fs->fs_bsize, KERNCRED, B_METAONLY, &ibp); if (error) continue; @@ -732,7 +732,7 @@ ffs_snapblkfree(freeip, bno, size) } else { vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); p->p_flag |= P_COWINPROGRESS; - error = VOP_BALLOC(vp, lblktosize(fs, (off_t)lbn), + error = UFS_BALLOC(vp, lblktosize(fs, (off_t)lbn), fs->fs_bsize, KERNCRED, B_METAONLY, &ibp); p->p_flag &= ~P_COWINPROGRESS; VOP_UNLOCK(vp, 0, p); @@ -815,7 +815,7 @@ ffs_snapblkfree(freeip, bno, size) */ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); p->p_flag |= P_COWINPROGRESS; - error = VOP_BALLOC(vp, lblktosize(fs, (off_t)lbn), + error = UFS_BALLOC(vp, lblktosize(fs, (off_t)lbn), fs->fs_bsize, KERNCRED, 0, &cbp); p->p_flag &= ~P_COWINPROGRESS; if (error) { @@ -974,13 +974,13 @@ ffs_copyonwrite(devvp, bp) * We ensure that everything of our own that needs to be * copied will be done at the time that ffs_snapshot is * called. Thus we can skip the check here which can - * deadlock in doing the lookup in VOP_BALLOC. + * deadlock in doing the lookup in UFS_BALLOC. */ if (bp->b_vp == vp) continue; /* * Check to see if block needs to be copied. We have to - * be able to do the VOP_BALLOC without blocking, otherwise + * be able to do the UFS_BALLOC without blocking, otherwise * we may get in a deadlock with another process also * trying to allocate. If we find outselves unable to * get the buffer lock, we unlock the snapshot vnode, @@ -992,7 +992,7 @@ retry: blkno = ip->i_db[lbn]; } else { p->p_flag |= P_COWINPROGRESS; - error = VOP_BALLOC(vp, lblktosize(fs, (off_t)lbn), + error = UFS_BALLOC(vp, lblktosize(fs, (off_t)lbn), fs->fs_bsize, KERNCRED, B_METAONLY | B_NOWAIT, &ibp); p->p_flag &= ~P_COWINPROGRESS; if (error) { @@ -1020,7 +1020,7 @@ retry: * the snapshot inode. */ p->p_flag |= P_COWINPROGRESS; - error = VOP_BALLOC(vp, lblktosize(fs, (off_t)lbn), + error = UFS_BALLOC(vp, lblktosize(fs, (off_t)lbn), fs->fs_bsize, KERNCRED, B_NOWAIT, &cbp); p->p_flag &= ~P_COWINPROGRESS; if (error) { diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index ccfdf18..b1fb0cf 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -625,6 +625,7 @@ ffs_mountfs(devvp, mp, p, malloctype) ump->um_update = ffs_update; ump->um_valloc = ffs_valloc; ump->um_vfree = ffs_vfree; + ump->um_balloc = ffs_balloc; bcopy(bp->b_data, ump->um_fs, (u_int)fs->fs_sbsize); if (fs->fs_sbsize < SBSIZE) bp->b_flags |= B_INVAL | B_NOCACHE; diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index 8fefb0e..3745daf 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -79,7 +79,6 @@ static struct vnodeopv_entry_desc ffs_vnodeop_entries[] = { { &vop_getpages_desc, (vop_t *) ffs_getpages }, { &vop_putpages_desc, (vop_t *) ffs_putpages }, { &vop_read_desc, (vop_t *) ffs_read }, - { &vop_balloc_desc, (vop_t *) ffs_balloc }, { &vop_reallocblks_desc, (vop_t *) ffs_reallocblks }, { &vop_write_desc, (vop_t *) ffs_write }, #ifdef UFS_EXTATTR |