SCCS-vsn: sys/ufs/ffs/ffs_alloc.c 6.18
SCCS-vsn: sys/ufs/lfs/lfs_alloc.c 6.18
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)ffs_alloc.c 6.17 (Berkeley) %G%
+ * @(#)ffs_alloc.c 6.18 (Berkeley) %G%
daddr_t bprev, bpref;
int osize, nsize;
{
daddr_t bprev, bpref;
int osize, nsize;
{
register struct fs *fs;
register struct buf *bp, *obp;
int cg, request;
register struct fs *fs;
register struct buf *bp, *obp;
int cg, request;
+ daddr_t bno, bn;
+ int i, count, s;
+ extern struct cmap *mfind();
fs = ip->i_fs;
if ((unsigned)osize > fs->fs_bsize || fragoff(fs, osize) != 0 ||
fs = ip->i_fs;
if ((unsigned)osize > fs->fs_bsize || fragoff(fs, osize) != 0 ||
brelse(obp);
return (NULL);
}
brelse(obp);
return (NULL);
}
- bp = getblk(ip->i_dev, fsbtodb(fs, bno), nsize);
+ bn = fsbtodb(fs, bno);
+ bp = getblk(ip->i_dev, bn, nsize);
bcopy(obp->b_un.b_addr, bp->b_un.b_addr, (u_int)osize);
bcopy(obp->b_un.b_addr, bp->b_un.b_addr, (u_int)osize);
+ count = howmany(osize, DEV_BSIZE);
+ s = splimp();
+ for (i = 0; i < count; i += CLBYTES / DEV_BSIZE)
+ if (mfind(ip->i_dev, bn + i))
+ munhash(ip->i_dev, bn + i);
+ splx(s);
bzero(bp->b_un.b_addr + osize, (unsigned)nsize - osize);
if (obp->b_flags & B_DELWRI) {
obp->b_flags &= ~B_DELWRI;
bzero(bp->b_un.b_addr + osize, (unsigned)nsize - osize);
if (obp->b_flags & B_DELWRI) {
obp->b_flags &= ~B_DELWRI;
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)lfs_alloc.c 6.17 (Berkeley) %G%
+ * @(#)lfs_alloc.c 6.18 (Berkeley) %G%
daddr_t bprev, bpref;
int osize, nsize;
{
daddr_t bprev, bpref;
int osize, nsize;
{
register struct fs *fs;
register struct buf *bp, *obp;
int cg, request;
register struct fs *fs;
register struct buf *bp, *obp;
int cg, request;
+ daddr_t bno, bn;
+ int i, count, s;
+ extern struct cmap *mfind();
fs = ip->i_fs;
if ((unsigned)osize > fs->fs_bsize || fragoff(fs, osize) != 0 ||
fs = ip->i_fs;
if ((unsigned)osize > fs->fs_bsize || fragoff(fs, osize) != 0 ||
brelse(obp);
return (NULL);
}
brelse(obp);
return (NULL);
}
- bp = getblk(ip->i_dev, fsbtodb(fs, bno), nsize);
+ bn = fsbtodb(fs, bno);
+ bp = getblk(ip->i_dev, bn, nsize);
bcopy(obp->b_un.b_addr, bp->b_un.b_addr, (u_int)osize);
bcopy(obp->b_un.b_addr, bp->b_un.b_addr, (u_int)osize);
+ count = howmany(osize, DEV_BSIZE);
+ s = splimp();
+ for (i = 0; i < count; i += CLBYTES / DEV_BSIZE)
+ if (mfind(ip->i_dev, bn + i))
+ munhash(ip->i_dev, bn + i);
+ splx(s);
bzero(bp->b_un.b_addr + osize, (unsigned)nsize - osize);
if (obp->b_flags & B_DELWRI) {
obp->b_flags &= ~B_DELWRI;
bzero(bp->b_un.b_addr + osize, (unsigned)nsize - osize);
if (obp->b_flags & B_DELWRI) {
obp->b_flags &= ~B_DELWRI;