Rename the BALLOC flags from B_* to BA_* to avoid confusion with the
struct buf B_ flags. Approved by: mckusick
This commit is contained in:
parent
1d88dfe265
commit
10cfbc1978
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=98658
@ -120,7 +120,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size,
|
||||
ip->i_din1->di_size = ip->i_size;
|
||||
ip->i_din1->di_db[nb] = dbtofsb(fs, bp->b_blkno);
|
||||
ip->i_flag |= IN_CHANGE | IN_UPDATE;
|
||||
if (flags & B_SYNC)
|
||||
if (flags & BA_SYNC)
|
||||
bwrite(bp);
|
||||
else
|
||||
bawrite(bp);
|
||||
@ -130,8 +130,8 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size,
|
||||
* The first NDADDR blocks are direct blocks
|
||||
*/
|
||||
if (lbn < NDADDR) {
|
||||
if (flags & B_METAONLY)
|
||||
panic("ffs_balloc_ufs1: B_METAONLY for direct block");
|
||||
if (flags & BA_METAONLY)
|
||||
panic("ffs_balloc_ufs1: BA_METAONLY for direct block");
|
||||
nb = ip->i_din1->di_db[lbn];
|
||||
if (nb != 0 && ip->i_size >= smalllblktosize(fs, lbn + 1)) {
|
||||
error = bread(vp, lbn, fs->fs_bsize, NOCRED, &bp);
|
||||
@ -181,7 +181,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size,
|
||||
return (error);
|
||||
bp = getblk(vp, lbn, nsize, 0, 0);
|
||||
bp->b_blkno = fsbtodb(fs, newb);
|
||||
if (flags & B_CLRBUF)
|
||||
if (flags & BA_CLRBUF)
|
||||
vfs_bio_clrbuf(bp);
|
||||
if (DOINGSOFTDEP(vp))
|
||||
softdep_setup_allocdirect(ip, lbn, newb, 0,
|
||||
@ -289,7 +289,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size,
|
||||
* If required, write synchronously, otherwise use
|
||||
* delayed write.
|
||||
*/
|
||||
if (flags & B_SYNC) {
|
||||
if (flags & BA_SYNC) {
|
||||
bwrite(bp);
|
||||
} else {
|
||||
if (bp->b_bufsize == fs->fs_bsize)
|
||||
@ -300,7 +300,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size,
|
||||
/*
|
||||
* If asked only for the indirect block, then return it.
|
||||
*/
|
||||
if (flags & B_METAONLY) {
|
||||
if (flags & BA_METAONLY) {
|
||||
*bpp = bp;
|
||||
return (0);
|
||||
}
|
||||
@ -319,7 +319,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size,
|
||||
*allocblk++ = nb;
|
||||
nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0);
|
||||
nbp->b_blkno = fsbtodb(fs, nb);
|
||||
if (flags & B_CLRBUF)
|
||||
if (flags & BA_CLRBUF)
|
||||
vfs_bio_clrbuf(nbp);
|
||||
if (DOINGSOFTDEP(vp))
|
||||
softdep_setup_allocindir_page(ip, lbn, bp,
|
||||
@ -329,7 +329,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size,
|
||||
* If required, write synchronously, otherwise use
|
||||
* delayed write.
|
||||
*/
|
||||
if (flags & B_SYNC) {
|
||||
if (flags & BA_SYNC) {
|
||||
bwrite(bp);
|
||||
} else {
|
||||
if (bp->b_bufsize == fs->fs_bsize)
|
||||
@ -340,7 +340,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size,
|
||||
return (0);
|
||||
}
|
||||
brelse(bp);
|
||||
if (flags & B_CLRBUF) {
|
||||
if (flags & BA_CLRBUF) {
|
||||
error = bread(vp, lbn, (int)fs->fs_bsize, NOCRED, &nbp);
|
||||
if (error) {
|
||||
brelse(nbp);
|
||||
@ -382,7 +382,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size,
|
||||
} else {
|
||||
bap = (ufs1_daddr_t *)bp->b_data;
|
||||
bap[indirs[unwindidx].in_off] = 0;
|
||||
if (flags & B_SYNC) {
|
||||
if (flags & BA_SYNC) {
|
||||
bwrite(bp);
|
||||
} else {
|
||||
if (bp->b_bufsize == fs->fs_bsize)
|
||||
@ -462,7 +462,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
|
||||
ip->i_din2->di_size = ip->i_size;
|
||||
ip->i_din2->di_db[nb] = dbtofsb(fs, bp->b_blkno);
|
||||
ip->i_flag |= IN_CHANGE | IN_UPDATE;
|
||||
if (flags & B_SYNC)
|
||||
if (flags & BA_SYNC)
|
||||
bwrite(bp);
|
||||
else
|
||||
bawrite(bp);
|
||||
@ -472,8 +472,8 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
|
||||
* The first NDADDR blocks are direct blocks
|
||||
*/
|
||||
if (lbn < NDADDR) {
|
||||
if (flags & B_METAONLY)
|
||||
panic("ffs_balloc_ufs2: B_METAONLY for direct block");
|
||||
if (flags & BA_METAONLY)
|
||||
panic("ffs_balloc_ufs2: BA_METAONLY for direct block");
|
||||
nb = ip->i_din2->di_db[lbn];
|
||||
if (nb != 0 && ip->i_size >= smalllblktosize(fs, lbn + 1)) {
|
||||
error = bread(vp, lbn, fs->fs_bsize, NOCRED, &bp);
|
||||
@ -523,7 +523,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
|
||||
return (error);
|
||||
bp = getblk(vp, lbn, nsize, 0, 0);
|
||||
bp->b_blkno = fsbtodb(fs, newb);
|
||||
if (flags & B_CLRBUF)
|
||||
if (flags & BA_CLRBUF)
|
||||
vfs_bio_clrbuf(bp);
|
||||
if (DOINGSOFTDEP(vp))
|
||||
softdep_setup_allocdirect(ip, lbn, newb, 0,
|
||||
@ -631,7 +631,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
|
||||
* If required, write synchronously, otherwise use
|
||||
* delayed write.
|
||||
*/
|
||||
if (flags & B_SYNC) {
|
||||
if (flags & BA_SYNC) {
|
||||
bwrite(bp);
|
||||
} else {
|
||||
if (bp->b_bufsize == fs->fs_bsize)
|
||||
@ -642,7 +642,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
|
||||
/*
|
||||
* If asked only for the indirect block, then return it.
|
||||
*/
|
||||
if (flags & B_METAONLY) {
|
||||
if (flags & BA_METAONLY) {
|
||||
*bpp = bp;
|
||||
return (0);
|
||||
}
|
||||
@ -661,7 +661,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
|
||||
*allocblk++ = nb;
|
||||
nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0);
|
||||
nbp->b_blkno = fsbtodb(fs, nb);
|
||||
if (flags & B_CLRBUF)
|
||||
if (flags & BA_CLRBUF)
|
||||
vfs_bio_clrbuf(nbp);
|
||||
if (DOINGSOFTDEP(vp))
|
||||
softdep_setup_allocindir_page(ip, lbn, bp,
|
||||
@ -671,7 +671,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
|
||||
* If required, write synchronously, otherwise use
|
||||
* delayed write.
|
||||
*/
|
||||
if (flags & B_SYNC) {
|
||||
if (flags & BA_SYNC) {
|
||||
bwrite(bp);
|
||||
} else {
|
||||
if (bp->b_bufsize == fs->fs_bsize)
|
||||
@ -682,7 +682,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
|
||||
return (0);
|
||||
}
|
||||
brelse(bp);
|
||||
if (flags & B_CLRBUF) {
|
||||
if (flags & BA_CLRBUF) {
|
||||
error = bread(vp, lbn, (int)fs->fs_bsize, NOCRED, &nbp);
|
||||
if (error) {
|
||||
brelse(nbp);
|
||||
@ -724,7 +724,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
|
||||
} else {
|
||||
bap = (ufs2_daddr_t *)bp->b_data;
|
||||
bap[indirs[unwindidx].in_off] = 0;
|
||||
if (flags & B_SYNC) {
|
||||
if (flags & BA_SYNC) {
|
||||
bwrite(bp);
|
||||
} else {
|
||||
if (bp->b_bufsize == fs->fs_bsize)
|
||||
|
@ -220,9 +220,9 @@ ffs_truncate(vp, length, flags, cred, td)
|
||||
*/
|
||||
if (osize < length) {
|
||||
vnode_pager_setsize(ovp, length);
|
||||
aflags = B_CLRBUF;
|
||||
aflags = BA_CLRBUF;
|
||||
if (flags & IO_SYNC)
|
||||
aflags |= B_SYNC;
|
||||
aflags |= BA_SYNC;
|
||||
error = UFS_BALLOC(ovp, length - 1, 1,
|
||||
cred, aflags, &bp);
|
||||
if (error)
|
||||
@ -231,7 +231,7 @@ ffs_truncate(vp, length, flags, cred, td)
|
||||
DIP(oip, i_size) = length;
|
||||
if (bp->b_bufsize == fs->fs_bsize)
|
||||
bp->b_flags |= B_CLUSTEROK;
|
||||
if (aflags & B_SYNC)
|
||||
if (aflags & BA_SYNC)
|
||||
bwrite(bp);
|
||||
else
|
||||
bawrite(bp);
|
||||
@ -252,9 +252,9 @@ ffs_truncate(vp, length, flags, cred, td)
|
||||
DIP(oip, i_size) = length;
|
||||
} else {
|
||||
lbn = lblkno(fs, length);
|
||||
aflags = B_CLRBUF;
|
||||
aflags = BA_CLRBUF;
|
||||
if (flags & IO_SYNC)
|
||||
aflags |= B_SYNC;
|
||||
aflags |= BA_SYNC;
|
||||
error = UFS_BALLOC(ovp, length - 1, 1, cred, aflags, &bp);
|
||||
if (error) {
|
||||
return (error);
|
||||
@ -281,7 +281,7 @@ ffs_truncate(vp, length, flags, cred, td)
|
||||
allocbuf(bp, size);
|
||||
if (bp->b_bufsize == fs->fs_bsize)
|
||||
bp->b_flags |= B_CLUSTEROK;
|
||||
if (aflags & B_SYNC)
|
||||
if (aflags & BA_SYNC)
|
||||
bwrite(bp);
|
||||
else
|
||||
bawrite(bp);
|
||||
|
@ -203,7 +203,7 @@ ffs_snapshot(mp, snapfile)
|
||||
*/
|
||||
numblks = howmany(fs->fs_size, fs->fs_frag);
|
||||
error = UFS_BALLOC(vp, lblktosize(fs, (off_t)(numblks - 1)),
|
||||
fs->fs_bsize, KERNCRED, B_CLRBUF, &bp);
|
||||
fs->fs_bsize, KERNCRED, BA_CLRBUF, &bp);
|
||||
if (error)
|
||||
goto out;
|
||||
ip->i_size = lblktosize(fs, (off_t)numblks);
|
||||
@ -225,7 +225,7 @@ ffs_snapshot(mp, snapfile)
|
||||
*/
|
||||
for (blkno = NDADDR; blkno < numblks; blkno += NINDIR(fs)) {
|
||||
error = UFS_BALLOC(vp, lblktosize(fs, (off_t)blkno),
|
||||
fs->fs_bsize, td->td_ucred, B_METAONLY, &ibp);
|
||||
fs->fs_bsize, td->td_ucred, BA_METAONLY, &ibp);
|
||||
if (error)
|
||||
goto out;
|
||||
bdwrite(ibp);
|
||||
@ -604,7 +604,7 @@ cgaccount(cg, vp, nbp, passno)
|
||||
}
|
||||
}
|
||||
error = UFS_BALLOC(vp, lblktosize(fs, (off_t)(base + loc)),
|
||||
fs->fs_bsize, KERNCRED, B_METAONLY, &ibp);
|
||||
fs->fs_bsize, KERNCRED, BA_METAONLY, &ibp);
|
||||
if (error) {
|
||||
brelse(bp);
|
||||
return (error);
|
||||
@ -617,7 +617,7 @@ cgaccount(cg, vp, nbp, passno)
|
||||
bawrite(ibp);
|
||||
error = UFS_BALLOC(vp,
|
||||
lblktosize(fs, (off_t)(base + loc)),
|
||||
fs->fs_bsize, KERNCRED, B_METAONLY, &ibp);
|
||||
fs->fs_bsize, KERNCRED, BA_METAONLY, &ibp);
|
||||
if (error) {
|
||||
brelse(bp);
|
||||
return (error);
|
||||
@ -706,7 +706,7 @@ expunge_ufs1(snapvp, cancelip, fs, acctfunc, expungetype)
|
||||
} else {
|
||||
td->td_proc->p_flag |= P_COWINPROGRESS;
|
||||
error = UFS_BALLOC(snapvp, lblktosize(fs, (off_t)lbn),
|
||||
fs->fs_bsize, KERNCRED, B_METAONLY, &bp);
|
||||
fs->fs_bsize, KERNCRED, BA_METAONLY, &bp);
|
||||
td->td_proc->p_flag &= ~P_COWINPROGRESS;
|
||||
if (error)
|
||||
return (error);
|
||||
@ -853,7 +853,7 @@ snapacct_ufs1(vp, oldblkp, lastblkp, fs, lblkno, expungetype)
|
||||
ip->i_flag |= IN_CHANGE | IN_UPDATE;
|
||||
} else {
|
||||
error = UFS_BALLOC(vp, lblktosize(fs, (off_t)lbn),
|
||||
fs->fs_bsize, KERNCRED, B_METAONLY, &ibp);
|
||||
fs->fs_bsize, KERNCRED, BA_METAONLY, &ibp);
|
||||
if (error)
|
||||
return (error);
|
||||
blkp = &((ufs1_daddr_t *)(ibp->b_data))
|
||||
@ -959,7 +959,7 @@ expunge_ufs2(snapvp, cancelip, fs, acctfunc, expungetype)
|
||||
} else {
|
||||
td->td_proc->p_flag |= P_COWINPROGRESS;
|
||||
error = UFS_BALLOC(snapvp, lblktosize(fs, (off_t)lbn),
|
||||
fs->fs_bsize, KERNCRED, B_METAONLY, &bp);
|
||||
fs->fs_bsize, KERNCRED, BA_METAONLY, &bp);
|
||||
td->td_proc->p_flag &= ~P_COWINPROGRESS;
|
||||
if (error)
|
||||
return (error);
|
||||
@ -1106,7 +1106,7 @@ snapacct_ufs2(vp, oldblkp, lastblkp, fs, lblkno, expungetype)
|
||||
ip->i_flag |= IN_CHANGE | IN_UPDATE;
|
||||
} else {
|
||||
error = UFS_BALLOC(vp, lblktosize(fs, (off_t)lbn),
|
||||
fs->fs_bsize, KERNCRED, B_METAONLY, &ibp);
|
||||
fs->fs_bsize, KERNCRED, BA_METAONLY, &ibp);
|
||||
if (error)
|
||||
return (error);
|
||||
blkp = &((ufs2_daddr_t *)(ibp->b_data))
|
||||
@ -1248,7 +1248,7 @@ ffs_snapremove(vp)
|
||||
numblks = howmany(ip->i_size, fs->fs_bsize);
|
||||
for (blkno = NDADDR; blkno < numblks; blkno += NINDIR(fs)) {
|
||||
error = UFS_BALLOC(vp, lblktosize(fs, (off_t)blkno),
|
||||
fs->fs_bsize, KERNCRED, B_METAONLY, &ibp);
|
||||
fs->fs_bsize, KERNCRED, BA_METAONLY, &ibp);
|
||||
if (error)
|
||||
continue;
|
||||
if (fs->fs_size - blkno > NINDIR(fs))
|
||||
@ -1337,7 +1337,7 @@ ffs_snapblkfree(fs, devvp, bno, size, inum)
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
|
||||
td->td_proc->p_flag |= P_COWINPROGRESS;
|
||||
error = UFS_BALLOC(vp, lblktosize(fs, (off_t)lbn),
|
||||
fs->fs_bsize, KERNCRED, B_METAONLY, &ibp);
|
||||
fs->fs_bsize, KERNCRED, BA_METAONLY, &ibp);
|
||||
td->td_proc->p_flag &= ~P_COWINPROGRESS;
|
||||
VOP_UNLOCK(vp, 0, td);
|
||||
if (error)
|
||||
@ -1611,7 +1611,7 @@ ffs_copyonwrite(devvp, bp)
|
||||
} else {
|
||||
td->td_proc->p_flag |= P_COWINPROGRESS;
|
||||
error = UFS_BALLOC(vp, lblktosize(fs, (off_t)lbn),
|
||||
fs->fs_bsize, KERNCRED, B_METAONLY | B_NOWAIT, &ibp);
|
||||
fs->fs_bsize, KERNCRED, BA_METAONLY | BA_NOWAIT, &ibp);
|
||||
td->td_proc->p_flag &= ~P_COWINPROGRESS;
|
||||
if (error) {
|
||||
VOP_UNLOCK(vp, 0, td);
|
||||
@ -1642,7 +1642,7 @@ ffs_copyonwrite(devvp, bp)
|
||||
*/
|
||||
td->td_proc->p_flag |= P_COWINPROGRESS;
|
||||
error = UFS_BALLOC(vp, lblktosize(fs, (off_t)lbn),
|
||||
fs->fs_bsize, KERNCRED, B_NOWAIT, &cbp);
|
||||
fs->fs_bsize, KERNCRED, BA_NOWAIT, &cbp);
|
||||
td->td_proc->p_flag &= ~P_COWINPROGRESS;
|
||||
if (error) {
|
||||
VOP_UNLOCK(vp, 0, td);
|
||||
|
@ -106,9 +106,9 @@ void softdep_releasefile(struct inode *);
|
||||
int softdep_slowdown(struct vnode *);
|
||||
|
||||
/* Flags to low-level allocation routines. */
|
||||
#define B_CLRBUF 0x01 /* Request allocated buffer be cleared. */
|
||||
#define B_SYNC 0x02 /* Do all allocations synchronously. */
|
||||
#define B_METAONLY 0x04 /* Return indirect block buffer. */
|
||||
#define B_NOWAIT 0x08 /* do not sleep to await lock */
|
||||
#define BA_CLRBUF 0x01 /* Request allocated buffer be cleared. */
|
||||
#define BA_SYNC 0x02 /* Do all allocations synchronously. */
|
||||
#define BA_METAONLY 0x04 /* Return indirect block buffer. */
|
||||
#define BA_NOWAIT 0x08 /* do not sleep to await lock */
|
||||
|
||||
#endif /* !_UFS_UFS_EXTERN_H_ */
|
||||
|
@ -750,9 +750,9 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp)
|
||||
*/
|
||||
if (dp->i_offset & (DIRBLKSIZ - 1))
|
||||
panic("ufs_direnter: newblk");
|
||||
flags = B_CLRBUF;
|
||||
flags = BA_CLRBUF;
|
||||
if (!DOINGSOFTDEP(dvp) && !DOINGASYNC(dvp))
|
||||
flags |= B_SYNC;
|
||||
flags |= BA_SYNC;
|
||||
if ((error = UFS_BALLOC(dvp, (off_t)dp->i_offset, DIRBLKSIZ,
|
||||
cr, flags, &bp)) != 0) {
|
||||
if (DOINGSOFTDEP(dvp) && newdirbp != NULL)
|
||||
|
@ -471,7 +471,7 @@ WRITE(ap)
|
||||
osize = ip->i_size;
|
||||
flags = 0;
|
||||
if ((ioflag & IO_SYNC) && !DOINGASYNC(vp))
|
||||
flags = B_SYNC;
|
||||
flags = BA_SYNC;
|
||||
|
||||
#ifdef ENABLE_VFS_IOOPT
|
||||
if (object && (object->flags & OBJ_OPT)) {
|
||||
@ -495,9 +495,9 @@ WRITE(ap)
|
||||
* does not cover the entire buffer.
|
||||
*/
|
||||
if (fs->fs_bsize > xfersize)
|
||||
flags |= B_CLRBUF;
|
||||
flags |= BA_CLRBUF;
|
||||
else
|
||||
flags &= ~B_CLRBUF;
|
||||
flags &= ~BA_CLRBUF;
|
||||
/* XXX is uio->uio_offset the right thing here? */
|
||||
error = UFS_BALLOC(vp, uio->uio_offset, xfersize,
|
||||
ap->a_cred, flags, &bp);
|
||||
|
@ -1597,7 +1597,7 @@ ufs_mkdir(ap)
|
||||
dirtemplate.dot_ino = ip->i_number;
|
||||
dirtemplate.dotdot_ino = dp->i_number;
|
||||
if ((error = UFS_BALLOC(tvp, (off_t)0, DIRBLKSIZ, cnp->cn_cred,
|
||||
B_CLRBUF, &bp)) != 0)
|
||||
BA_CLRBUF, &bp)) != 0)
|
||||
goto bad;
|
||||
ip->i_size = DIRBLKSIZ;
|
||||
DIP(ip, i_size) = DIRBLKSIZ;
|
||||
|
Loading…
Reference in New Issue
Block a user