Make sure all cached buffers with valid, not yet written data have been
run through copy-on-write. Call fscow_run() with valid data where possible. The LP_UFSCOW hack is no longer needed to protect ffs_copyonwrite() against endless recursion. - Add a flag B_MODIFY to bread(), breada() and breadn(). If set the caller intends to modify the buffer returned. - Always run copy-on-write on buffers returned from ffs_balloc(). - Add new function ffs_getblk() that gets a buffer, assigns a new blkno, may clear the buffer and runs copy-on-write. Process possible errors from getblk() or fscow_run(). Part of PR kern/38664. Welcome to 4.99.63 Reviewed by: YAMAMOTO Takashi <yamt@netbsd.org>
This commit is contained in:
parent
961a5d4bcb
commit
5d2bff060a
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: coalesce.c,v 1.15 2008/04/28 20:23:04 martin Exp $ */
|
||||
/* $NetBSD: coalesce.c,v 1.16 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002, 2005 The NetBSD Foundation, Inc.
|
||||
|
@ -118,7 +118,7 @@ get_dinode(struct clfs *fs, ino_t ino)
|
|||
if (daddr == 0x0)
|
||||
return NULL;
|
||||
|
||||
bread(fs->clfs_devvp, daddr, fs->lfs_ibsize, NOCRED, &bp);
|
||||
bread(fs->clfs_devvp, daddr, fs->lfs_ibsize, NOCRED, 0, &bp);
|
||||
for (dip = (struct ufs1_dinode *)bp->b_data;
|
||||
dip < (struct ufs1_dinode *)(bp->b_data + fs->lfs_ibsize); dip++)
|
||||
if (dip->di_inumber == ino) {
|
||||
|
@ -293,7 +293,7 @@ clean_inode(struct clfs *fs, ino_t ino)
|
|||
bps = segtod(fs, 1);
|
||||
for (tbip = bip; tbip < bip + nb; tbip += bps) {
|
||||
do {
|
||||
bread(fs->lfs_ivnode, 0, fs->lfs_bsize, NOCRED, &bp);
|
||||
bread(fs->lfs_ivnode, 0, fs->lfs_bsize, NOCRED, 0, &bp);
|
||||
cip = *(CLEANERINFO *)bp->b_data;
|
||||
brelse(bp, B_INVAL);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lfs_cleanerd.c,v 1.14 2008/04/28 20:23:04 martin Exp $ */
|
||||
/* $NetBSD: lfs_cleanerd.c,v 1.15 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005 The NetBSD Foundation, Inc.
|
||||
|
@ -313,7 +313,7 @@ lfs_ientry(IFILE **ifpp, struct clfs *fs, ino_t ino, struct ubuf **bpp)
|
|||
int error;
|
||||
|
||||
error = bread(fs->lfs_ivnode, ino / fs->lfs_ifpb + fs->lfs_cleansz +
|
||||
fs->lfs_segtabsz, fs->lfs_bsize, NOCRED, bpp);
|
||||
fs->lfs_segtabsz, fs->lfs_bsize, NOCRED, 0, bpp);
|
||||
if (error)
|
||||
syslog(LOG_ERR, "%s: ientry failed for ino %d",
|
||||
fs->lfs_fsmnt, (int)ino);
|
||||
|
@ -495,7 +495,8 @@ parse_pseg(struct clfs *fs, daddr_t daddr, BLOCK_INFO **bipp, int *bic)
|
|||
|
||||
syslog(LOG_WARNING, "fixing short FINFO at %x (seg %d)",
|
||||
odaddr, dtosn(fs, odaddr));
|
||||
bread(fs->clfs_devvp, odaddr, fs->lfs_fsize, NOCRED, &nbp);
|
||||
bread(fs->clfs_devvp, odaddr, fs->lfs_fsize,
|
||||
NOCRED, 0, &nbp);
|
||||
nssp = (SEGSUM *)nbp->b_data;
|
||||
--nssp->ss_nfinfo;
|
||||
nssp->ss_sumsum = cksum(&nssp->ss_datasum,
|
||||
|
@ -995,7 +996,7 @@ clean_fs(struct clfs *fs, CLEANERINFO *cip)
|
|||
npos = 0;
|
||||
for (i = 0; i < fs->lfs_nseg; i+= fs->lfs_sepb) {
|
||||
bread(fs->lfs_ivnode, fs->lfs_cleansz + i / fs->lfs_sepb,
|
||||
fs->lfs_bsize, NOCRED, &bp);
|
||||
fs->lfs_bsize, NOCRED, 0, &bp);
|
||||
for (j = 0; j < fs->lfs_sepb && i + j < fs->lfs_nseg; j++) {
|
||||
sup = ((SEGUSE *)bp->b_data) + j;
|
||||
fs->clfs_segtab[i + j].nbytes = sup->su_nbytes;
|
||||
|
@ -1186,7 +1187,7 @@ needs_cleaning(struct clfs *fs, CLEANERINFO *cip)
|
|||
* the cached information, so invalidate the buffer before
|
||||
* handing it back.
|
||||
*/
|
||||
if (bread(fs->lfs_ivnode, 0, fs->lfs_bsize, NOCRED, &bp)) {
|
||||
if (bread(fs->lfs_ivnode, 0, fs->lfs_bsize, NOCRED, 0, &bp)) {
|
||||
syslog(LOG_ERR, "%s: can't read inode", fs->lfs_fsmnt);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bufcache.c,v 1.12 2008/04/28 20:23:08 martin Exp $ */
|
||||
/* $NetBSD: bufcache.c,v 1.13 2008/05/16 09:21:59 hannken Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
|
@ -340,7 +340,7 @@ brelse(struct ubuf * bp, int set)
|
|||
/* Read the given block from disk, return it B_BUSY. */
|
||||
int
|
||||
bread(struct uvnode * vp, daddr_t lbn, int size, void * unused,
|
||||
struct ubuf ** bpp)
|
||||
int flags, struct ubuf ** bpp)
|
||||
{
|
||||
struct ubuf *bp;
|
||||
daddr_t daddr;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bufcache.h,v 1.10 2008/04/28 20:23:08 martin Exp $ */
|
||||
/* $NetBSD: bufcache.h,v 1.11 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -120,6 +120,6 @@ struct ubuf *incore(struct uvnode *, int);
|
|||
struct ubuf *getblk(struct uvnode *, daddr_t, int);
|
||||
void bwrite(struct ubuf *);
|
||||
void brelse(struct ubuf *, int);
|
||||
int bread(struct uvnode *, daddr_t, int, void *, struct ubuf **);
|
||||
int bread(struct uvnode *, daddr_t, int, void *, int, struct ubuf **);
|
||||
void reassignbuf(struct ubuf *, struct uvnode *);
|
||||
void dump_free_lists(void);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dir.c,v 1.23 2008/03/16 23:17:55 lukem Exp $ */
|
||||
/* $NetBSD: dir.c,v 1.24 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
|
@ -157,7 +157,7 @@ dirscan(struct inodesc *idesc)
|
|||
memcpy(dbuf, dp, (size_t) dsize);
|
||||
idesc->id_dirp = (struct direct *) dbuf;
|
||||
if ((n = (*idesc->id_func) (idesc)) & ALTERED) {
|
||||
bread(vp, idesc->id_lblkno, blksiz, NOCRED, &bp);
|
||||
bread(vp, idesc->id_lblkno, blksiz, NOCRED, 0, &bp);
|
||||
memcpy(bp->b_data + idesc->id_loc - dsize, dbuf,
|
||||
(size_t) dsize);
|
||||
VOP_BWRITE(bp);
|
||||
|
@ -180,7 +180,7 @@ fsck_readdir(struct uvnode *vp, struct inodesc *idesc)
|
|||
long size, blksiz, fix, dploc;
|
||||
|
||||
blksiz = idesc->id_numfrags * fs->lfs_fsize;
|
||||
bread(vp, idesc->id_lblkno, blksiz, NOCRED, &bp);
|
||||
bread(vp, idesc->id_lblkno, blksiz, NOCRED, 0, &bp);
|
||||
if (idesc->id_loc % DIRBLKSIZ == 0 && idesc->id_filesize > 0 &&
|
||||
idesc->id_loc < blksiz) {
|
||||
dp = (struct direct *) (bp->b_data + idesc->id_loc);
|
||||
|
@ -190,7 +190,7 @@ fsck_readdir(struct uvnode *vp, struct inodesc *idesc)
|
|||
if (idesc->id_fix == IGNORE)
|
||||
return (0);
|
||||
fix = dofix(idesc, "DIRECTORY CORRUPTED");
|
||||
bread(vp, idesc->id_lblkno, blksiz, NOCRED, &bp);
|
||||
bread(vp, idesc->id_lblkno, blksiz, NOCRED, 0, &bp);
|
||||
dp = (struct direct *) (bp->b_data + idesc->id_loc);
|
||||
dp->d_reclen = DIRBLKSIZ;
|
||||
dp->d_ino = 0;
|
||||
|
@ -228,7 +228,7 @@ dpok:
|
|||
if (idesc->id_fix == IGNORE)
|
||||
return 0;
|
||||
fix = dofix(idesc, "DIRECTORY CORRUPTED");
|
||||
bread(vp, idesc->id_lblkno, blksiz, NOCRED, &bp);
|
||||
bread(vp, idesc->id_lblkno, blksiz, NOCRED, 0, &bp);
|
||||
dp = (struct direct *) (bp->b_data + dploc);
|
||||
dp->d_reclen += size;
|
||||
if (fix)
|
||||
|
@ -575,11 +575,11 @@ expanddir(struct uvnode *vp, struct ufs1_dinode *dp, char *name)
|
|||
dp->di_size += fs->lfs_bsize;
|
||||
dp->di_blocks += btofsb(fs, fs->lfs_bsize);
|
||||
bread(vp, dp->di_db[lastbn + 1],
|
||||
(long) dblksize(fs, dp, lastbn + 1), NOCRED, &bp);
|
||||
(long) dblksize(fs, dp, lastbn + 1), NOCRED, 0, &bp);
|
||||
if (bp->b_flags & B_ERROR)
|
||||
goto bad;
|
||||
memcpy(firstblk, bp->b_data, DIRBLKSIZ);
|
||||
bread(vp, lastbn, fs->lfs_bsize, NOCRED, &bp);
|
||||
bread(vp, lastbn, fs->lfs_bsize, NOCRED, 0, &bp);
|
||||
if (bp->b_flags & B_ERROR)
|
||||
goto bad;
|
||||
memcpy(bp->b_data, firstblk, DIRBLKSIZ);
|
||||
|
@ -589,7 +589,7 @@ expanddir(struct uvnode *vp, struct ufs1_dinode *dp, char *name)
|
|||
memcpy(cp, &emptydir, sizeof emptydir);
|
||||
VOP_BWRITE(bp);
|
||||
bread(vp, dp->di_db[lastbn + 1],
|
||||
(long) dblksize(fs, dp, lastbn + 1), NOCRED, &bp);
|
||||
(long) dblksize(fs, dp, lastbn + 1), NOCRED, 0, &bp);
|
||||
if (bp->b_flags & B_ERROR)
|
||||
goto bad;
|
||||
memcpy(bp->b_data, &emptydir, sizeof emptydir);
|
||||
|
@ -628,7 +628,7 @@ allocdir(ino_t parent, ino_t request, int mode)
|
|||
dirp->dotdot_ino = parent;
|
||||
vp = vget(fs, ino);
|
||||
dp = VTOD(vp);
|
||||
bread(vp, dp->di_db[0], fs->lfs_fsize, NOCRED, &bp);
|
||||
bread(vp, dp->di_db[0], fs->lfs_fsize, NOCRED, 0, &bp);
|
||||
if (bp->b_flags & B_ERROR) {
|
||||
brelse(bp, 0);
|
||||
freeino(ino);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: inode.c,v 1.38 2008/04/28 20:23:08 martin Exp $ */
|
||||
/* $NetBSD: inode.c,v 1.39 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -246,7 +246,8 @@ iblock(struct inodesc *idesc, long ilevel, u_int64_t isize)
|
|||
return (SKIP);
|
||||
|
||||
devvp = fs->lfs_devvp;
|
||||
bread(devvp, fsbtodb(fs, idesc->id_blkno), fs->lfs_bsize, NOCRED, &bp);
|
||||
bread(devvp, fsbtodb(fs, idesc->id_blkno), fs->lfs_bsize,
|
||||
NOCRED, 0, &bp);
|
||||
ilevel--;
|
||||
for (sizepb = fs->lfs_bsize, i = 0; i < ilevel; i++)
|
||||
sizepb *= NINDIR(fs);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lfs.c,v 1.28 2008/04/28 20:23:08 martin Exp $ */
|
||||
/* $NetBSD: lfs.c,v 1.29 2008/05/16 09:21:59 hannken Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
|
@ -365,7 +365,8 @@ lfs_raw_vget(struct lfs * fs, ino_t ino, int fd, ufs_daddr_t daddr)
|
|||
|
||||
/* Load inode block and find inode */
|
||||
if (daddr > 0) {
|
||||
bread(fs->lfs_devvp, fsbtodb(fs, daddr), fs->lfs_ibsize, NULL, &bp);
|
||||
bread(fs->lfs_devvp, fsbtodb(fs, daddr), fs->lfs_ibsize,
|
||||
NULL, 0, &bp);
|
||||
bp->b_flags |= B_AGE;
|
||||
dip = lfs_ifind(fs, ino, bp);
|
||||
if (dip == NULL) {
|
||||
|
@ -476,7 +477,7 @@ lfs_init(int devfd, daddr_t sblkno, daddr_t idaddr, int dummy_read, int debug)
|
|||
} else if (debug) {
|
||||
printf("No -b flag given, not attempting to verify checkpoint\n");
|
||||
}
|
||||
error = bread(devvp, sblkno, LFS_SBPAD, NOCRED, &bp);
|
||||
error = bread(devvp, sblkno, LFS_SBPAD, NOCRED, 0, &bp);
|
||||
fs = ecalloc(1, sizeof(*fs));
|
||||
fs->lfs_dlfs = *((struct dlfs *) bp->b_data);
|
||||
fs->lfs_devvp = devvp;
|
||||
|
@ -485,7 +486,7 @@ lfs_init(int devfd, daddr_t sblkno, daddr_t idaddr, int dummy_read, int debug)
|
|||
|
||||
if (tryalt) {
|
||||
error = bread(devvp, fsbtodb(fs, fs->lfs_sboffs[1]),
|
||||
LFS_SBPAD, NOCRED, &bp);
|
||||
LFS_SBPAD, NOCRED, 0, &bp);
|
||||
altfs = ecalloc(1, sizeof(*altfs));
|
||||
altfs->lfs_dlfs = *((struct dlfs *) bp->b_data);
|
||||
altfs->lfs_devvp = devvp;
|
||||
|
@ -592,7 +593,8 @@ try_verify(struct lfs *osb, struct uvnode *devvp, ufs_daddr_t goal, int debug)
|
|||
}
|
||||
|
||||
/* Read in summary block */
|
||||
bread(devvp, fsbtodb(osb, daddr), osb->lfs_sumsize, NULL, &bp);
|
||||
bread(devvp, fsbtodb(osb, daddr), osb->lfs_sumsize,
|
||||
NULL, 0, &bp);
|
||||
sp = (SEGSUM *)bp->b_data;
|
||||
|
||||
/*
|
||||
|
@ -787,7 +789,8 @@ check_summary(struct lfs *fs, SEGSUM *sp, ufs_daddr_t pseg_addr, int debug,
|
|||
break;
|
||||
}
|
||||
while (j < howmany(sp->ss_ninos, INOPB(fs)) && *idp == daddr) {
|
||||
bread(devvp, fsbtodb(fs, daddr), fs->lfs_ibsize, NOCRED, &bp);
|
||||
bread(devvp, fsbtodb(fs, daddr), fs->lfs_ibsize,
|
||||
NOCRED, 0, &bp);
|
||||
datap[datac++] = ((u_int32_t *) (bp->b_data))[0];
|
||||
brelse(bp, 0);
|
||||
|
||||
|
@ -802,7 +805,8 @@ check_summary(struct lfs *fs, SEGSUM *sp, ufs_daddr_t pseg_addr, int debug,
|
|||
len = (k == fp->fi_nblocks - 1 ?
|
||||
fp->fi_lastlength
|
||||
: fs->lfs_bsize);
|
||||
bread(devvp, fsbtodb(fs, daddr), len, NOCRED, &bp);
|
||||
bread(devvp, fsbtodb(fs, daddr), len,
|
||||
NOCRED, 0, &bp);
|
||||
datap[datac++] = ((u_int32_t *) (bp->b_data))[0];
|
||||
brelse(bp, 0);
|
||||
daddr += btofsb(fs, len);
|
||||
|
@ -1042,7 +1046,8 @@ lfs_balloc(struct uvnode *vp, off_t startoffset, int iosize, struct ubuf **bpp)
|
|||
} else {
|
||||
if (nsize <= osize) {
|
||||
/* No need to extend */
|
||||
if (bpp && (error = bread(vp, lbn, osize, NOCRED, &bp)))
|
||||
if (bpp && (error = bread(vp, lbn, osize,
|
||||
NOCRED, 0, &bp)))
|
||||
return error;
|
||||
} else {
|
||||
/* Extend existing block */
|
||||
|
@ -1150,7 +1155,7 @@ lfs_balloc(struct uvnode *vp, off_t startoffset, int iosize, struct ubuf **bpp)
|
|||
default:
|
||||
idp = &indirs[num - 1];
|
||||
if (bread(vp, idp->in_lbn, fs->lfs_bsize, NOCRED,
|
||||
&ibp))
|
||||
0, &ibp))
|
||||
panic("lfs_balloc: bread bno %lld",
|
||||
(long long)idp->in_lbn);
|
||||
/* XXX ondisk32 */
|
||||
|
@ -1201,7 +1206,7 @@ lfs_fragextend(struct uvnode *vp, int osize, int nsize, daddr_t lbn,
|
|||
* appropriate things and making sure it all goes to disk.
|
||||
* Don't bother to read in that case.
|
||||
*/
|
||||
if (bpp && (error = bread(vp, lbn, osize, NOCRED, bpp))) {
|
||||
if (bpp && (error = bread(vp, lbn, osize, NOCRED, 0, bpp))) {
|
||||
brelse(*bpp, 0);
|
||||
goto out;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pass6.c,v 1.21 2008/04/28 20:23:08 martin Exp $ */
|
||||
/* $NetBSD: pass6.c,v 1.22 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -120,7 +120,7 @@ rfw_update_single(struct uvnode *vp, daddr_t lbn, ufs_daddr_t ndaddr, int size)
|
|||
break;
|
||||
default:
|
||||
ap = &a[num - 1];
|
||||
if (bread(vp, ap->in_lbn, fs->lfs_bsize, NULL, &bp))
|
||||
if (bread(vp, ap->in_lbn, fs->lfs_bsize, NULL, 0, &bp))
|
||||
errx(1, "lfs_updatemeta: bread bno %" PRId64,
|
||||
ap->in_lbn);
|
||||
|
||||
|
@ -338,14 +338,14 @@ account_indir(struct uvnode *vp, struct ufs1_dinode *dp, daddr_t ilbn, daddr_t d
|
|||
lbn = -ilbn;
|
||||
else
|
||||
lbn = ilbn + 1;
|
||||
bread(fs->lfs_devvp, fsbtodb(fs, daddr), fs->lfs_bsize, NULL, &bp);
|
||||
bread(fs->lfs_devvp, fsbtodb(fs, daddr), fs->lfs_bsize, NULL, 0, &bp);
|
||||
buf = emalloc(fs->lfs_bsize);
|
||||
memcpy(buf, bp->b_data, fs->lfs_bsize);
|
||||
brelse(bp, 0);
|
||||
|
||||
obuf = emalloc(fs->lfs_bsize);
|
||||
if (vp) {
|
||||
bread(vp, ilbn, fs->lfs_bsize, NULL, &bp);
|
||||
bread(vp, ilbn, fs->lfs_bsize, NULL, 0, &bp);
|
||||
memcpy(obuf, bp->b_data, fs->lfs_bsize);
|
||||
brelse(bp, 0);
|
||||
} else
|
||||
|
@ -614,7 +614,7 @@ pass6(void)
|
|||
}
|
||||
|
||||
/* Read in summary block */
|
||||
bread(devvp, fsbtodb(fs, daddr), fs->lfs_sumsize, NULL, &bp);
|
||||
bread(devvp, fsbtodb(fs, daddr), fs->lfs_sumsize, NULL, 0, &bp);
|
||||
sp = (SEGSUM *)bp->b_data;
|
||||
if (debug)
|
||||
pwarn("sum at 0x%x: ninos=%d nfinfo=%d\n",
|
||||
|
@ -654,7 +654,7 @@ pass6(void)
|
|||
fs->lfs_bfree -= btofsb(fs, fs->lfs_ibsize);
|
||||
sbdirty();
|
||||
bread(devvp, fsbtodb(fs, ibdaddr), fs->lfs_ibsize,
|
||||
NOCRED, &ibp);
|
||||
NOCRED, 0, &ibp);
|
||||
memcpy(ibbuf, ibp->b_data, fs->lfs_ibsize);
|
||||
brelse(ibp, 0);
|
||||
|
||||
|
@ -841,7 +841,7 @@ pass6(void)
|
|||
}
|
||||
|
||||
/* Read in summary block */
|
||||
bread(devvp, fsbtodb(fs, daddr), fs->lfs_sumsize, NULL, &bp);
|
||||
bread(devvp, fsbtodb(fs, daddr), fs->lfs_sumsize, NULL, 0, &bp);
|
||||
sp = (SEGSUM *)bp->b_data;
|
||||
bc = check_summary(fs, sp, daddr, debug, devvp, pass6harvest);
|
||||
if (bc == 0) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: segwrite.c,v 1.18 2008/04/28 20:23:08 martin Exp $ */
|
||||
/* $NetBSD: segwrite.c,v 1.19 2008/05/16 09:21:59 hannken Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
|
@ -472,7 +472,7 @@ lfs_update_single(struct lfs * fs, struct segment * sp, daddr_t lbn,
|
|||
break;
|
||||
default:
|
||||
ap = &a[num - 1];
|
||||
if (bread(vp, ap->in_lbn, fs->lfs_bsize, NULL, &bp))
|
||||
if (bread(vp, ap->in_lbn, fs->lfs_bsize, NULL, 0, &bp))
|
||||
errx(1, "lfs_updatemeta: bread bno %" PRId64,
|
||||
ap->in_lbn);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: setup.c,v 1.35 2008/04/28 20:23:08 martin Exp $ */
|
||||
/* $NetBSD: setup.c,v 1.36 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -261,7 +261,7 @@ setup(const char *dev)
|
|||
while (tdaddr < idaddr) {
|
||||
bread(fs->lfs_devvp, fsbtodb(fs, tdaddr),
|
||||
fs->lfs_sumsize,
|
||||
NULL, &bp);
|
||||
NULL, 0, &bp);
|
||||
sp = (SEGSUM *)bp->b_data;
|
||||
if (sp->ss_sumsum != cksum(&sp->ss_datasum,
|
||||
fs->lfs_sumsize -
|
||||
|
@ -416,7 +416,7 @@ setup(const char *dev)
|
|||
if (debug)
|
||||
pwarn("maxino = %llu\n", (unsigned long long)maxino);
|
||||
for (i = 0; i < VTOI(ivp)->i_ffs1_size; i += fs->lfs_bsize) {
|
||||
bread(ivp, i >> fs->lfs_bshift, fs->lfs_bsize, NOCRED, &bp);
|
||||
bread(ivp, i >> fs->lfs_bshift, fs->lfs_bsize, NOCRED, 0, &bp);
|
||||
/* XXX check B_ERROR */
|
||||
brelse(bp, 0);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: make_lfs.c,v 1.12 2008/04/28 20:23:09 martin Exp $ */
|
||||
/* $NetBSD: make_lfs.c,v 1.13 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -62,7 +62,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)lfs.c 8.5 (Berkeley) 5/24/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: make_lfs.c,v 1.12 2008/04/28 20:23:09 martin Exp $");
|
||||
__RCSID("$NetBSD: make_lfs.c,v 1.13 2008/05/16 09:21:59 hannken Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -684,7 +684,7 @@ make_lfs(int devfd, uint secsize, struct dkwedge_info *dkw, int minfree,
|
|||
if (DIRBLKSIZ < fs->lfs_bsize)
|
||||
VTOI(vp)->i_lfs_fragsize[i - 1] =
|
||||
roundup(DIRBLKSIZ,fs->lfs_fsize);
|
||||
bread(vp, 0, fs->lfs_fsize, NOCRED, &bp);
|
||||
bread(vp, 0, fs->lfs_fsize, NOCRED, 0, &bp);
|
||||
make_dir(bp->b_data, lfs_root_dir,
|
||||
sizeof(lfs_root_dir) / sizeof(struct direct));
|
||||
VOP_BWRITE(bp);
|
||||
|
@ -704,7 +704,7 @@ make_lfs(int devfd, uint secsize, struct dkwedge_info *dkw, int minfree,
|
|||
if (DIRBLKSIZ < fs->lfs_bsize)
|
||||
VTOI(vp)->i_lfs_fragsize[i - 1] =
|
||||
roundup(DIRBLKSIZ,fs->lfs_fsize);
|
||||
bread(vp, 0, fs->lfs_fsize, NOCRED, &bp);
|
||||
bread(vp, 0, fs->lfs_fsize, NOCRED, 0, &bp);
|
||||
make_dir(bp->b_data, lfs_lf_dir,
|
||||
sizeof(lfs_lf_dir) / sizeof(struct direct));
|
||||
VOP_BWRITE(bp);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: buffercache.9,v 1.22 2007/07/14 10:52:48 ad Exp $
|
||||
.\" $NetBSD: buffercache.9,v 1.23 2008/05/16 09:21:59 hannken Exp $
|
||||
.\"
|
||||
.\" Copyright (c)2003 YAMAMOTO Takashi,
|
||||
.\" All rights reserved.
|
||||
|
@ -101,7 +101,7 @@
|
|||
.\"
|
||||
.\"
|
||||
.\" ------------------------------------------------------------
|
||||
.Dd October 4, 2006
|
||||
.Dd May 16, 2008
|
||||
.Dt BUFFERCACHE 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -125,15 +125,15 @@
|
|||
.In sys/buf.h
|
||||
.Ft int
|
||||
.Fn bread "struct vnode *vp" "daddr_t blkno" "int size" \
|
||||
"struct kauth_cred *cred" "struct buf **bpp"
|
||||
"struct kauth_cred *cred" "int flags" "struct buf **bpp"
|
||||
.Ft int
|
||||
.Fn breadn "struct vnode *vp" "daddr_t blkno" "int size" \
|
||||
"daddr_t rablks[]" "int rasizes[]" "int nrablks" \
|
||||
"struct kauth_cred *cred" "struct buf **bpp"
|
||||
"struct kauth_cred *cred" "int flags" "struct buf **bpp"
|
||||
.Ft int
|
||||
.Fn breada "struct vnode *vp" "daddr_t blkno" "int size" \
|
||||
"daddr_t rablkno" "int rabsize" \
|
||||
"struct kauth_cred *cred" "struct buf **bpp"
|
||||
"struct kauth_cred *cred" "int flags" "struct buf **bpp"
|
||||
.Ft int
|
||||
.Fn bwrite "struct buf *bp"
|
||||
.Ft void
|
||||
|
@ -174,7 +174,7 @@ the disk driver interface.
|
|||
.\" ------------------------------------------------------------
|
||||
.Sh FUNCTIONS
|
||||
.Bl -tag -width compact
|
||||
.It Fn bread "vp" "blkno" "size" "cred" "bpp"
|
||||
.It Fn bread "vp" "blkno" "size" "cred" "flags" "bpp"
|
||||
Read a block corresponding to
|
||||
.Fa vp
|
||||
and
|
||||
|
@ -225,7 +225,8 @@ it should be unbusied using one of variants of
|
|||
Otherwise, it should be unbusied using
|
||||
.Fn brelse .
|
||||
.\" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
.It Fn breadn "vp" "blkno" "size" "rablks" "rasizes" "nrablks" "cred" "bpp"
|
||||
.It Fn breadn "vp" "blkno" "size" "rablks" "rasizes" "nrablks" "cred" "flags" \
|
||||
"bpp"
|
||||
Get a buffer as
|
||||
.Fn bread .
|
||||
In addition,
|
||||
|
@ -235,7 +236,7 @@ will start read-ahead of blocks specified by
|
|||
.Fa rasizes ,
|
||||
.Fa nrablks .
|
||||
.\" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
.It Fn breada "vp" "blkno" "size" "rablkno" "rabsize" "cred" "bpp"
|
||||
.It Fn breada "vp" "blkno" "size" "rablkno" "rabsize" "cred" "flags" "bpp"
|
||||
Same as
|
||||
.Fn breadn
|
||||
with single block read-ahead.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: advfsops.c,v 1.51 2008/05/10 02:26:09 rumble Exp $ */
|
||||
/* $NetBSD: advfsops.c,v 1.52 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Christian E. Hopps
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: advfsops.c,v 1.51 2008/05/10 02:26:09 rumble Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: advfsops.c,v 1.52 2008/05/16 09:21:59 hannken Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_compat_netbsd.h"
|
||||
|
@ -213,7 +213,7 @@ adosfs_mountfs(devvp, mp, l)
|
|||
|
||||
bp = NULL;
|
||||
if ((error = bread(devvp, (daddr_t)BBOFF,
|
||||
amp->bsize, NOCRED, &bp)) != 0) {
|
||||
amp->bsize, NOCRED, 0, &bp)) != 0) {
|
||||
brelse(bp, 0);
|
||||
goto fail;
|
||||
}
|
||||
|
@ -398,7 +398,7 @@ adosfs_vget(mp, an, vpp)
|
|||
adosfs_ainshash(amp, ap);
|
||||
|
||||
if ((error = bread(amp->devvp, an * amp->bsize / DEV_BSIZE,
|
||||
amp->bsize, NOCRED, &bp)) != 0) {
|
||||
amp->bsize, NOCRED, 0, &bp)) != 0) {
|
||||
brelse(bp, 0);
|
||||
vput(vp);
|
||||
return (error);
|
||||
|
@ -518,7 +518,7 @@ adosfs_vget(mp, an, vpp)
|
|||
brelse(bp, 0);
|
||||
bp = NULL;
|
||||
error = bread(amp->devvp, ap->linkto * amp->bsize / DEV_BSIZE,
|
||||
amp->bsize, NOCRED, &bp);
|
||||
amp->bsize, NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
vput(vp);
|
||||
|
@ -600,7 +600,7 @@ adosfs_loadbitmap(amp)
|
|||
bp = mapbp = NULL;
|
||||
bn = amp->rootb;
|
||||
if ((error = bread(amp->devvp, bn * amp->bsize / DEV_BSIZE, amp->bsize,
|
||||
NOCRED, &bp)) != 0) {
|
||||
NOCRED, 0, &bp)) != 0) {
|
||||
brelse(bp, 0);
|
||||
return (error);
|
||||
}
|
||||
|
@ -618,7 +618,7 @@ adosfs_loadbitmap(amp)
|
|||
brelse(mapbp, 0);
|
||||
if ((error = bread(amp->devvp,
|
||||
adoswordn(bp, blkix) * amp->bsize / DEV_BSIZE, amp->bsize,
|
||||
NOCRED, &mapbp)) != 0)
|
||||
NOCRED, 0, &mapbp)) != 0)
|
||||
break;
|
||||
if (adoscksum(mapbp, amp->nwords)) {
|
||||
#ifdef DIAGNOSTIC
|
||||
|
@ -645,7 +645,7 @@ adosfs_loadbitmap(amp)
|
|||
bn = adoswordn(bp, blkix);
|
||||
brelse(bp, 0);
|
||||
if ((error = bread(amp->devvp, bn * amp->bsize / DEV_BSIZE,
|
||||
amp->bsize, NOCRED, &bp)) != 0)
|
||||
amp->bsize, NOCRED, 0, &bp)) != 0)
|
||||
break;
|
||||
/*
|
||||
* Why is there no checksum on these blocks?
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: advnops.c,v 1.28 2008/01/25 14:32:12 ad Exp $ */
|
||||
/* $NetBSD: advnops.c,v 1.29 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Christian E. Hopps
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: advnops.c,v 1.28 2008/01/25 14:32:12 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: advnops.c,v 1.29 2008/05/16 09:21:59 hannken Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_quota.h"
|
||||
|
@ -305,7 +305,7 @@ adosfs_read(v)
|
|||
* but not much as ados makes little attempt to
|
||||
* make things contigous
|
||||
*/
|
||||
error = bread(sp->a_vp, lbn, amp->bsize, NOCRED, &bp);
|
||||
error = bread(sp->a_vp, lbn, amp->bsize, NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
goto reterr;
|
||||
|
@ -530,7 +530,7 @@ adosfs_bmap(v)
|
|||
goto reterr;
|
||||
}
|
||||
error = bread(ap->amp->devvp, nb * ap->amp->bsize / DEV_BSIZE,
|
||||
ap->amp->bsize, NOCRED, &flbp);
|
||||
ap->amp->bsize, NOCRED, 0, &flbp);
|
||||
if (error) {
|
||||
brelse(flbp, 0);
|
||||
goto reterr;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cd9660_lookup.c,v 1.15 2008/02/27 19:43:36 matt Exp $ */
|
||||
/* $NetBSD: cd9660_lookup.c,v 1.16 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1989, 1993, 1994
|
||||
|
@ -39,7 +39,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: cd9660_lookup.c,v 1.15 2008/02/27 19:43:36 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cd9660_lookup.c,v 1.16 2008/05/16 09:21:59 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/namei.h>
|
||||
|
@ -426,7 +426,7 @@ cd9660_blkatoff(struct vnode *vp, off_t offset, char **res, struct buf **bpp)
|
|||
lbn = lblkno(imp, offset);
|
||||
bsize = blksize(imp, ip, lbn);
|
||||
|
||||
if ((error = bread(vp, lbn, bsize, NOCRED, &bp)) != 0) {
|
||||
if ((error = bread(vp, lbn, bsize, NOCRED, 0, &bp)) != 0) {
|
||||
brelse(bp, 0);
|
||||
*bpp = NULL;
|
||||
return (error);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cd9660_rrip.c,v 1.15 2008/02/27 19:43:36 matt Exp $ */
|
||||
/* $NetBSD: cd9660_rrip.c,v 1.16 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993, 1994
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: cd9660_rrip.c,v 1.15 2008/02/27 19:43:36 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cd9660_rrip.c,v 1.16 2008/05/16 09:21:59 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -548,7 +548,8 @@ cd9660_rrip_loop(struct iso_directory_record *isodir, ISO_RRIP_ANALYZE *ana,
|
|||
|| ana->iso_ce_off + ana->iso_ce_len > ana->imp->logical_block_size
|
||||
|| bread(ana->imp->im_devvp,
|
||||
ana->iso_ce_blk << (ana->imp->im_bshift - DEV_BSHIFT),
|
||||
ana->imp->logical_block_size, NOCRED, &bp))
|
||||
ana->imp->logical_block_size, NOCRED,
|
||||
0, &bp))
|
||||
/* what to do now? */
|
||||
break;
|
||||
phead = (ISO_SUSP_HEADER *)((char *)bp->b_data + ana->iso_ce_off);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cd9660_vfsops.c,v 1.61 2008/05/06 18:43:44 ad Exp $ */
|
||||
/* $NetBSD: cd9660_vfsops.c,v 1.62 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.61 2008/05/06 18:43:44 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.62 2008/05/16 09:21:59 hannken Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_compat_netbsd.h"
|
||||
|
@ -353,7 +353,7 @@ iso_mountfs(struct vnode *devvp, struct mount *mp, struct lwp *l,
|
|||
|
||||
for (iso_blknum = 16; iso_blknum < 100; iso_blknum++) {
|
||||
if ((error = bread(devvp, (iso_blknum+sess) * btodb(iso_bsize),
|
||||
iso_bsize, NOCRED, &bp)) != 0)
|
||||
iso_bsize, NOCRED, 0, &bp)) != 0)
|
||||
goto out;
|
||||
|
||||
vdp = (struct iso_volume_descriptor *)bp->b_data;
|
||||
|
@ -431,7 +431,7 @@ iso_mountfs(struct vnode *devvp, struct mount *mp, struct lwp *l,
|
|||
(isomp->root_extent + ext_attr_length) <<
|
||||
(isomp->im_bshift - DEV_BSHIFT),
|
||||
isomp->logical_block_size, NOCRED,
|
||||
&bp)) != 0)
|
||||
0, &bp)) != 0)
|
||||
goto out;
|
||||
|
||||
rootp = (struct iso_directory_record *)bp->b_data;
|
||||
|
@ -742,7 +742,7 @@ cd9660_vget_internal(struct mount *mp, ino_t ino, struct vnode **vpp,
|
|||
|
||||
error = bread(imp->im_devvp,
|
||||
lbn << (imp->im_bshift - DEV_BSHIFT),
|
||||
imp->logical_block_size, NOCRED, &bp);
|
||||
imp->logical_block_size, NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
brelse(bp, 0);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cd9660_vnops.c,v 1.33 2008/02/27 19:43:36 matt Exp $ */
|
||||
/* $NetBSD: cd9660_vnops.c,v 1.34 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: cd9660_vnops.c,v 1.33 2008/02/27 19:43:36 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cd9660_vnops.c,v 1.34 2008/05/16 09:21:59 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -243,9 +243,9 @@ cd9660_read(void *v)
|
|||
if (lblktosize(imp, rablock) < ip->i_size) {
|
||||
rasize = blksize(imp, ip, rablock);
|
||||
error = breadn(vp, lbn, size, &rablock,
|
||||
&rasize, 1, NOCRED, &bp);
|
||||
&rasize, 1, NOCRED, 0, &bp);
|
||||
} else {
|
||||
error = bread(vp, lbn, size, NOCRED, &bp);
|
||||
error = bread(vp, lbn, size, NOCRED, 0, &bp);
|
||||
}
|
||||
n = MIN(n, size - bp->b_resid);
|
||||
if (error) {
|
||||
|
@ -582,7 +582,7 @@ cd9660_readlink(void *v)
|
|||
error = bread(imp->im_devvp,
|
||||
(ip->i_number >> imp->im_bshift) <<
|
||||
(imp->im_bshift - DEV_BSHIFT),
|
||||
imp->logical_block_size, NOCRED, &bp);
|
||||
imp->logical_block_size, NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return (EINVAL);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: efs_subr.c,v 1.6 2007/10/08 18:04:03 ad Exp $ */
|
||||
/* $NetBSD: efs_subr.c,v 1.7 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Stephen M. Rumble <rumble@ephemeral.org>
|
||||
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: efs_subr.c,v 1.6 2007/10/08 18:04:03 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: efs_subr.c,v 1.7 2008/05/16 09:21:59 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kauth.h>
|
||||
|
@ -189,7 +189,7 @@ efs_bread(struct efs_mount *emp, uint32_t bboff, struct lwp *l, struct buf **bp)
|
|||
KASSERT(bboff < EFS_SIZE_MAX);
|
||||
|
||||
return (bread(emp->em_devvp, (daddr_t)bboff * (EFS_BB_SIZE / DEV_BSIZE),
|
||||
EFS_BB_SIZE, (l == NULL) ? NOCRED : l->l_cred, bp));
|
||||
EFS_BB_SIZE, (l == NULL) ? NOCRED : l->l_cred, 0, bp));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: filecore_bmap.c,v 1.7 2008/04/30 14:07:14 ad Exp $ */
|
||||
/* $NetBSD: filecore_bmap.c,v 1.8 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994 The Regents of the University of California.
|
||||
|
@ -66,7 +66,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: filecore_bmap.c,v 1.7 2008/04/30 14:07:14 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: filecore_bmap.c,v 1.8 2008/05/16 09:21:59 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -167,7 +167,7 @@ filecore_map(fcmp, addr, lbn, bnp)
|
|||
sect <<= fcmp->drec.share_size;
|
||||
do {
|
||||
error=bread(fcmp->fc_devvp, fcmp->map + zone,
|
||||
1 << fcmp->drec.log2secsize, NOCRED, &bp);
|
||||
1 << fcmp->drec.log2secsize, NOCRED, 0, &bp);
|
||||
#ifdef FILECORE_DEBUG_BR
|
||||
printf("bread(%p, %lx, %d, CRED, %p)=%d\n", fcmp->fc_devvp,
|
||||
fcmp->map+zone, 1 << fcmp->drec.log2secsize, bp, error);
|
||||
|
@ -256,7 +256,7 @@ filecore_bread(fcmp, addr, size, cred, bp)
|
|||
#endif
|
||||
return error;
|
||||
}
|
||||
error = bread(fcmp->fc_devvp, bn, size, cred, bp);
|
||||
error = bread(fcmp->fc_devvp, bn, size, cred, 0, bp);
|
||||
#ifdef FILECORE_DEBUG_BR
|
||||
printf("bread(%p, %llx, %d, CRED, %p)=%d\n", fcmp->fc_devvp,
|
||||
(long long)bn, size, *bp, error);
|
||||
|
@ -277,7 +277,7 @@ filecore_dbread(ip, bp)
|
|||
if (error)
|
||||
return error;
|
||||
error = bread(ip->i_mnt->fc_devvp, ip->i_block, FILECORE_DIR_SIZE,
|
||||
NOCRED, bp);
|
||||
NOCRED, 0, bp);
|
||||
#ifdef FILECORE_DEBUG_BR
|
||||
printf("bread(%p, %llx, %d, CRED, %p)=%d\n", ip->i_mnt->fc_devvp,
|
||||
(long long)ip->i_block, FILECORE_DIR_SIZE, *bp, error);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: filecore_vfsops.c,v 1.53 2008/05/10 02:26:09 rumble Exp $ */
|
||||
/* $NetBSD: filecore_vfsops.c,v 1.54 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994 The Regents of the University of California.
|
||||
|
@ -66,7 +66,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: filecore_vfsops.c,v 1.53 2008/05/10 02:26:09 rumble Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: filecore_vfsops.c,v 1.54 2008/05/16 09:21:59 hannken Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_compat_netbsd.h"
|
||||
|
@ -320,7 +320,7 @@ filecore_mountfs(devvp, mp, l, argp)
|
|||
|
||||
/* Read the filecore boot block to check FS validity and to find the map */
|
||||
error = bread(devvp, FILECORE_BOOTBLOCK_BLKN,
|
||||
FILECORE_BOOTBLOCK_SIZE, NOCRED, &bp);
|
||||
FILECORE_BOOTBLOCK_SIZE, NOCRED, 0, &bp);
|
||||
#ifdef FILECORE_DEBUG_BR
|
||||
printf("bread(%p, %x, %d, CRED, %p)=%d\n", devvp,
|
||||
FILECORE_BOOTBLOCK_BLKN, FILECORE_BOOTBLOCK_SIZE,
|
||||
|
@ -347,7 +347,7 @@ filecore_mountfs(devvp, mp, l, argp)
|
|||
bp = NULL;
|
||||
|
||||
/* Read the bootblock in the map */
|
||||
error = bread(devvp, map, 1 << log2secsize, NOCRED, &bp);
|
||||
error = bread(devvp, map, 1 << log2secsize, NOCRED, 0, &bp);
|
||||
#ifdef FILECORE_DEBUG_BR
|
||||
printf("bread(%p, %x, %d, CRED, %p)=%d\n", devvp,
|
||||
map, 1 << log2secsize, bp, error);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: filecore_vnops.c,v 1.26 2008/04/30 14:07:14 ad Exp $ */
|
||||
/* $NetBSD: filecore_vnops.c,v 1.27 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994 The Regents of the University of California.
|
||||
|
@ -66,7 +66,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: filecore_vnops.c,v 1.26 2008/04/30 14:07:14 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: filecore_vnops.c,v 1.27 2008/05/16 09:21:59 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -238,7 +238,7 @@ filecore_read(v)
|
|||
n = MIN(FILECORE_DIR_SIZE - on, uio->uio_resid);
|
||||
size = FILECORE_DIR_SIZE;
|
||||
} else {
|
||||
error = bread(vp, lbn, size, NOCRED, &bp);
|
||||
error = bread(vp, lbn, size, NOCRED, 0, &bp);
|
||||
#ifdef FILECORE_DEBUG_BR
|
||||
printf("bread(%p, %llx, %ld, CRED, %p)=%d\n",
|
||||
vp, (long long)lbn, size, bp, error);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: hfs_subr.c,v 1.8 2008/01/24 17:32:53 ad Exp $ */
|
||||
/* $NetBSD: hfs_subr.c,v 1.9 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: hfs_subr.c,v 1.8 2008/01/24 17:32:53 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: hfs_subr.c,v 1.9 2008/05/16 09:21:59 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -312,7 +312,8 @@ hfs_pread(struct vnode *vp, void *buf, size_t secsz, uint64_t off,
|
|||
* XXX start != off? Need to test this. */
|
||||
|
||||
error = bread(vp, (start + curoff) / DEV_BSIZE,/* no rounding involved*/
|
||||
RBSZ(min(len - curoff + (off - start), MAXBSIZE), secsz), cred, &bp);
|
||||
RBSZ(min(len - curoff + (off - start), MAXBSIZE), secsz),
|
||||
cred, 0, &bp);
|
||||
|
||||
if (error == 0)
|
||||
memcpy((uint8_t*)buf + curoff, (uint8_t*)bp->b_data +
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: msdosfs_denode.c,v 1.32 2008/05/05 17:11:16 ad Exp $ */
|
||||
/* $NetBSD: msdosfs_denode.c,v 1.33 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
|
||||
|
@ -48,7 +48,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: msdosfs_denode.c,v 1.32 2008/05/05 17:11:16 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: msdosfs_denode.c,v 1.33 2008/05/16 09:21:59 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -479,7 +479,7 @@ detrunc(struct denode *dep, u_long length, int flags, kauth_cred_t cred)
|
|||
if (isadir) {
|
||||
bn = cntobn(pmp, eofentry);
|
||||
error = bread(pmp->pm_devvp, de_bn2kb(pmp, bn),
|
||||
pmp->pm_bpcluster, NOCRED, &bp);
|
||||
pmp->pm_bpcluster, NOCRED, B_MODIFY, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
#ifdef MSDOSFS_DEBUG
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: msdosfs_fat.c,v 1.15 2007/10/08 18:04:04 ad Exp $ */
|
||||
/* $NetBSD: msdosfs_fat.c,v 1.16 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
|
||||
|
@ -48,7 +48,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: msdosfs_fat.c,v 1.15 2007/10/08 18:04:04 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: msdosfs_fat.c,v 1.16 2008/05/16 09:21:59 hannken Exp $");
|
||||
|
||||
/*
|
||||
* kernel include files.
|
||||
|
@ -261,7 +261,7 @@ pcbmap(dep, findcn, bnp, cnp, sp)
|
|||
if (bp)
|
||||
brelse(bp, 0);
|
||||
error = bread(pmp->pm_devvp, de_bn2kb(pmp, bn), bsize,
|
||||
NOCRED, &bp);
|
||||
NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return (error);
|
||||
|
@ -401,7 +401,7 @@ updatefats(pmp, bp, fatbn)
|
|||
* padded at the end or in the middle?
|
||||
*/
|
||||
if (bread(pmp->pm_devvp, de_bn2kb(pmp, pmp->pm_fsinfo),
|
||||
pmp->pm_BytesPerSec, NOCRED, &bpn) != 0) {
|
||||
pmp->pm_BytesPerSec, NOCRED, B_MODIFY, &bpn) != 0) {
|
||||
/*
|
||||
* Ignore the error, but turn off FSInfo update for the future.
|
||||
*/
|
||||
|
@ -584,7 +584,7 @@ fatentry(function, pmp, cn, oldcontents, newcontents)
|
|||
byteoffset = FATOFS(pmp, cn);
|
||||
fatblock(pmp, byteoffset, &bn, &bsize, &bo);
|
||||
if ((error = bread(pmp->pm_devvp, de_bn2kb(pmp, bn), bsize, NOCRED,
|
||||
&bp)) != 0) {
|
||||
0, &bp)) != 0) {
|
||||
brelse(bp, 0);
|
||||
return (error);
|
||||
}
|
||||
|
@ -668,7 +668,7 @@ fatchain(pmp, start, count, fillwith)
|
|||
byteoffset = FATOFS(pmp, start);
|
||||
fatblock(pmp, byteoffset, &bn, &bsize, &bo);
|
||||
error = bread(pmp->pm_devvp, de_bn2kb(pmp, bn), bsize, NOCRED,
|
||||
&bp);
|
||||
B_MODIFY, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return (error);
|
||||
|
@ -910,7 +910,7 @@ freeclusterchain(pmp, cluster)
|
|||
if (bp)
|
||||
updatefats(pmp, bp, lbn);
|
||||
error = bread(pmp->pm_devvp, de_bn2kb(pmp, bn), bsize,
|
||||
NOCRED, &bp);
|
||||
NOCRED, B_MODIFY, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return (error);
|
||||
|
@ -985,7 +985,7 @@ fillinusemap(pmp)
|
|||
brelse(bp, 0);
|
||||
fatblock(pmp, byteoffset, &bn, &bsize, NULL);
|
||||
error = bread(pmp->pm_devvp, de_bn2kb(pmp, bn), bsize,
|
||||
NOCRED, &bp);
|
||||
NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return (error);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: msdosfs_lookup.c,v 1.15 2007/11/26 19:01:46 pooka Exp $ */
|
||||
/* $NetBSD: msdosfs_lookup.c,v 1.16 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
|
||||
|
@ -48,7 +48,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: msdosfs_lookup.c,v 1.15 2007/11/26 19:01:46 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: msdosfs_lookup.c,v 1.16 2008/05/16 09:21:59 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -221,7 +221,7 @@ msdosfs_lookup(v)
|
|||
return (error);
|
||||
}
|
||||
error = bread(pmp->pm_devvp, de_bn2kb(pmp, bn), blsize, NOCRED,
|
||||
&bp);
|
||||
0, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return (error);
|
||||
|
@ -629,7 +629,7 @@ createde(dep, ddep, depp, cnp)
|
|||
if (dirclust != MSDOSFSROOT)
|
||||
clusoffset &= pmp->pm_crbomask;
|
||||
if ((error = bread(pmp->pm_devvp, de_bn2kb(pmp, bn), blsize, NOCRED,
|
||||
&bp)) != 0) {
|
||||
B_MODIFY, &bp)) != 0) {
|
||||
brelse(bp, 0);
|
||||
goto err_norollback;
|
||||
}
|
||||
|
@ -667,7 +667,7 @@ createde(dep, ddep, depp, cnp)
|
|||
goto rollback;
|
||||
|
||||
error = bread(pmp->pm_devvp, de_bn2kb(pmp, bn),
|
||||
blsize, NOCRED, &bp);
|
||||
blsize, NOCRED, B_MODIFY, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
goto rollback;
|
||||
|
@ -720,7 +720,7 @@ createde(dep, ddep, depp, cnp)
|
|||
if (rberror)
|
||||
goto err_norollback;
|
||||
if ((rberror = bread(pmp->pm_devvp, de_bn2kb(pmp, bn), blsize, NOCRED,
|
||||
&bp)) != 0) {
|
||||
B_MODIFY, &bp)) != 0) {
|
||||
brelse(bp, 0);
|
||||
goto err_norollback;
|
||||
}
|
||||
|
@ -748,7 +748,7 @@ createde(dep, ddep, depp, cnp)
|
|||
goto err_norollback;
|
||||
|
||||
rberror = bread(pmp->pm_devvp, de_bn2kb(pmp, bn),
|
||||
blsize, NOCRED, &bp);
|
||||
blsize, NOCRED, B_MODIFY, &bp);
|
||||
if (rberror) {
|
||||
brelse(bp, 0);
|
||||
goto err_norollback;
|
||||
|
@ -798,7 +798,7 @@ dosdirempty(dep)
|
|||
return (0);
|
||||
}
|
||||
error = bread(pmp->pm_devvp, de_bn2kb(pmp, bn), blsize, NOCRED,
|
||||
&bp);
|
||||
0, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return (0);
|
||||
|
@ -892,7 +892,7 @@ doscheckpath(source, target)
|
|||
}
|
||||
scn = dep->de_StartCluster;
|
||||
error = bread(pmp->pm_devvp, de_bn2kb(pmp, cntobn(pmp, scn)),
|
||||
pmp->pm_bpcluster, NOCRED, &bp);
|
||||
pmp->pm_bpcluster, NOCRED, 0, &bp);
|
||||
if (error)
|
||||
break;
|
||||
|
||||
|
@ -959,7 +959,7 @@ readep(pmp, dirclust, diroffset, bpp, epp)
|
|||
blsize = de_bn2off(pmp, pmp->pm_rootdirsize) & pmp->pm_crbomask;
|
||||
bn = detobn(pmp, dirclust, diroffset);
|
||||
if ((error = bread(pmp->pm_devvp, de_bn2kb(pmp, bn), blsize, NOCRED,
|
||||
bpp)) != 0) {
|
||||
0, bpp)) != 0) {
|
||||
brelse(*bpp, 0);
|
||||
*bpp = NULL;
|
||||
return (error);
|
||||
|
@ -1019,7 +1019,7 @@ removede(pdep, dep)
|
|||
if (error)
|
||||
return error;
|
||||
error = bread(pmp->pm_devvp, de_bn2kb(pmp, bn), blsize, NOCRED,
|
||||
&bp);
|
||||
B_MODIFY, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return error;
|
||||
|
@ -1096,7 +1096,7 @@ uniqdosname(dep, cnp, cp)
|
|||
return error;
|
||||
}
|
||||
error = bread(pmp->pm_devvp, de_bn2kb(pmp, bn), blsize,
|
||||
NOCRED, &bp);
|
||||
NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return error;
|
||||
|
@ -1148,7 +1148,7 @@ findwin95(dep)
|
|||
if (pcbmap(dep, cn, &bn, 0, &blsize))
|
||||
return 0;
|
||||
if (bread(pmp->pm_devvp, de_bn2kb(pmp, bn), blsize, NOCRED,
|
||||
&bp)) {
|
||||
0, &bp)) {
|
||||
brelse(bp, 0);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: msdosfs_vfsops.c,v 1.66 2008/05/10 02:26:09 rumble Exp $ */
|
||||
/* $NetBSD: msdosfs_vfsops.c,v 1.67 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
|
||||
|
@ -48,7 +48,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.66 2008/05/10 02:26:09 rumble Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.67 2008/05/16 09:21:59 hannken Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_quota.h"
|
||||
|
@ -514,7 +514,7 @@ msdosfs_mountfs(devvp, mp, l, argp)
|
|||
* Read the boot sector of the filesystem, and then check the
|
||||
* boot signature. If not a dos boot sector then error out.
|
||||
*/
|
||||
if ((error = bread(devvp, 0, secsize, NOCRED, &bp)) != 0)
|
||||
if ((error = bread(devvp, 0, secsize, NOCRED, 0, &bp)) != 0)
|
||||
goto error_exit;
|
||||
bsp = (union bootsector *)bp->b_data;
|
||||
b33 = (struct byte_bpb33 *)bsp->bs33.bsBPB;
|
||||
|
@ -745,7 +745,7 @@ msdosfs_mountfs(devvp, mp, l, argp)
|
|||
* padded at the end or in the middle?
|
||||
*/
|
||||
if ((error = bread(devvp, de_bn2kb(pmp, pmp->pm_fsinfo),
|
||||
pmp->pm_BytesPerSec, NOCRED, &bp)) != 0)
|
||||
pmp->pm_BytesPerSec, NOCRED, 0, &bp)) != 0)
|
||||
goto error_exit;
|
||||
fp = (struct fsinfo *)bp->b_data;
|
||||
if (!memcmp(fp->fsisig1, "RRaA", 4)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: msdosfs_vnops.c,v 1.51 2008/04/30 14:07:14 ad Exp $ */
|
||||
/* $NetBSD: msdosfs_vnops.c,v 1.52 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
|
||||
|
@ -48,7 +48,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.51 2008/04/30 14:07:14 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.52 2008/05/16 09:21:59 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -522,7 +522,7 @@ msdosfs_read(v)
|
|||
* vnode for the directory.
|
||||
*/
|
||||
error = bread(pmp->pm_devvp, de_bn2kb(pmp, lbn), blsize,
|
||||
NOCRED, &bp);
|
||||
NOCRED, 0, &bp);
|
||||
n = MIN(n, pmp->pm_bpcluster - bp->b_resid);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
|
@ -1141,7 +1141,7 @@ abortit:
|
|||
} else
|
||||
bn = cntobn(pmp, cn);
|
||||
error = bread(pmp->pm_devvp, de_bn2kb(pmp, bn),
|
||||
pmp->pm_bpcluster, NOCRED, &bp);
|
||||
pmp->pm_bpcluster, NOCRED, B_MODIFY, &bp);
|
||||
if (error) {
|
||||
/* XXX should really panic here, fs is corrupt */
|
||||
brelse(bp, 0);
|
||||
|
@ -1225,6 +1225,7 @@ msdosfs_mkdir(v)
|
|||
int error;
|
||||
int bn;
|
||||
u_long newcluster, pcl;
|
||||
daddr_t lbn;
|
||||
struct direntry *denp;
|
||||
struct msdosfsmount *pmp = pdep->de_pmp;
|
||||
struct buf *bp;
|
||||
|
@ -1259,8 +1260,9 @@ msdosfs_mkdir(v)
|
|||
* directory to be pointing at if there were a crash.
|
||||
*/
|
||||
bn = cntobn(pmp, newcluster);
|
||||
lbn = de_bn2kb(pmp, bn);
|
||||
/* always succeeds */
|
||||
bp = getblk(pmp->pm_devvp, de_bn2kb(pmp, bn), pmp->pm_bpcluster, 0, 0);
|
||||
bp = getblk(pmp->pm_devvp, lbn, pmp->pm_bpcluster, 0, 0);
|
||||
memset(bp->b_data, 0, pmp->pm_bpcluster);
|
||||
memcpy(bp->b_data, &dosdirtemplate, sizeof dosdirtemplate);
|
||||
denp = (struct direntry *)bp->b_data;
|
||||
|
@ -1556,7 +1558,7 @@ msdosfs_readdir(v)
|
|||
if ((error = pcbmap(dep, lbn, &bn, &cn, &blsize)) != 0)
|
||||
break;
|
||||
error = bread(pmp->pm_devvp, de_bn2kb(pmp, bn), blsize,
|
||||
NOCRED, &bp);
|
||||
NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
free(dirbuf, M_MSDOSFSTMP);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ntfs_subr.c,v 1.36 2008/01/29 18:21:10 pooka Exp $ */
|
||||
/* $NetBSD: ntfs_subr.c,v 1.37 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999 Semen Ustimenko (semenu@FreeBSD.org)
|
||||
|
@ -29,7 +29,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ntfs_subr.c,v 1.36 2008/01/29 18:21:10 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ntfs_subr.c,v 1.37 2008/05/16 09:21:59 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -306,7 +306,7 @@ ntfs_loadntnode(
|
|||
|
||||
error = bread(ntmp->ntm_devvp,
|
||||
bn, ntfs_bntob(ntmp->ntm_bpmftrec),
|
||||
NOCRED, &bp);
|
||||
NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
printf("ntfs_loadntnode: BREAD FAILED\n");
|
||||
brelse(bp, 0);
|
||||
|
@ -1516,6 +1516,7 @@ ntfs_writentvattr_plain(
|
|||
int cnt;
|
||||
cn_t ccn, ccl, cn, left, cl;
|
||||
void * data = rdata;
|
||||
daddr_t lbn;
|
||||
struct buf *bp;
|
||||
size_t tocopy;
|
||||
|
||||
|
@ -1572,12 +1573,13 @@ ntfs_writentvattr_plain(
|
|||
(long long) left));
|
||||
if ((off == 0) && (tocopy == ntfs_cntob(cl)))
|
||||
{
|
||||
bp = getblk(ntmp->ntm_devvp, ntfs_cntobn(cn),
|
||||
lbn = ntfs_cntobn(cn);
|
||||
bp = getblk(ntmp->ntm_devvp, lbn,
|
||||
ntfs_cntob(cl), 0, 0);
|
||||
clrbuf(bp);
|
||||
} else {
|
||||
error = bread(ntmp->ntm_devvp, ntfs_cntobn(cn),
|
||||
ntfs_cntob(cl), NOCRED, &bp);
|
||||
ntfs_cntob(cl), NOCRED, B_MODIFY, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return (error);
|
||||
|
@ -1684,7 +1686,7 @@ ntfs_readntvattr_plain(
|
|||
error = bread(ntmp->ntm_devvp,
|
||||
ntfs_cntobn(cn),
|
||||
ntfs_cntob(cl),
|
||||
NOCRED, &bp);
|
||||
NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return (error);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ntfs_vfsops.c,v 1.70 2008/05/10 02:26:09 rumble Exp $ */
|
||||
/* $NetBSD: ntfs_vfsops.c,v 1.71 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999 Semen Ustimenko
|
||||
|
@ -29,7 +29,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.70 2008/05/10 02:26:09 rumble Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.71 2008/05/16 09:21:59 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -350,7 +350,7 @@ ntfs_mountfs(devvp, mp, argsp, l)
|
|||
|
||||
bp = NULL;
|
||||
|
||||
error = bread(devvp, BBLOCK, BBSIZE, NOCRED, &bp);
|
||||
error = bread(devvp, BBLOCK, BBSIZE, NOCRED, 0, &bp);
|
||||
if (error)
|
||||
goto out;
|
||||
ntmp = malloc( sizeof *ntmp, M_NTFSMNT, M_WAITOK );
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bfs_sysvbfs.c,v 1.9 2008/04/28 20:24:02 martin Exp $ */
|
||||
/* $NetBSD: bfs_sysvbfs.c,v 1.10 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2004 The NetBSD Foundation, Inc.
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: bfs_sysvbfs.c,v 1.9 2008/04/28 20:24:02 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: bfs_sysvbfs.c,v 1.10 2008/05/16 09:21:59 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -103,7 +103,7 @@ bc_read(void *self, uint8_t *buf, daddr_t block)
|
|||
struct bc_io_ops *bio = self;
|
||||
struct buf *bp = NULL;
|
||||
|
||||
if (bread(bio->vp, block, DEV_BSIZE, bio->cred, &bp) != 0)
|
||||
if (bread(bio->vp, block, DEV_BSIZE, bio->cred, 0, &bp) != 0)
|
||||
goto error_exit;
|
||||
memcpy(buf, bp->b_data, DEV_BSIZE);
|
||||
brelse(bp, 0);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vfs_bio.c,v 1.197 2008/05/05 17:11:17 ad Exp $ */
|
||||
/* $NetBSD: vfs_bio.c,v 1.198 2008/05/16 09:21:59 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -107,7 +107,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.197 2008/05/05 17:11:17 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.198 2008/05/16 09:21:59 hannken Exp $");
|
||||
|
||||
#include "fs_ffs.h"
|
||||
#include "opt_bufcache.h"
|
||||
|
@ -123,6 +123,7 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.197 2008/05/05 17:11:17 ad Exp $");
|
|||
#include <sys/sysctl.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/kauth.h>
|
||||
#include <sys/fstrans.h>
|
||||
#include <sys/intr.h>
|
||||
#include <sys/cpu.h>
|
||||
|
||||
|
@ -516,10 +517,6 @@ buf_lotsfree(void)
|
|||
{
|
||||
int try, thresh;
|
||||
|
||||
/* Always allocate if doing copy on write */
|
||||
if (curlwp->l_pflag & LP_UFSCOW)
|
||||
return 1;
|
||||
|
||||
/* Always allocate if less than the low water mark. */
|
||||
if (bufmem < bufmem_lowater)
|
||||
return 1;
|
||||
|
@ -705,15 +702,19 @@ bio_doread(struct vnode *vp, daddr_t blkno, int size, kauth_cred_t cred,
|
|||
*/
|
||||
int
|
||||
bread(struct vnode *vp, daddr_t blkno, int size, kauth_cred_t cred,
|
||||
buf_t **bpp)
|
||||
int flags, buf_t **bpp)
|
||||
{
|
||||
buf_t *bp;
|
||||
int error;
|
||||
|
||||
/* Get buffer for block. */
|
||||
bp = *bpp = bio_doread(vp, blkno, size, cred, 0);
|
||||
|
||||
/* Wait for the read to complete, and return result. */
|
||||
return (biowait(bp));
|
||||
error = biowait(bp);
|
||||
if (error == 0 && (flags & B_MODIFY) != 0)
|
||||
error = fscow_run(bp, true);
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -722,10 +723,10 @@ bread(struct vnode *vp, daddr_t blkno, int size, kauth_cred_t cred,
|
|||
*/
|
||||
int
|
||||
breadn(struct vnode *vp, daddr_t blkno, int size, daddr_t *rablks,
|
||||
int *rasizes, int nrablks, kauth_cred_t cred, buf_t **bpp)
|
||||
int *rasizes, int nrablks, kauth_cred_t cred, int flags, buf_t **bpp)
|
||||
{
|
||||
buf_t *bp;
|
||||
int i;
|
||||
int error, i;
|
||||
|
||||
bp = *bpp = bio_doread(vp, blkno, size, cred, 0);
|
||||
|
||||
|
@ -746,7 +747,10 @@ breadn(struct vnode *vp, daddr_t blkno, int size, daddr_t *rablks,
|
|||
mutex_exit(&bufcache_lock);
|
||||
|
||||
/* Otherwise, we had to start a read for it; wait until it's valid. */
|
||||
return (biowait(bp));
|
||||
error = biowait(bp);
|
||||
if (error == 0 && (flags & B_MODIFY) != 0)
|
||||
error = fscow_run(bp, true);
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -756,10 +760,11 @@ breadn(struct vnode *vp, daddr_t blkno, int size, daddr_t *rablks,
|
|||
*/
|
||||
int
|
||||
breada(struct vnode *vp, daddr_t blkno, int size, daddr_t rablkno,
|
||||
int rabsize, kauth_cred_t cred, buf_t **bpp)
|
||||
int rabsize, kauth_cred_t cred, int flags, buf_t **bpp)
|
||||
{
|
||||
|
||||
return (breadn(vp, blkno, size, &rablkno, &rabsize, 1, cred, bpp));
|
||||
return (breadn(vp, blkno, size, &rablkno, &rabsize, 1,
|
||||
cred, flags, bpp));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -878,6 +883,9 @@ void
|
|||
bdwrite(buf_t *bp)
|
||||
{
|
||||
|
||||
KASSERT(bp->b_vp == NULL || bp->b_vp->v_tag != VT_UFS ||
|
||||
ISSET(bp->b_flags, B_COWDONE));
|
||||
|
||||
KASSERT(ISSET(bp->b_cflags, BC_BUSY));
|
||||
|
||||
/* If this is a tape block, write the block now. */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: spec_vnops.c,v 1.118 2008/04/29 18:18:09 ad Exp $ */
|
||||
/* $NetBSD: spec_vnops.c,v 1.119 2008/05/16 09:22:00 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -58,7 +58,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.118 2008/04/29 18:18:09 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.119 2008/05/16 09:22:00 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
|
@ -524,7 +524,7 @@ spec_read(void *v)
|
|||
bn = (uio->uio_offset >> DEV_BSHIFT) &~ (bscale - 1);
|
||||
on = uio->uio_offset % bsize;
|
||||
n = min((unsigned)(bsize - on), uio->uio_resid);
|
||||
error = bread(vp, bn, bsize, NOCRED, &bp);
|
||||
error = bread(vp, bn, bsize, NOCRED, 0, &bp);
|
||||
n = min(n, bsize - bp->b_resid);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
|
@ -601,7 +601,8 @@ spec_write(void *v)
|
|||
if (n == bsize)
|
||||
bp = getblk(vp, bn, bsize, 0, 0);
|
||||
else
|
||||
error = bread(vp, bn, bsize, NOCRED, &bp);
|
||||
error = bread(vp, bn, bsize, NOCRED,
|
||||
B_MODIFY, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return (error);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: buf.h,v 1.107 2008/04/28 20:24:10 martin Exp $ */
|
||||
/* $NetBSD: buf.h,v 1.108 2008/05/16 09:22:00 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2007 The NetBSD Foundation, Inc.
|
||||
|
@ -244,6 +244,9 @@ do { \
|
|||
#define B_SYNC 0x02 /* Do all allocations synchronously. */
|
||||
#define B_METAONLY 0x04 /* Return indirect block buffer. */
|
||||
|
||||
/* Flags to bread(), breadn() and breada(). */
|
||||
#define B_MODIFY 0x01 /* Hint: caller might modify buffer */
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
#define BIO_GETPRIO(bp) ((bp)->b_prio)
|
||||
|
@ -285,11 +288,11 @@ void bdirty(buf_t *);
|
|||
void bdwrite(buf_t *);
|
||||
void biodone(buf_t *);
|
||||
int biowait(buf_t *);
|
||||
int bread(struct vnode *, daddr_t, int, struct kauth_cred *, buf_t **);
|
||||
int bread(struct vnode *, daddr_t, int, struct kauth_cred *, int, buf_t **);
|
||||
int breada(struct vnode *, daddr_t, int, daddr_t, int, struct kauth_cred *,
|
||||
buf_t **);
|
||||
int, buf_t **);
|
||||
int breadn(struct vnode *, daddr_t, int, daddr_t *, int *, int,
|
||||
struct kauth_cred *, buf_t **);
|
||||
struct kauth_cred *, int, buf_t **);
|
||||
void brelsel(buf_t *, int);
|
||||
void brelse(buf_t *, int);
|
||||
void bremfree(buf_t *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lwp.h,v 1.94 2008/05/06 18:40:57 ad Exp $ */
|
||||
/* $NetBSD: lwp.h,v 1.95 2008/05/16 09:22:00 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -214,7 +214,6 @@ extern lwp_t lwp0; /* LWP for proc0 */
|
|||
#define LP_KTRACTIVE 0x00000001 /* Executing ktrace operation */
|
||||
#define LP_KTRCSW 0x00000002 /* ktrace context switch marker */
|
||||
#define LP_KTRCSWUSER 0x00000004 /* ktrace context switch marker */
|
||||
#define LP_UFSCOW 0x00000008 /* UFS: doing copy on write */
|
||||
#define LP_OWEUPC 0x00000010 /* Owe user profiling tick */
|
||||
#define LP_MPSAFE 0x00000020 /* Starts life without kernel_lock */
|
||||
#define LP_INTR 0x00000040 /* Soft interrupt handler */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: param.h,v 1.317 2008/04/28 22:44:18 ad Exp $ */
|
||||
/* $NetBSD: param.h,v 1.318 2008/05/16 09:22:00 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
|
@ -63,7 +63,7 @@
|
|||
* 2.99.9 (299000900)
|
||||
*/
|
||||
|
||||
#define __NetBSD_Version__ 499006200 /* NetBSD 4.99.62 */
|
||||
#define __NetBSD_Version__ 499006300 /* NetBSD 4.99.63 */
|
||||
|
||||
#define __NetBSD_Prereq__(M,m,p) (((((M) * 100000000) + \
|
||||
(m) * 1000000) + (p) * 100) <= __NetBSD_Version__)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ext2fs_alloc.c,v 1.35 2007/10/08 18:01:27 ad Exp $ */
|
||||
/* $NetBSD: ext2fs_alloc.c,v 1.36 2008/05/16 09:22:00 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
|
@ -65,7 +65,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_alloc.c,v 1.35 2007/10/08 18:01:27 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_alloc.c,v 1.36 2008/05/16 09:22:00 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -362,7 +362,7 @@ ext2fs_alloccg(struct inode *ip, int cg, daddr_t bpref, int size)
|
|||
return (0);
|
||||
error = bread(ip->i_devvp, fsbtodb(fs,
|
||||
fs->e2fs_gd[cg].ext2bgd_b_bitmap),
|
||||
(int)fs->e2fs_bsize, NOCRED, &bp);
|
||||
(int)fs->e2fs_bsize, NOCRED, B_MODIFY, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return (0);
|
||||
|
@ -449,7 +449,7 @@ ext2fs_nodealloccg(struct inode *ip, int cg, daddr_t ipref, int mode)
|
|||
return (0);
|
||||
error = bread(ip->i_devvp, fsbtodb(fs,
|
||||
fs->e2fs_gd[cg].ext2bgd_i_bitmap),
|
||||
(int)fs->e2fs_bsize, NOCRED, &bp);
|
||||
(int)fs->e2fs_bsize, NOCRED, B_MODIFY, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return (0);
|
||||
|
@ -521,7 +521,7 @@ ext2fs_blkfree(struct inode *ip, daddr_t bno)
|
|||
}
|
||||
error = bread(ip->i_devvp,
|
||||
fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_b_bitmap),
|
||||
(int)fs->e2fs_bsize, NOCRED, &bp);
|
||||
(int)fs->e2fs_bsize, NOCRED, B_MODIFY, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return;
|
||||
|
@ -563,7 +563,7 @@ ext2fs_vfree(struct vnode *pvp, ino_t ino, int mode)
|
|||
cg = ino_to_cg(fs, ino);
|
||||
error = bread(pip->i_devvp,
|
||||
fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_i_bitmap),
|
||||
(int)fs->e2fs_bsize, NOCRED, &bp);
|
||||
(int)fs->e2fs_bsize, NOCRED, B_MODIFY, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return (0);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ext2fs_balloc.c,v 1.32 2007/10/08 18:01:27 ad Exp $ */
|
||||
/* $NetBSD: ext2fs_balloc.c,v 1.33 2008/05/16 09:22:00 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
|
@ -65,7 +65,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_balloc.c,v 1.32 2007/10/08 18:01:27 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_balloc.c,v 1.33 2008/05/16 09:22:00 hannken Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_uvmhist.h"
|
||||
|
@ -135,7 +135,7 @@ ext2fs_balloc(struct inode *ip, daddr_t bn, int size,
|
|||
|
||||
if (bpp != NULL) {
|
||||
error = bread(vp, bn, fs->e2fs_bsize, NOCRED,
|
||||
&bp);
|
||||
B_MODIFY, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return (error);
|
||||
|
@ -214,7 +214,7 @@ ext2fs_balloc(struct inode *ip, daddr_t bn, int size,
|
|||
*/
|
||||
for (i = 1;;) {
|
||||
error = bread(vp,
|
||||
indirs[i].in_lbn, (int)fs->e2fs_bsize, NOCRED, &bp);
|
||||
indirs[i].in_lbn, (int)fs->e2fs_bsize, NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
goto fail;
|
||||
|
@ -300,7 +300,7 @@ ext2fs_balloc(struct inode *ip, daddr_t bn, int size,
|
|||
if (bpp != NULL) {
|
||||
if (flags & B_CLRBUF) {
|
||||
error = bread(vp, lbn, (int)fs->e2fs_bsize, NOCRED,
|
||||
&nbp);
|
||||
B_MODIFY, &nbp);
|
||||
if (error) {
|
||||
brelse(nbp, 0);
|
||||
goto fail;
|
||||
|
@ -328,7 +328,7 @@ fail:
|
|||
int r;
|
||||
|
||||
r = bread(vp, indirs[unwindidx].in_lbn,
|
||||
(int)fs->e2fs_bsize, NOCRED, &bp);
|
||||
(int)fs->e2fs_bsize, NOCRED, B_MODIFY, &bp);
|
||||
if (r) {
|
||||
panic("Could not unwind indirect block, error %d", r);
|
||||
brelse(bp, 0);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ext2fs_inode.c,v 1.65 2008/03/27 19:06:52 ad Exp $ */
|
||||
/* $NetBSD: ext2fs_inode.c,v 1.66 2008/05/16 09:22:00 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
|
@ -65,7 +65,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_inode.c,v 1.65 2008/03/27 19:06:52 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_inode.c,v 1.66 2008/05/16 09:22:00 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -214,7 +214,7 @@ ext2fs_update(struct vnode *vp, const struct timespec *acc,
|
|||
|
||||
error = bread(ip->i_devvp,
|
||||
fsbtodb(fs, ino_to_fsba(fs, ip->i_number)),
|
||||
(int)fs->e2fs_bsize, NOCRED, &bp);
|
||||
(int)fs->e2fs_bsize, NOCRED, B_MODIFY, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return (error);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ext2fs_readwrite.c,v 1.51 2008/04/24 15:35:31 ad Exp $ */
|
||||
/* $NetBSD: ext2fs_readwrite.c,v 1.52 2008/05/16 09:22:00 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
|
@ -65,7 +65,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_readwrite.c,v 1.51 2008/04/24 15:35:31 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_readwrite.c,v 1.52 2008/05/16 09:22:00 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -177,11 +177,11 @@ ext2fs_read(void *v)
|
|||
xfersize = bytesinfile;
|
||||
|
||||
if (lblktosize(fs, nextlbn) >= ext2fs_size(ip))
|
||||
error = bread(vp, lbn, size, NOCRED, &bp);
|
||||
error = bread(vp, lbn, size, NOCRED, 0, &bp);
|
||||
else {
|
||||
int nextsize = fs->e2fs_bsize;
|
||||
error = breadn(vp, lbn,
|
||||
size, &nextlbn, &nextsize, 1, NOCRED, &bp);
|
||||
size, &nextlbn, &nextsize, 1, NOCRED, 0, &bp);
|
||||
}
|
||||
if (error)
|
||||
break;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ext2fs_subr.c,v 1.25 2007/10/08 18:01:28 ad Exp $ */
|
||||
/* $NetBSD: ext2fs_subr.c,v 1.26 2008/05/16 09:22:00 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
|
@ -65,7 +65,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_subr.c,v 1.25 2007/10/08 18:01:28 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_subr.c,v 1.26 2008/05/16 09:22:00 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -97,7 +97,7 @@ ext2fs_blkatoff(struct vnode *vp, off_t offset, char **res, struct buf **bpp)
|
|||
lbn = lblkno(fs, offset);
|
||||
|
||||
*bpp = NULL;
|
||||
if ((error = bread(vp, lbn, fs->e2fs_bsize, NOCRED, &bp)) != 0) {
|
||||
if ((error = bread(vp, lbn, fs->e2fs_bsize, NOCRED, 0, &bp)) != 0) {
|
||||
brelse(bp, 0);
|
||||
return (error);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ext2fs_vfsops.c,v 1.135 2008/05/10 02:26:10 rumble Exp $ */
|
||||
/* $NetBSD: ext2fs_vfsops.c,v 1.136 2008/05/16 09:22:00 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1991, 1993, 1994
|
||||
|
@ -65,7 +65,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.135 2008/05/10 02:26:10 rumble Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.136 2008/05/16 09:22:00 hannken Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_compat_netbsd.h"
|
||||
|
@ -500,7 +500,7 @@ ext2fs_reload(struct mount *mountp, kauth_cred_t cred)
|
|||
size = DEV_BSIZE;
|
||||
else
|
||||
size = dpart.disklab->d_secsize;
|
||||
error = bread(devvp, (daddr_t)(SBOFF / size), SBSIZE, NOCRED, &bp);
|
||||
error = bread(devvp, (daddr_t)(SBOFF / size), SBSIZE, NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return (error);
|
||||
|
@ -539,7 +539,7 @@ ext2fs_reload(struct mount *mountp, kauth_cred_t cred)
|
|||
error = bread(devvp ,
|
||||
fsbtodb(fs, fs->e2fs.e2fs_first_dblock +
|
||||
1 /* superblock */ + i),
|
||||
fs->e2fs_bsize, NOCRED, &bp);
|
||||
fs->e2fs_bsize, NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return (error);
|
||||
|
@ -588,7 +588,7 @@ loop:
|
|||
*/
|
||||
ip = VTOI(vp);
|
||||
error = bread(devvp, fsbtodb(fs, ino_to_fsba(fs, ip->i_number)),
|
||||
(int)fs->e2fs_bsize, NOCRED, &bp);
|
||||
(int)fs->e2fs_bsize, NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
mutex_enter(&mntvnode_lock);
|
||||
|
@ -648,7 +648,7 @@ ext2fs_mountfs(struct vnode *devvp, struct mount *mp)
|
|||
printf("sb size: %d ino size %d\n", sizeof(struct ext2fs),
|
||||
EXT2_DINODE_SIZE);
|
||||
#endif
|
||||
error = bread(devvp, (SBOFF / size), SBSIZE, cred, &bp);
|
||||
error = bread(devvp, (SBOFF / size), SBSIZE, cred, 0, &bp);
|
||||
if (error)
|
||||
goto out;
|
||||
fs = (struct ext2fs *)bp->b_data;
|
||||
|
@ -695,7 +695,7 @@ ext2fs_mountfs(struct vnode *devvp, struct mount *mp)
|
|||
error = bread(devvp ,
|
||||
fsbtodb(m_fs, m_fs->e2fs.e2fs_first_dblock +
|
||||
1 /* superblock */ + i),
|
||||
m_fs->e2fs_bsize, NOCRED, &bp);
|
||||
m_fs->e2fs_bsize, NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
free(m_fs->e2fs_gd, M_UFSMNT);
|
||||
goto out;
|
||||
|
@ -1012,7 +1012,7 @@ retry:
|
|||
|
||||
/* Read in the disk contents for the inode, copy into the inode. */
|
||||
error = bread(ump->um_devvp, fsbtodb(fs, ino_to_fsba(fs, ino)),
|
||||
(int)fs->e2fs_bsize, NOCRED, &bp);
|
||||
(int)fs->e2fs_bsize, NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ffs_alloc.c,v 1.106 2008/01/21 23:36:26 pooka Exp $ */
|
||||
/* $NetBSD: ffs_alloc.c,v 1.107 2008/05/16 09:22:00 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Networks Associates Technology, Inc.
|
||||
|
@ -41,7 +41,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.106 2008/01/21 23:36:26 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.107 2008/05/16 09:22:00 hannken Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
|
@ -57,6 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.106 2008/01/21 23:36:26 pooka Exp $"
|
|||
#include <sys/kernel.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/kauth.h>
|
||||
#include <sys/fstrans.h>
|
||||
|
||||
#include <miscfs/specfs/specdev.h>
|
||||
#include <ufs/ufs/quota.h>
|
||||
|
@ -276,7 +277,7 @@ ffs_realloccg(struct inode *ip, daddr_t lbprev, daddr_t bpref, int osize,
|
|||
* Allocate the extra space in the buffer.
|
||||
*/
|
||||
if (bpp != NULL &&
|
||||
(error = bread(ITOV(ip), lbprev, osize, NOCRED, &bp)) != 0) {
|
||||
(error = bread(ITOV(ip), lbprev, osize, NOCRED, 0, &bp)) != 0) {
|
||||
brelse(bp, 0);
|
||||
return (error);
|
||||
}
|
||||
|
@ -512,7 +513,8 @@ ffs_reallocblks(void *v)
|
|||
soff = start_lbn;
|
||||
} else {
|
||||
idp = &start_ap[start_lvl - 1];
|
||||
if (bread(vp, idp->in_lbn, (int)fs->fs_bsize, NOCRED, &sbp)) {
|
||||
if (bread(vp, idp->in_lbn, (int)fs->fs_bsize,
|
||||
NOCRED, B_MODIFY, &sbp)) {
|
||||
brelse(sbp, 0);
|
||||
return (ENOSPC);
|
||||
}
|
||||
|
@ -535,7 +537,8 @@ ffs_reallocblks(void *v)
|
|||
panic("ffs_reallocblk: start == end");
|
||||
#endif
|
||||
ssize = len - (idp->in_off + 1);
|
||||
if (bread(vp, idp->in_lbn, (int)fs->fs_bsize, NOCRED, &ebp))
|
||||
if (bread(vp, idp->in_lbn, (int)fs->fs_bsize,
|
||||
NOCRED, B_MODIFY, &ebp))
|
||||
goto fail;
|
||||
ebap = (int32_t *)ebp->b_data; /* XXX ondisk32 */
|
||||
}
|
||||
|
@ -742,7 +745,7 @@ ffs_valloc(struct vnode *pvp, int mode, kauth_cred_t cred,
|
|||
(unsigned long long)ipref);
|
||||
#if 0
|
||||
error = bread(ump->um_devvp, fsbtodb(fs, ino_to_fsba(fs, ino)),
|
||||
(int)fs->fs_bsize, NOCRED, &bp);
|
||||
(int)fs->fs_bsize, NOCRED, 0, &bp);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -1097,7 +1100,7 @@ ffs_fragextend(struct inode *ip, int cg, daddr_t bprev, int osize, int nsize)
|
|||
}
|
||||
mutex_exit(&ump->um_lock);
|
||||
error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
|
||||
(int)fs->fs_cgsize, NOCRED, &bp);
|
||||
(int)fs->fs_cgsize, NOCRED, B_MODIFY, &bp);
|
||||
if (error)
|
||||
goto fail;
|
||||
cgp = (struct cg *)bp->b_data;
|
||||
|
@ -1174,7 +1177,7 @@ ffs_alloccg(struct inode *ip, int cg, daddr_t bpref, int size)
|
|||
return (0);
|
||||
mutex_exit(&ump->um_lock);
|
||||
error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
|
||||
(int)fs->fs_cgsize, NOCRED, &bp);
|
||||
(int)fs->fs_cgsize, NOCRED, B_MODIFY, &bp);
|
||||
if (error)
|
||||
goto fail;
|
||||
cgp = (struct cg *)bp->b_data;
|
||||
|
@ -1367,7 +1370,7 @@ ffs_clusteralloc(struct inode *ip, int cg, daddr_t bpref, int len)
|
|||
return (0);
|
||||
mutex_exit(&ump->um_lock);
|
||||
if (bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)), (int)fs->fs_cgsize,
|
||||
NOCRED, &bp))
|
||||
NOCRED, 0, &bp))
|
||||
goto fail;
|
||||
cgp = (struct cg *)bp->b_data;
|
||||
if (!cg_chkmagic(cgp, UFS_FSNEEDSWAP(fs)))
|
||||
|
@ -1492,7 +1495,7 @@ ffs_nodealloccg(struct inode *ip, int cg, daddr_t ipref, int mode)
|
|||
return (0);
|
||||
mutex_exit(&ump->um_lock);
|
||||
error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
|
||||
(int)fs->fs_cgsize, NOCRED, &bp);
|
||||
(int)fs->fs_cgsize, NOCRED, B_MODIFY, &bp);
|
||||
if (error)
|
||||
goto fail;
|
||||
cgp = (struct cg *)bp->b_data;
|
||||
|
@ -1637,7 +1640,8 @@ ffs_blkfree(struct fs *fs, struct vnode *devvp, daddr_t bno, long size,
|
|||
ffs_fserr(fs, inum, "bad block");
|
||||
return;
|
||||
}
|
||||
error = bread(devvp, cgblkno, (int)fs->fs_cgsize, NOCRED, &bp);
|
||||
error = bread(devvp, cgblkno, (int)fs->fs_cgsize,
|
||||
NOCRED, B_MODIFY, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return;
|
||||
|
@ -1765,7 +1769,7 @@ ffs_checkblk(struct inode *ip, daddr_t bno, long size)
|
|||
if (bno >= fs->fs_size)
|
||||
panic("checkblk: bad block %d", bno);
|
||||
error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, dtog(fs, bno))),
|
||||
(int)fs->fs_cgsize, NOCRED, &bp);
|
||||
(int)fs->fs_cgsize, NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return 0;
|
||||
|
@ -1839,7 +1843,8 @@ ffs_freefile(struct fs *fs, struct vnode *devvp, ino_t ino, int mode)
|
|||
if ((u_int)ino >= fs->fs_ipg * fs->fs_ncg)
|
||||
panic("ifree: range: dev = 0x%x, ino = %llu, fs = %s",
|
||||
dev, (unsigned long long)ino, fs->fs_fsmnt);
|
||||
error = bread(devvp, cgbno, (int)fs->fs_cgsize, NOCRED, &bp);
|
||||
error = bread(devvp, cgbno, (int)fs->fs_cgsize,
|
||||
NOCRED, B_MODIFY, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return (error);
|
||||
|
@ -1901,7 +1906,7 @@ ffs_checkfreefile(struct fs *fs, struct vnode *devvp, ino_t ino)
|
|||
cgbno = fsbtodb(fs, cgtod(fs, cg));
|
||||
if ((u_int)ino >= fs->fs_ipg * fs->fs_ncg)
|
||||
return 1;
|
||||
if (bread(devvp, cgbno, (int)fs->fs_cgsize, NOCRED, &bp)) {
|
||||
if (bread(devvp, cgbno, (int)fs->fs_cgsize, NOCRED, 0, &bp)) {
|
||||
brelse(bp, 0);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ffs_balloc.c,v 1.48 2008/01/02 11:49:09 ad Exp $ */
|
||||
/* $NetBSD: ffs_balloc.c,v 1.49 2008/05/16 09:22:00 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Networks Associates Technology, Inc.
|
||||
|
@ -41,7 +41,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_balloc.c,v 1.48 2008/01/02 11:49:09 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_balloc.c,v 1.49 2008/05/16 09:22:00 hannken Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_quota.h"
|
||||
|
@ -54,6 +54,7 @@ __KERNEL_RCSID(0, "$NetBSD: ffs_balloc.c,v 1.48 2008/01/02 11:49:09 ad Exp $");
|
|||
#include <sys/mount.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/kauth.h>
|
||||
#include <sys/fstrans.h>
|
||||
|
||||
#include <ufs/ufs/quota.h>
|
||||
#include <ufs/ufs/ufsmount.h>
|
||||
|
@ -66,6 +67,7 @@ __KERNEL_RCSID(0, "$NetBSD: ffs_balloc.c,v 1.48 2008/01/02 11:49:09 ad Exp $");
|
|||
|
||||
#include <uvm/uvm.h>
|
||||
|
||||
static int ffs_getblk(struct vnode *, daddr_t, daddr_t, int, bool, buf_t **);
|
||||
static int ffs_balloc_ufs1(struct vnode *, off_t, int, kauth_cred_t, int,
|
||||
struct buf **);
|
||||
static int ffs_balloc_ufs2(struct vnode *, off_t, int, kauth_cred_t, int,
|
||||
|
@ -81,11 +83,33 @@ int
|
|||
ffs_balloc(struct vnode *vp, off_t off, int size, kauth_cred_t cred, int flags,
|
||||
struct buf **bpp)
|
||||
{
|
||||
int error;
|
||||
|
||||
if (VTOI(vp)->i_fs->fs_magic == FS_UFS2_MAGIC)
|
||||
return ffs_balloc_ufs2(vp, off, size, cred, flags, bpp);
|
||||
error = ffs_balloc_ufs2(vp, off, size, cred, flags, bpp);
|
||||
else
|
||||
return ffs_balloc_ufs1(vp, off, size, cred, flags, bpp);
|
||||
error = ffs_balloc_ufs1(vp, off, size, cred, flags, bpp);
|
||||
|
||||
if (error == 0 && bpp != NULL && (error = fscow_run(*bpp, false)) != 0)
|
||||
brelse(*bpp, 0);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static int
|
||||
ffs_getblk(struct vnode *vp, daddr_t lblkno, daddr_t blkno, int size,
|
||||
bool clearbuf, buf_t **bpp)
|
||||
{
|
||||
int error;
|
||||
|
||||
if ((*bpp = getblk(vp, lblkno, size, 0, 0)) == NULL)
|
||||
return ENOMEM;
|
||||
(*bpp)->b_blkno = blkno;
|
||||
if (clearbuf)
|
||||
clrbuf(*bpp);
|
||||
if ((error = fscow_run(*bpp, false)) != 0)
|
||||
brelse(*bpp, BC_INVAL);
|
||||
return error;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -174,7 +198,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
|
||||
if (bpp != NULL) {
|
||||
error = bread(vp, lbn, fs->fs_bsize, NOCRED,
|
||||
bpp);
|
||||
B_MODIFY, bpp);
|
||||
if (error) {
|
||||
brelse(*bpp, 0);
|
||||
return (error);
|
||||
|
@ -200,7 +224,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
|
||||
if (bpp != NULL) {
|
||||
error = bread(vp, lbn, osize, NOCRED,
|
||||
bpp);
|
||||
B_MODIFY, bpp);
|
||||
if (error) {
|
||||
brelse(*bpp, 0);
|
||||
return (error);
|
||||
|
@ -244,11 +268,10 @@ ffs_balloc_ufs1(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
if (error)
|
||||
return (error);
|
||||
if (bpp != NULL) {
|
||||
bp = getblk(vp, lbn, nsize, 0, 0);
|
||||
bp->b_blkno = fsbtodb(fs, newb);
|
||||
if (flags & B_CLRBUF)
|
||||
clrbuf(bp);
|
||||
*bpp = bp;
|
||||
error = ffs_getblk(vp, lbn, fsbtodb(fs, newb),
|
||||
nsize, (flags & B_CLRBUF) != 0, bpp);
|
||||
if (error)
|
||||
return error;
|
||||
}
|
||||
if (DOINGSOFTDEP(vp)) {
|
||||
softdep_setup_allocdirect(ip, lbn, newb, 0,
|
||||
|
@ -285,9 +308,10 @@ ffs_balloc_ufs1(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
goto fail;
|
||||
nb = newb;
|
||||
*allocblk++ = nb;
|
||||
bp = getblk(vp, indirs[1].in_lbn, fs->fs_bsize, 0, 0);
|
||||
bp->b_blkno = fsbtodb(fs, nb);
|
||||
clrbuf(bp);
|
||||
error = ffs_getblk(vp, indirs[1].in_lbn, fsbtodb(fs, nb),
|
||||
fs->fs_bsize, true, &bp);
|
||||
if (error)
|
||||
goto fail;
|
||||
if (DOINGSOFTDEP(vp)) {
|
||||
softdep_setup_allocdirect(ip, NDADDR + indirs[0].in_off,
|
||||
newb, 0, fs->fs_bsize, 0, bp);
|
||||
|
@ -314,7 +338,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
|
||||
for (i = 1;;) {
|
||||
error = bread(vp,
|
||||
indirs[i].in_lbn, (int)fs->fs_bsize, NOCRED, &bp);
|
||||
indirs[i].in_lbn, (int)fs->fs_bsize, NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
goto fail;
|
||||
|
@ -328,6 +352,10 @@ ffs_balloc_ufs1(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
brelse(bp, 0);
|
||||
continue;
|
||||
}
|
||||
if (fscow_run(bp, true) != 0) {
|
||||
brelse(bp, 0);
|
||||
goto fail;
|
||||
}
|
||||
mutex_enter(&ump->um_lock);
|
||||
if (pref == 0)
|
||||
pref = ffs_blkpref_ufs1(ip, lbn, 0, (int32_t *)0);
|
||||
|
@ -339,9 +367,12 @@ ffs_balloc_ufs1(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
}
|
||||
nb = newb;
|
||||
*allocblk++ = nb;
|
||||
nbp = getblk(vp, indirs[i].in_lbn, fs->fs_bsize, 0, 0);
|
||||
nbp->b_blkno = fsbtodb(fs, nb);
|
||||
clrbuf(nbp);
|
||||
error = ffs_getblk(vp, indirs[i].in_lbn, fsbtodb(fs, nb),
|
||||
fs->fs_bsize, true, &nbp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
goto fail;
|
||||
}
|
||||
if (DOINGSOFTDEP(vp)) {
|
||||
softdep_setup_allocindir_meta(nbp, ip, bp,
|
||||
indirs[i - 1].in_off, nb);
|
||||
|
@ -385,6 +416,10 @@ ffs_balloc_ufs1(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
*/
|
||||
|
||||
if (nb == 0) {
|
||||
if (fscow_run(bp, true) != 0) {
|
||||
brelse(bp, 0);
|
||||
goto fail;
|
||||
}
|
||||
mutex_enter(&ump->um_lock);
|
||||
pref = ffs_blkpref_ufs1(ip, lbn, indirs[num].in_off, &bap[0]);
|
||||
error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, cred,
|
||||
|
@ -396,11 +431,12 @@ ffs_balloc_ufs1(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
nb = newb;
|
||||
*allocblk++ = nb;
|
||||
if (bpp != NULL) {
|
||||
nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0);
|
||||
nbp->b_blkno = fsbtodb(fs, nb);
|
||||
if (flags & B_CLRBUF)
|
||||
clrbuf(nbp);
|
||||
*bpp = nbp;
|
||||
error = ffs_getblk(vp, lbn, fsbtodb(fs, nb),
|
||||
fs->fs_bsize, (flags & B_CLRBUF) != 0, bpp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
if (DOINGSOFTDEP(vp))
|
||||
softdep_setup_allocindir_page(ip, lbn, bp,
|
||||
|
@ -425,15 +461,17 @@ ffs_balloc_ufs1(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
brelse(bp, 0);
|
||||
if (bpp != NULL) {
|
||||
if (flags & B_CLRBUF) {
|
||||
error = bread(vp, lbn, (int)fs->fs_bsize, NOCRED, &nbp);
|
||||
error = bread(vp, lbn, (int)fs->fs_bsize,
|
||||
NOCRED, B_MODIFY, &nbp);
|
||||
if (error) {
|
||||
brelse(nbp, 0);
|
||||
goto fail;
|
||||
}
|
||||
} else {
|
||||
nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0);
|
||||
nbp->b_blkno = fsbtodb(fs, nb);
|
||||
clrbuf(nbp);
|
||||
error = ffs_getblk(vp, lbn, fsbtodb(fs, nb),
|
||||
fs->fs_bsize, true, &nbp);
|
||||
if (error)
|
||||
goto fail;
|
||||
}
|
||||
*bpp = nbp;
|
||||
}
|
||||
|
@ -501,7 +539,7 @@ fail:
|
|||
int r;
|
||||
|
||||
r = bread(vp, indirs[unwindidx].in_lbn,
|
||||
(int)fs->fs_bsize, NOCRED, &bp);
|
||||
(int)fs->fs_bsize, NOCRED, 0, &bp);
|
||||
if (r) {
|
||||
panic("Could not unwind indirect block, error %d", r);
|
||||
brelse(bp, 0);
|
||||
|
@ -622,7 +660,8 @@ ffs_balloc_ufs2(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
panic("ffs_balloc_ufs2: BA_METAONLY for ext block");
|
||||
nb = dp->di_extb[lbn];
|
||||
if (nb != 0 && dp->di_extsize >= smalllblktosize(fs, lbn + 1)) {
|
||||
error = bread(vp, -1 - lbn, fs->fs_bsize, NOCRED, &bp);
|
||||
error = bread(vp, -1 - lbn, fs->fs_bsize,
|
||||
NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return (error);
|
||||
|
@ -641,7 +680,8 @@ ffs_balloc_ufs2(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
osize = fragroundup(fs, blkoff(fs, dp->di_extsize));
|
||||
nsize = fragroundup(fs, size);
|
||||
if (nsize <= osize) {
|
||||
error = bread(vp, -1 - lbn, osize, NOCRED, &bp);
|
||||
error = bread(vp, -1 - lbn, osize,
|
||||
NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return (error);
|
||||
|
@ -743,7 +783,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
|
||||
if (bpp != NULL) {
|
||||
error = bread(vp, lbn, fs->fs_bsize, NOCRED,
|
||||
bpp);
|
||||
B_MODIFY, bpp);
|
||||
if (error) {
|
||||
brelse(*bpp, 0);
|
||||
return (error);
|
||||
|
@ -769,7 +809,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
|
||||
if (bpp != NULL) {
|
||||
error = bread(vp, lbn, osize, NOCRED,
|
||||
bpp);
|
||||
B_MODIFY, bpp);
|
||||
if (error) {
|
||||
brelse(*bpp, 0);
|
||||
return (error);
|
||||
|
@ -812,11 +852,10 @@ ffs_balloc_ufs2(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
if (error)
|
||||
return (error);
|
||||
if (bpp != NULL) {
|
||||
bp = getblk(vp, lbn, nsize, 0, 0);
|
||||
bp->b_blkno = fsbtodb(fs, newb);
|
||||
if (flags & B_CLRBUF)
|
||||
clrbuf(bp);
|
||||
*bpp = bp;
|
||||
error = ffs_getblk(vp, lbn, fsbtodb(fs, newb),
|
||||
nsize, (flags & B_CLRBUF) != 0, bpp);
|
||||
if (error)
|
||||
return error;
|
||||
}
|
||||
if (DOINGSOFTDEP(vp)) {
|
||||
softdep_setup_allocdirect(ip, lbn, newb, 0,
|
||||
|
@ -853,9 +892,10 @@ ffs_balloc_ufs2(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
goto fail;
|
||||
nb = newb;
|
||||
*allocblk++ = nb;
|
||||
bp = getblk(vp, indirs[1].in_lbn, fs->fs_bsize, 0, 0);
|
||||
bp->b_blkno = fsbtodb(fs, nb);
|
||||
clrbuf(bp);
|
||||
error = ffs_getblk(vp, indirs[1].in_lbn, fsbtodb(fs, nb),
|
||||
fs->fs_bsize, true, &bp);
|
||||
if (error)
|
||||
goto fail;
|
||||
if (DOINGSOFTDEP(vp)) {
|
||||
softdep_setup_allocdirect(ip, NDADDR + indirs[0].in_off,
|
||||
newb, 0, fs->fs_bsize, 0, bp);
|
||||
|
@ -882,7 +922,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
|
||||
for (i = 1;;) {
|
||||
error = bread(vp,
|
||||
indirs[i].in_lbn, (int)fs->fs_bsize, NOCRED, &bp);
|
||||
indirs[i].in_lbn, (int)fs->fs_bsize, NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
goto fail;
|
||||
|
@ -896,6 +936,10 @@ ffs_balloc_ufs2(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
brelse(bp, 0);
|
||||
continue;
|
||||
}
|
||||
if (fscow_run(bp, true) != 0) {
|
||||
brelse(bp, 0);
|
||||
goto fail;
|
||||
}
|
||||
mutex_enter(&ump->um_lock);
|
||||
if (pref == 0)
|
||||
pref = ffs_blkpref_ufs2(ip, lbn, 0, (int64_t *)0);
|
||||
|
@ -907,9 +951,12 @@ ffs_balloc_ufs2(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
}
|
||||
nb = newb;
|
||||
*allocblk++ = nb;
|
||||
nbp = getblk(vp, indirs[i].in_lbn, fs->fs_bsize, 0, 0);
|
||||
nbp->b_blkno = fsbtodb(fs, nb);
|
||||
clrbuf(nbp);
|
||||
error = ffs_getblk(vp, indirs[i].in_lbn, fsbtodb(fs, nb),
|
||||
fs->fs_bsize, true, &nbp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
goto fail;
|
||||
}
|
||||
if (DOINGSOFTDEP(vp)) {
|
||||
softdep_setup_allocindir_meta(nbp, ip, bp,
|
||||
indirs[i - 1].in_off, nb);
|
||||
|
@ -953,6 +1000,10 @@ ffs_balloc_ufs2(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
*/
|
||||
|
||||
if (nb == 0) {
|
||||
if (fscow_run(bp, true) != 0) {
|
||||
brelse(bp, 0);
|
||||
goto fail;
|
||||
}
|
||||
mutex_enter(&ump->um_lock);
|
||||
pref = ffs_blkpref_ufs2(ip, lbn, indirs[num].in_off, &bap[0]);
|
||||
error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, cred,
|
||||
|
@ -964,11 +1015,12 @@ ffs_balloc_ufs2(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
nb = newb;
|
||||
*allocblk++ = nb;
|
||||
if (bpp != NULL) {
|
||||
nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0);
|
||||
nbp->b_blkno = fsbtodb(fs, nb);
|
||||
if (flags & B_CLRBUF)
|
||||
clrbuf(nbp);
|
||||
*bpp = nbp;
|
||||
error = ffs_getblk(vp, lbn, fsbtodb(fs, nb),
|
||||
fs->fs_bsize, (flags & B_CLRBUF) != 0, bpp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
if (DOINGSOFTDEP(vp))
|
||||
softdep_setup_allocindir_page(ip, lbn, bp,
|
||||
|
@ -993,15 +1045,17 @@ ffs_balloc_ufs2(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
brelse(bp, 0);
|
||||
if (bpp != NULL) {
|
||||
if (flags & B_CLRBUF) {
|
||||
error = bread(vp, lbn, (int)fs->fs_bsize, NOCRED, &nbp);
|
||||
error = bread(vp, lbn, (int)fs->fs_bsize,
|
||||
NOCRED, B_MODIFY, &nbp);
|
||||
if (error) {
|
||||
brelse(nbp, 0);
|
||||
goto fail;
|
||||
}
|
||||
} else {
|
||||
nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0);
|
||||
nbp->b_blkno = fsbtodb(fs, nb);
|
||||
clrbuf(nbp);
|
||||
error = ffs_getblk(vp, lbn, fsbtodb(fs, nb),
|
||||
fs->fs_bsize, true, &nbp);
|
||||
if (error)
|
||||
goto fail;
|
||||
}
|
||||
*bpp = nbp;
|
||||
}
|
||||
|
@ -1069,7 +1123,7 @@ fail:
|
|||
int r;
|
||||
|
||||
r = bread(vp, indirs[unwindidx].in_lbn,
|
||||
(int)fs->fs_bsize, NOCRED, &bp);
|
||||
(int)fs->fs_bsize, NOCRED, 0, &bp);
|
||||
if (r) {
|
||||
panic("Could not unwind indirect block, error %d", r);
|
||||
brelse(bp, 0);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ffs_inode.c,v 1.95 2008/03/27 19:06:52 ad Exp $ */
|
||||
/* $NetBSD: ffs_inode.c,v 1.96 2008/05/16 09:22:00 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_inode.c,v 1.95 2008/03/27 19:06:52 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_inode.c,v 1.96 2008/05/16 09:22:00 hannken Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
|
@ -51,6 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: ffs_inode.c,v 1.95 2008/03/27 19:06:52 ad Exp $");
|
|||
#include <sys/trace.h>
|
||||
#include <sys/resourcevar.h>
|
||||
#include <sys/kauth.h>
|
||||
#include <sys/fstrans.h>
|
||||
|
||||
#include <ufs/ufs/quota.h>
|
||||
#include <ufs/ufs/inode.h>
|
||||
|
@ -117,7 +118,7 @@ ffs_update(struct vnode *vp, const struct timespec *acc,
|
|||
} /* XXX */
|
||||
error = bread(ip->i_devvp,
|
||||
fsbtodb(fs, ino_to_fsba(fs, ip->i_number)),
|
||||
(int)fs->fs_bsize, NOCRED, &bp);
|
||||
(int)fs->fs_bsize, NOCRED, B_MODIFY, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return (error);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ffs_snapshot.c,v 1.66 2008/04/17 09:52:47 hannken Exp $ */
|
||||
/* $NetBSD: ffs_snapshot.c,v 1.67 2008/05/16 09:22:00 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2000 Marshall Kirk McKusick. All Rights Reserved.
|
||||
|
@ -38,7 +38,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.66 2008/04/17 09:52:47 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.67 2008/05/16 09:22:00 hannken Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
|
@ -117,8 +117,6 @@ static int readvnblk(struct vnode *, void *, ufs2_daddr_t);
|
|||
static int ffs_copyonwrite(void *, struct buf *, bool);
|
||||
static int readfsblk(struct vnode *, void *, ufs2_daddr_t);
|
||||
static int writevnblk(struct vnode *, void *, ufs2_daddr_t);
|
||||
static inline int cow_enter(void);
|
||||
static inline void cow_leave(int);
|
||||
static inline ufs2_daddr_t db_get(struct inode *, int);
|
||||
static inline void db_assign(struct inode *, int, ufs2_daddr_t);
|
||||
static inline ufs2_daddr_t idb_get(struct inode *, void *, int);
|
||||
|
@ -379,7 +377,7 @@ ffs_snapshot(struct mount *mp, struct vnode *vp,
|
|||
len = (i == fs->fs_frag) ? 0 : i * fs->fs_fsize;
|
||||
if (len > 0) {
|
||||
if ((error = bread(devvp, fsbtodb(fs, fs->fs_csaddr + loc),
|
||||
len, KERNCRED, &bp)) != 0) {
|
||||
len, KERNCRED, 0, &bp)) != 0) {
|
||||
brelse(bp, 0);
|
||||
free(copy_fs->fs_csp, M_UFSMNT);
|
||||
goto out1;
|
||||
|
@ -640,7 +638,7 @@ out1:
|
|||
}
|
||||
#endif
|
||||
for (loc = 0; loc < len; loc++) {
|
||||
error = bread(vp, blkno + loc, fs->fs_bsize, KERNCRED, &nbp);
|
||||
error = bread(vp, blkno + loc, fs->fs_bsize, KERNCRED, 0, &nbp);
|
||||
if (error) {
|
||||
brelse(nbp, 0);
|
||||
fs->fs_snapinum[snaploc] = 0;
|
||||
|
@ -667,7 +665,7 @@ done:
|
|||
free(copy_fs->fs_csp, M_UFSMNT);
|
||||
if (!error) {
|
||||
error = bread(vp, lblkno(fs, fs->fs_sblockloc), fs->fs_bsize,
|
||||
KERNCRED, &nbp);
|
||||
KERNCRED, 0, &nbp);
|
||||
if (error) {
|
||||
brelse(nbp, 0);
|
||||
fs->fs_snapinum[snaploc] = 0;
|
||||
|
@ -740,7 +738,7 @@ cgaccount(int cg, struct vnode *vp, void *data, int passno)
|
|||
fs = ip->i_fs;
|
||||
ns = UFS_FSNEEDSWAP(fs);
|
||||
error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
|
||||
(int)fs->fs_cgsize, KERNCRED, &bp);
|
||||
(int)fs->fs_cgsize, KERNCRED, 0, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return (error);
|
||||
|
@ -815,7 +813,7 @@ expunge_ufs1(struct vnode *snapvp, struct inode *cancelip, struct fs *fs,
|
|||
struct fs *, ufs_lbn_t, int),
|
||||
int expungetype)
|
||||
{
|
||||
int i, s, error, ns, indiroff;
|
||||
int i, error, ns, indiroff;
|
||||
ufs_lbn_t lbn, rlbn;
|
||||
ufs2_daddr_t len, blkno, numblks, blksperindir;
|
||||
struct ufs1_dinode *dip;
|
||||
|
@ -832,10 +830,8 @@ expunge_ufs1(struct vnode *snapvp, struct inode *cancelip, struct fs *fs,
|
|||
if (lbn < NDADDR) {
|
||||
blkno = db_get(VTOI(snapvp), lbn);
|
||||
} else {
|
||||
s = cow_enter();
|
||||
error = ffs_balloc(snapvp, lblktosize(fs, (off_t)lbn),
|
||||
fs->fs_bsize, KERNCRED, B_METAONLY, &bp);
|
||||
cow_leave(s);
|
||||
if (error)
|
||||
return (error);
|
||||
indiroff = (lbn - NDADDR) % NINDIR(fs);
|
||||
|
@ -1083,7 +1079,7 @@ expunge_ufs2(struct vnode *snapvp, struct inode *cancelip, struct fs *fs,
|
|||
struct fs *, ufs_lbn_t, int),
|
||||
int expungetype)
|
||||
{
|
||||
int i, s, error, ns, indiroff;
|
||||
int i, error, ns, indiroff;
|
||||
ufs_lbn_t lbn, rlbn;
|
||||
ufs2_daddr_t len, blkno, numblks, blksperindir;
|
||||
struct ufs2_dinode *dip;
|
||||
|
@ -1100,10 +1096,8 @@ expunge_ufs2(struct vnode *snapvp, struct inode *cancelip, struct fs *fs,
|
|||
if (lbn < NDADDR) {
|
||||
blkno = db_get(VTOI(snapvp), lbn);
|
||||
} else {
|
||||
s = cow_enter();
|
||||
error = ffs_balloc(snapvp, lblktosize(fs, (off_t)lbn),
|
||||
fs->fs_bsize, KERNCRED, B_METAONLY, &bp);
|
||||
cow_leave(s);
|
||||
if (error)
|
||||
return (error);
|
||||
indiroff = (lbn - NDADDR) % NINDIR(fs);
|
||||
|
@ -1515,7 +1509,7 @@ ffs_snapblkfree(struct fs *fs, struct vnode *devvp, ufs2_daddr_t bno,
|
|||
ufs_lbn_t lbn;
|
||||
ufs2_daddr_t blkno;
|
||||
uint32_t gen;
|
||||
int s, indiroff = 0, snapshot_locked = 0, error = 0, claimedblk = 0;
|
||||
int indiroff = 0, snapshot_locked = 0, error = 0, claimedblk = 0;
|
||||
|
||||
si = VFSTOUFS(mp)->um_snapinfo;
|
||||
lbn = fragstoblks(fs, bno);
|
||||
|
@ -1542,10 +1536,8 @@ retry:
|
|||
blkno = db_get(ip, lbn);
|
||||
} else {
|
||||
mutex_exit(&si->si_lock);
|
||||
s = cow_enter();
|
||||
error = ffs_balloc(vp, lblktosize(fs, (off_t)lbn),
|
||||
fs->fs_bsize, KERNCRED, B_METAONLY, &ibp);
|
||||
cow_leave(s);
|
||||
if (error) {
|
||||
mutex_enter(&si->si_lock);
|
||||
break;
|
||||
|
@ -1851,7 +1843,7 @@ ffs_copyonwrite(void *v, struct buf *bp, bool data_valid)
|
|||
void *saved_data = NULL;
|
||||
ufs2_daddr_t lbn, blkno, *snapblklist;
|
||||
uint32_t gen;
|
||||
int lower, upper, mid, s, ns, indiroff, snapshot_locked = 0, error = 0;
|
||||
int lower, upper, mid, ns, indiroff, snapshot_locked = 0, error = 0;
|
||||
|
||||
/*
|
||||
* Check for valid snapshots.
|
||||
|
@ -1924,10 +1916,8 @@ retry:
|
|||
blkno = db_get(ip, lbn);
|
||||
} else {
|
||||
mutex_exit(&si->si_lock);
|
||||
s = cow_enter();
|
||||
error = ffs_balloc(vp, lblktosize(fs, (off_t)lbn),
|
||||
fs->fs_bsize, KERNCRED, B_METAONLY, &ibp);
|
||||
cow_leave(s);
|
||||
if (error) {
|
||||
mutex_enter(&si->si_lock);
|
||||
break;
|
||||
|
@ -1945,10 +1935,6 @@ retry:
|
|||
#endif
|
||||
if (blkno != 0)
|
||||
continue;
|
||||
#ifdef DIAGNOSTIC
|
||||
if (curlwp->l_pflag & LP_UFSCOW)
|
||||
printf("ffs_copyonwrite: recursive call\n");
|
||||
#endif
|
||||
/*
|
||||
* Allocate the block into which to do the copy. Since
|
||||
* multiple processes may all try to copy the same block,
|
||||
|
@ -2078,21 +2064,19 @@ readvnblk(struct vnode *vp, void *data, ufs2_daddr_t lbn)
|
|||
static int
|
||||
writevnblk(struct vnode *vp, void *data, ufs2_daddr_t lbn)
|
||||
{
|
||||
int s, error;
|
||||
int error;
|
||||
off_t offset;
|
||||
struct buf *bp;
|
||||
struct inode *ip = VTOI(vp);
|
||||
struct fs *fs = ip->i_fs;
|
||||
|
||||
offset = lblktosize(fs, (off_t)lbn);
|
||||
s = cow_enter();
|
||||
mutex_enter(&vp->v_interlock);
|
||||
error = VOP_PUTPAGES(vp, trunc_page(offset),
|
||||
round_page(offset+fs->fs_bsize), PGO_CLEANIT|PGO_SYNCIO|PGO_FREE);
|
||||
if (error == 0)
|
||||
error = ffs_balloc(vp, lblktosize(fs, (off_t)lbn),
|
||||
fs->fs_bsize, KERNCRED, B_SYNC, &bp);
|
||||
cow_leave(s);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
|
@ -2105,31 +2089,6 @@ writevnblk(struct vnode *vp, void *data, ufs2_daddr_t lbn)
|
|||
return bwrite(bp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set/reset lwp's LP_UFSCOW flag.
|
||||
* May be called recursive.
|
||||
*/
|
||||
static inline int
|
||||
cow_enter(void)
|
||||
{
|
||||
struct lwp *l = curlwp;
|
||||
|
||||
if (l->l_pflag & LP_UFSCOW) {
|
||||
return 0;
|
||||
} else {
|
||||
l->l_pflag |= LP_UFSCOW;
|
||||
return LP_UFSCOW;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
cow_leave(int flag)
|
||||
{
|
||||
struct lwp *l = curlwp;
|
||||
|
||||
l->l_pflag &= ~flag;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get/Put direct block from inode or buffer containing disk addresses. Take
|
||||
* care for fs type (UFS1/UFS2) and byte swapping. These functions should go
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ffs_softdep.c,v 1.111 2008/05/05 17:11:17 ad Exp $ */
|
||||
/* $NetBSD: ffs_softdep.c,v 1.112 2008/05/16 09:22:00 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1998 Marshall Kirk McKusick. All Rights Reserved.
|
||||
|
@ -33,7 +33,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_softdep.c,v 1.111 2008/05/05 17:11:17 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_softdep.c,v 1.112 2008/05/16 09:22:00 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
|
@ -48,6 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: ffs_softdep.c,v 1.111 2008/05/05 17:11:17 ad Exp $")
|
|||
#include <sys/vnode.h>
|
||||
#include <sys/inttypes.h>
|
||||
#include <sys/kauth.h>
|
||||
#include <sys/fstrans.h>
|
||||
|
||||
#include <miscfs/specfs/specdev.h>
|
||||
|
||||
|
@ -1196,7 +1197,7 @@ softdep_mount(devvp, mp, fs, cred)
|
|||
bzero(&cstotal, sizeof cstotal);
|
||||
for (cyl = 0; cyl < fs->fs_ncg; cyl++) {
|
||||
if ((error = bread(devvp, fsbtodb(fs, cgtod(fs, cyl)),
|
||||
fs->fs_cgsize, cred, &bp)) != 0) {
|
||||
fs->fs_cgsize, cred, 0, &bp)) != 0) {
|
||||
brelse(bp, 0);
|
||||
return (error);
|
||||
}
|
||||
|
@ -1916,7 +1917,7 @@ softdep_setup_freeblocks(
|
|||
*/
|
||||
if ((error = bread(ip->i_devvp,
|
||||
fsbtodb(fs, ino_to_fsba(fs, ip->i_number)),
|
||||
(int)fs->fs_bsize, NOCRED, &bp)) != 0)
|
||||
(int)fs->fs_bsize, NOCRED, B_MODIFY, &bp)) != 0)
|
||||
softdep_error("softdep_setup_freeblocks", error);
|
||||
if (ip->i_ump->um_fstype == UFS1) {
|
||||
#ifdef FFS_EI
|
||||
|
@ -2452,7 +2453,7 @@ indir_trunc(freeblks, dbn, level, lbn, countp)
|
|||
} else {
|
||||
softdep_trackbufs(1, false);
|
||||
mutex_exit(&bufcache_lock);
|
||||
error = bread(devvp, dbn, (int)fs->fs_bsize, NOCRED, &bp);
|
||||
error = bread(devvp, dbn, (int)fs->fs_bsize, NOCRED, 0, &bp);
|
||||
if (error)
|
||||
return (error);
|
||||
}
|
||||
|
@ -4670,7 +4671,7 @@ softdep_fsync(vp, f)
|
|||
* Flush directory page containing the inode's name.
|
||||
*/
|
||||
error = bread(pvp, lbn, blksize(fs, VTOI(pvp), lbn),
|
||||
lp->l_cred, &bp);
|
||||
lp->l_cred, 0, &bp);
|
||||
if (error == 0)
|
||||
error = VOP_BWRITE(bp);
|
||||
vput(pvp);
|
||||
|
@ -5250,7 +5251,7 @@ flush_pagedep_deps(pvp, mp, diraddhdp)
|
|||
mutex_exit(&bufcache_lock);
|
||||
if ((error = bread(ump->um_devvp,
|
||||
fsbtodb(ump->um_fs, ino_to_fsba(ump->um_fs, inum)),
|
||||
(int)ump->um_fs->fs_bsize, NOCRED, &bp)) != 0)
|
||||
(int)ump->um_fs->fs_bsize, NOCRED, 0, &bp)) != 0)
|
||||
break;
|
||||
if ((error = VOP_BWRITE(bp)) != 0)
|
||||
break;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ffs_vfsops.c,v 1.227 2008/05/10 02:26:10 rumble Exp $ */
|
||||
/* $NetBSD: ffs_vfsops.c,v 1.228 2008/05/16 09:22:00 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1991, 1993, 1994
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.227 2008/05/10 02:26:10 rumble Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.228 2008/05/16 09:22:00 hannken Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
|
@ -537,7 +537,7 @@ ffs_reload(struct mount *mp, kauth_cred_t cred, struct lwp *l)
|
|||
size = dpart.disklab->d_secsize;
|
||||
/* XXX we don't handle possibility that superblock moved. */
|
||||
error = bread(devvp, fs->fs_sblockloc / size, fs->fs_sbsize,
|
||||
NOCRED, &bp);
|
||||
NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return (error);
|
||||
|
@ -590,7 +590,7 @@ ffs_reload(struct mount *mp, kauth_cred_t cred, struct lwp *l)
|
|||
* is found, then treat it like an Apple UFS filesystem anyway
|
||||
*/
|
||||
error = bread(devvp, (daddr_t)(APPLEUFS_LABEL_OFFSET / size),
|
||||
APPLEUFS_LABEL_SIZE, cred, &bp);
|
||||
APPLEUFS_LABEL_SIZE, cred, 0, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return (error);
|
||||
|
@ -640,7 +640,7 @@ ffs_reload(struct mount *mp, kauth_cred_t cred, struct lwp *l)
|
|||
if (i + fs->fs_frag > blks)
|
||||
size = (blks - i) * fs->fs_fsize;
|
||||
error = bread(devvp, fsbtodb(fs, fs->fs_csaddr + i), size,
|
||||
NOCRED, &bp);
|
||||
NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
return (error);
|
||||
|
@ -705,7 +705,7 @@ ffs_reload(struct mount *mp, kauth_cred_t cred, struct lwp *l)
|
|||
*/
|
||||
ip = VTOI(vp);
|
||||
error = bread(devvp, fsbtodb(fs, ino_to_fsba(fs, ip->i_number)),
|
||||
(int)fs->fs_bsize, NOCRED, &bp);
|
||||
(int)fs->fs_bsize, NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
vput(vp);
|
||||
|
@ -790,7 +790,7 @@ ffs_mountfs(struct vnode *devvp, struct mount *mp, struct lwp *l)
|
|||
goto out;
|
||||
}
|
||||
error = bread(devvp, sblock_try[i] / size, SBLOCKSIZE, cred,
|
||||
&bp);
|
||||
0, &bp);
|
||||
if (error) {
|
||||
fs = NULL;
|
||||
goto out;
|
||||
|
@ -899,7 +899,7 @@ ffs_mountfs(struct vnode *devvp, struct mount *mp, struct lwp *l)
|
|||
* is found, then treat it like an Apple UFS filesystem anyway
|
||||
*/
|
||||
error = bread(devvp, (daddr_t)(APPLEUFS_LABEL_OFFSET / size),
|
||||
APPLEUFS_LABEL_SIZE, cred, &bp);
|
||||
APPLEUFS_LABEL_SIZE, cred, 0, &bp);
|
||||
if (error)
|
||||
goto out;
|
||||
error = ffs_appleufs_validate(fs->fs_fsmnt,
|
||||
|
@ -924,7 +924,7 @@ ffs_mountfs(struct vnode *devvp, struct mount *mp, struct lwp *l)
|
|||
|
||||
if (!ronly) {
|
||||
error = bread(devvp, fsbtodb(fs, fs->fs_size - 1), fs->fs_fsize,
|
||||
cred, &bp);
|
||||
cred, 0, &bp);
|
||||
if (bp->b_bcount != fs->fs_fsize)
|
||||
error = EINVAL;
|
||||
if (error) {
|
||||
|
@ -952,7 +952,7 @@ ffs_mountfs(struct vnode *devvp, struct mount *mp, struct lwp *l)
|
|||
if (i + fs->fs_frag > blks)
|
||||
size = (blks - i) * fs->fs_fsize;
|
||||
error = bread(devvp, fsbtodb(fs, fs->fs_csaddr + i), size,
|
||||
cred, &bp);
|
||||
cred, 0, &bp);
|
||||
if (error) {
|
||||
free(fs->fs_csp, M_UFSMNT);
|
||||
goto out;
|
||||
|
@ -1542,7 +1542,7 @@ ffs_vget(struct mount *mp, ino_t ino, struct vnode **vpp)
|
|||
|
||||
/* Read in the disk contents for the inode, copy into the inode. */
|
||||
error = bread(ump->um_devvp, fsbtodb(fs, ino_to_fsba(fs, ino)),
|
||||
(int)fs->fs_bsize, NOCRED, &bp);
|
||||
(int)fs->fs_bsize, NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lfs.h,v 1.126 2008/04/28 20:24:11 martin Exp $ */
|
||||
/* $NetBSD: lfs.h,v 1.127 2008/05/16 09:22:00 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -405,7 +405,7 @@ struct segusage_v1 {
|
|||
VTOI((F)->lfs_ivnode)->i_flag |= IN_ACCESS; \
|
||||
if ((_e = bread((F)->lfs_ivnode, \
|
||||
((IN) / (F)->lfs_sepb) + (F)->lfs_cleansz, \
|
||||
(F)->lfs_bsize, NOCRED, &(BP))) != 0) \
|
||||
(F)->lfs_bsize, NOCRED, 0, &(BP))) != 0) \
|
||||
panic("lfs: ifile read: %d", _e); \
|
||||
if ((F)->lfs_version == 1) \
|
||||
(SP) = (SEGUSE *)((SEGUSE_V1 *)(BP)->b_data + \
|
||||
|
@ -473,7 +473,7 @@ struct ifile_v1 {
|
|||
VTOI((F)->lfs_ivnode)->i_flag |= IN_ACCESS; \
|
||||
if ((_e = bread((F)->lfs_ivnode, \
|
||||
(IN) / (F)->lfs_ifpb + (F)->lfs_cleansz + (F)->lfs_segtabsz, \
|
||||
(F)->lfs_bsize, NOCRED, &(BP))) != 0) \
|
||||
(F)->lfs_bsize, NOCRED, 0, &(BP))) != 0) \
|
||||
panic("lfs: ifile ino %d read %d", (int)(IN), _e); \
|
||||
if ((F)->lfs_version == 1) \
|
||||
(IP) = (IFILE *)((IFILE_V1 *)(BP)->b_data + \
|
||||
|
@ -506,7 +506,7 @@ typedef struct _cleanerinfo {
|
|||
SHARE_IFLOCK(F); \
|
||||
VTOI((F)->lfs_ivnode)->i_flag |= IN_ACCESS; \
|
||||
if (bread((F)->lfs_ivnode, \
|
||||
(daddr_t)0, (F)->lfs_bsize, NOCRED, &(BP))) \
|
||||
(daddr_t)0, (F)->lfs_bsize, NOCRED, 0, &(BP))) \
|
||||
panic("lfs: ifile read"); \
|
||||
(CP) = (CLEANERINFO *)(BP)->b_data; \
|
||||
UNSHARE_IFLOCK(F); \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lfs_balloc.c,v 1.66 2008/04/28 20:24:11 martin Exp $ */
|
||||
/* $NetBSD: lfs_balloc.c,v 1.67 2008/05/16 09:22:00 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -60,7 +60,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_balloc.c,v 1.66 2008/04/28 20:24:11 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_balloc.c,v 1.67 2008/05/16 09:22:00 hannken Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_quota.h"
|
||||
|
@ -198,7 +198,8 @@ lfs_balloc(struct vnode *vp, off_t startoffset, int iosize, kauth_cred_t cred,
|
|||
} else {
|
||||
if (nsize <= osize) {
|
||||
/* No need to extend */
|
||||
if (bpp && (error = bread(vp, lbn, osize, NOCRED, &bp)))
|
||||
if (bpp && (error = bread(vp, lbn, osize,
|
||||
NOCRED, 0, &bp)))
|
||||
return error;
|
||||
} else {
|
||||
/* Extend existing block */
|
||||
|
@ -330,7 +331,7 @@ lfs_balloc(struct vnode *vp, off_t startoffset, int iosize, kauth_cred_t cred,
|
|||
default:
|
||||
idp = &indirs[num - 1];
|
||||
if (bread(vp, idp->in_lbn, fs->lfs_bsize, NOCRED,
|
||||
&ibp))
|
||||
B_MODIFY, &ibp))
|
||||
panic("lfs_balloc: bread bno %lld",
|
||||
(long long)idp->in_lbn);
|
||||
/* XXX ondisk32 */
|
||||
|
@ -409,7 +410,7 @@ lfs_fragextend(struct vnode *vp, int osize, int nsize, daddr_t lbn, struct buf *
|
|||
* appropriate things and making sure it all goes to disk.
|
||||
* Don't bother to read in that case.
|
||||
*/
|
||||
if (bpp && (error = bread(vp, lbn, osize, NOCRED, bpp))) {
|
||||
if (bpp && (error = bread(vp, lbn, osize, NOCRED, 0, bpp))) {
|
||||
brelse(*bpp, 0);
|
||||
goto out;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lfs_rfw.c,v 1.10 2008/04/28 20:24:11 martin Exp $ */
|
||||
/* $NetBSD: lfs_rfw.c,v 1.11 2008/05/16 09:22:00 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_rfw.c,v 1.10 2008/04/28 20:24:11 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_rfw.c,v 1.11 2008/05/16 09:22:00 hannken Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_quota.h"
|
||||
|
@ -315,7 +315,8 @@ update_inoblk(struct lfs *fs, daddr_t offset, kauth_cred_t cred,
|
|||
* Get the inode, update times and perms.
|
||||
* DO NOT update disk blocks, we do that separately.
|
||||
*/
|
||||
error = bread(devvp, fsbtodb(fs, offset), fs->lfs_ibsize, cred, &dbp);
|
||||
error = bread(devvp, fsbtodb(fs, offset), fs->lfs_ibsize,
|
||||
cred, 0, &dbp);
|
||||
if (error) {
|
||||
DLOG((DLOG_RF, "update_inoblk: bread returned %d\n", error));
|
||||
return error;
|
||||
|
@ -414,7 +415,8 @@ check_segsum(struct lfs *fs, daddr_t offset, u_int64_t nextserial,
|
|||
}
|
||||
|
||||
/* Read in the segment summary */
|
||||
error = bread(devvp, fsbtodb(fs, offset), fs->lfs_sumsize, cred, &bp);
|
||||
error = bread(devvp, fsbtodb(fs, offset), fs->lfs_sumsize,
|
||||
cred, 0, &bp);
|
||||
if (error)
|
||||
return -1;
|
||||
|
||||
|
@ -487,7 +489,7 @@ check_segsum(struct lfs *fs, daddr_t offset, u_int64_t nextserial,
|
|||
if (flags & CHECK_CKSUM) {
|
||||
/* Read in the head and add to the buffer */
|
||||
error = bread(devvp, fsbtodb(fs, offset), fs->lfs_bsize,
|
||||
cred, &dbp);
|
||||
cred, 0, &dbp);
|
||||
if (error) {
|
||||
offset = -1;
|
||||
goto err2;
|
||||
|
@ -513,7 +515,8 @@ check_segsum(struct lfs *fs, daddr_t offset, u_int64_t nextserial,
|
|||
if (j == fip->fi_nblocks - 1)
|
||||
size = fip->fi_lastlength;
|
||||
if (flags & CHECK_CKSUM) {
|
||||
error = bread(devvp, fsbtodb(fs, offset), size, cred, &dbp);
|
||||
error = bread(devvp, fsbtodb(fs, offset), size,
|
||||
cred, 0, &dbp);
|
||||
if (error) {
|
||||
offset = -1;
|
||||
goto err2;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lfs_segment.c,v 1.211 2008/04/28 20:24:11 martin Exp $ */
|
||||
/* $NetBSD: lfs_segment.c,v 1.212 2008/05/16 09:22:00 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -60,7 +60,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.211 2008/04/28 20:24:11 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.212 2008/05/16 09:22:00 hannken Exp $");
|
||||
|
||||
#ifdef DEBUG
|
||||
# define vndebug(vp, str) do { \
|
||||
|
@ -682,8 +682,8 @@ lfs_segwrite(struct mount *mp, int flags)
|
|||
curseg = 0;
|
||||
for (n = 0; n < fs->lfs_segtabsz; n++) {
|
||||
dirty = 0;
|
||||
if (bread(fs->lfs_ivnode,
|
||||
fs->lfs_cleansz + n, fs->lfs_bsize, NOCRED, &bp))
|
||||
if (bread(fs->lfs_ivnode, fs->lfs_cleansz + n,
|
||||
fs->lfs_bsize, NOCRED, B_MODIFY, &bp))
|
||||
panic("lfs_segwrite: ifile read");
|
||||
segusep = (SEGUSE *)bp->b_data;
|
||||
maxseg = min(segleft, fs->lfs_sepb);
|
||||
|
@ -1475,7 +1475,8 @@ lfs_update_single(struct lfs *fs, struct segment *sp,
|
|||
break;
|
||||
default:
|
||||
ap = &a[num - 1];
|
||||
if (bread(vp, ap->in_lbn, fs->lfs_bsize, NOCRED, &bp))
|
||||
if (bread(vp, ap->in_lbn, fs->lfs_bsize, NOCRED,
|
||||
B_MODIFY, &bp))
|
||||
panic("lfs_updatemeta: bread bno %" PRId64,
|
||||
ap->in_lbn);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lfs_syscalls.c,v 1.132 2008/05/06 18:43:45 ad Exp $ */
|
||||
/* $NetBSD: lfs_syscalls.c,v 1.133 2008/05/16 09:22:01 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007, 2008
|
||||
|
@ -61,7 +61,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.132 2008/05/06 18:43:45 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.133 2008/05/16 09:22:01 hannken Exp $");
|
||||
|
||||
#ifndef LFS
|
||||
# define LFS /* for prototypes in syscallargs.h */
|
||||
|
@ -1151,7 +1151,7 @@ lfs_fastvget(struct mount *mp, ino_t ino, daddr_t daddr, struct vnode **vpp,
|
|||
retries = 0;
|
||||
again:
|
||||
error = bread(ump->um_devvp, fsbtodb(fs, daddr), fs->lfs_ibsize,
|
||||
NOCRED, &bp);
|
||||
NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
DLOG((DLOG_CLEAN, "lfs_fastvget: bread failed (%d)\n",
|
||||
error));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lfs_vfsops.c,v 1.261 2008/05/10 02:26:10 rumble Exp $ */
|
||||
/* $NetBSD: lfs_vfsops.c,v 1.262 2008/05/16 09:22:01 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007
|
||||
|
@ -61,7 +61,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.261 2008/05/10 02:26:10 rumble Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.262 2008/05/16 09:22:01 hannken Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_lfs.h"
|
||||
|
@ -571,7 +571,7 @@ lfs_mountfs(struct vnode *devvp, struct mount *mp, struct lwp *l)
|
|||
sb_addr = LFS_LABELPAD / secsize;
|
||||
while (1) {
|
||||
/* Read in the superblock. */
|
||||
error = bread(devvp, sb_addr, LFS_SBPAD, cred, &bp);
|
||||
error = bread(devvp, sb_addr, LFS_SBPAD, cred, 0, &bp);
|
||||
if (error)
|
||||
goto out;
|
||||
dfs = (struct dlfs *)bp->b_data;
|
||||
|
@ -627,7 +627,7 @@ lfs_mountfs(struct vnode *devvp, struct mount *mp, struct lwp *l)
|
|||
dfs->dlfs_sboffs[1] - LFS_LABELPAD / fsbsize > LFS_SBPAD / fsbsize)
|
||||
{
|
||||
error = bread(devvp, dfs->dlfs_sboffs[1] * (fsbsize / secsize),
|
||||
LFS_SBPAD, cred, &abp);
|
||||
LFS_SBPAD, cred, 0, &abp);
|
||||
if (error)
|
||||
goto out;
|
||||
adfs = (struct dlfs *)abp->b_data;
|
||||
|
@ -1178,7 +1178,7 @@ retry:
|
|||
again:
|
||||
error = bread(ump->um_devvp, fsbtodb(fs, daddr),
|
||||
(fs->lfs_version == 1 ? fs->lfs_bsize : fs->lfs_ibsize),
|
||||
NOCRED, &bp);
|
||||
NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
/*
|
||||
* The inode does not contain anything useful, so it would
|
||||
|
@ -1977,7 +1977,7 @@ lfs_resize_fs(struct lfs *fs, int newnsegs)
|
|||
rw_enter(&fs->lfs_iflock, RW_WRITER);
|
||||
vn_lock(ivp, LK_EXCLUSIVE | LK_RETRY);
|
||||
for (i = 0; i < ilast; i++) {
|
||||
bread(ivp, i, fs->lfs_bsize, NOCRED, &bp);
|
||||
bread(ivp, i, fs->lfs_bsize, NOCRED, 0, &bp);
|
||||
brelse(bp, 0);
|
||||
}
|
||||
|
||||
|
@ -2007,9 +2007,11 @@ lfs_resize_fs(struct lfs *fs, int newnsegs)
|
|||
inc = -1;
|
||||
}
|
||||
for (i = start; i != end; i += inc) {
|
||||
if (bread(ivp, i, fs->lfs_bsize, NOCRED, &bp) != 0)
|
||||
if (bread(ivp, i, fs->lfs_bsize, NOCRED,
|
||||
B_MODIFY, &bp) != 0)
|
||||
panic("resize: bread dst blk failed");
|
||||
if (bread(ivp, i - noff, fs->lfs_bsize, NOCRED, &obp))
|
||||
if (bread(ivp, i - noff, fs->lfs_bsize,
|
||||
NOCRED, 0, &obp))
|
||||
panic("resize: bread src blk failed");
|
||||
memcpy(bp->b_data, obp->b_data, fs->lfs_bsize);
|
||||
VOP_BWRITE(bp);
|
||||
|
@ -2021,8 +2023,8 @@ lfs_resize_fs(struct lfs *fs, int newnsegs)
|
|||
if (newnsegs > oldnsegs) {
|
||||
for (i = oldnsegs; i < newnsegs; i++) {
|
||||
if ((error = bread(ivp, i / fs->lfs_sepb +
|
||||
fs->lfs_cleansz,
|
||||
fs->lfs_bsize, NOCRED, &bp)) != 0)
|
||||
fs->lfs_cleansz, fs->lfs_bsize,
|
||||
NOCRED, B_MODIFY, &bp)) != 0)
|
||||
panic("lfs: ifile read: %d", error);
|
||||
while ((i + 1) % fs->lfs_sepb && i < newnsegs) {
|
||||
sup = &((SEGUSE *)bp->b_data)[i % fs->lfs_sepb];
|
||||
|
@ -2083,7 +2085,7 @@ lfs_resize_fs(struct lfs *fs, int newnsegs)
|
|||
NOCRED);
|
||||
|
||||
/* Update cleaner info so the cleaner can die */
|
||||
bread(ivp, 0, fs->lfs_bsize, NOCRED, &bp);
|
||||
bread(ivp, 0, fs->lfs_bsize, NOCRED, B_MODIFY, &bp);
|
||||
((CLEANERINFO *)bp->b_data)->clean = fs->lfs_nclean;
|
||||
((CLEANERINFO *)bp->b_data)->dirty = fs->lfs_nseg - fs->lfs_nclean;
|
||||
VOP_BWRITE(bp);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ufs_dirhash.c,v 1.21 2008/01/03 19:28:50 ad Exp $ */
|
||||
/* $NetBSD: ufs_dirhash.c,v 1.22 2008/05/16 09:22:01 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Ian Dowse. All rights reserved.
|
||||
|
@ -28,7 +28,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_dirhash.c,v 1.21 2008/01/03 19:28:50 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_dirhash.c,v 1.22 2008/05/16 09:22:01 hannken Exp $");
|
||||
|
||||
/*
|
||||
* This implements a hash-based lookup scheme for UFS directories.
|
||||
|
@ -219,7 +219,7 @@ ufsdirhash_build(struct inode *ip)
|
|||
if ((pos & bmask) == 0) {
|
||||
if (bp != NULL)
|
||||
brelse(bp, 0);
|
||||
if (ufs_blkatoff(vp, (off_t)pos, NULL, &bp) != 0)
|
||||
if (ufs_blkatoff(vp, (off_t)pos, NULL, &bp, false) != 0)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -416,7 +416,8 @@ restart:
|
|||
if (bp != NULL)
|
||||
brelse(bp, 0);
|
||||
blkoff = offset & ~bmask;
|
||||
if (ufs_blkatoff(vp, (off_t)blkoff, NULL, &bp) != 0)
|
||||
if (ufs_blkatoff(vp, (off_t)blkoff,
|
||||
NULL, &bp, true) != 0)
|
||||
return (EJUSTRETURN);
|
||||
}
|
||||
dp = (struct direct *)((char *)bp->b_data + (offset & bmask));
|
||||
|
@ -525,7 +526,7 @@ ufsdirhash_findfree(struct inode *ip, int slotneeded, int *slotsize)
|
|||
dh->dh_blkfree[dirblock] >= howmany(slotneeded, DIRALIGN));
|
||||
DIRHASH_UNLOCK(dh);
|
||||
pos = dirblock * dirblksiz;
|
||||
error = ufs_blkatoff(ip->i_vnode, (off_t)pos, (void *)&dp, &bp);
|
||||
error = ufs_blkatoff(ip->i_vnode, (off_t)pos, (void *)&dp, &bp, false);
|
||||
if (error)
|
||||
return (-1);
|
||||
/* Find the first entry with free space. */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ufs_extern.h,v 1.58 2008/01/25 14:32:17 ad Exp $ */
|
||||
/* $NetBSD: ufs_extern.h,v 1.59 2008/05/16 09:22:01 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993, 1994
|
||||
|
@ -130,7 +130,7 @@ int ufs_dirremove(struct vnode *, struct inode *, int, int);
|
|||
int ufs_dirrewrite(struct inode *, struct inode *, ino_t, int, int, int);
|
||||
int ufs_dirempty(struct inode *, ino_t, kauth_cred_t);
|
||||
int ufs_checkpath(struct inode *, struct inode *, kauth_cred_t);
|
||||
int ufs_blkatoff(struct vnode *, off_t, char **, struct buf **);
|
||||
int ufs_blkatoff(struct vnode *, off_t, char **, struct buf **, bool);
|
||||
|
||||
/* ufs_quota.c */
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ufs_lookup.c,v 1.96 2007/12/08 19:29:56 pooka Exp $ */
|
||||
/* $NetBSD: ufs_lookup.c,v 1.97 2008/05/16 09:22:01 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.96 2007/12/08 19:29:56 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.97 2008/05/16 09:22:01 hannken Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_ffs.h"
|
||||
|
@ -248,7 +248,8 @@ ufs_lookup(void *v)
|
|||
} else {
|
||||
dp->i_offset = dp->i_diroff;
|
||||
if ((entryoffsetinblock = dp->i_offset & bmask) &&
|
||||
(error = ufs_blkatoff(vdp, (off_t)dp->i_offset, NULL, &bp)))
|
||||
(error = ufs_blkatoff(vdp, (off_t)dp->i_offset,
|
||||
NULL, &bp, false)))
|
||||
goto out;
|
||||
numdirpasses = 2;
|
||||
nchstats.ncs_2passes++;
|
||||
|
@ -268,7 +269,7 @@ searchloop:
|
|||
if (bp != NULL)
|
||||
brelse(bp, 0);
|
||||
error = ufs_blkatoff(vdp, (off_t)dp->i_offset, NULL,
|
||||
&bp);
|
||||
&bp, false);
|
||||
if (error)
|
||||
goto out;
|
||||
entryoffsetinblock = 0;
|
||||
|
@ -885,7 +886,7 @@ ufs_direnter(struct vnode *dvp, struct vnode *tvp, struct direct *dirp,
|
|||
/*
|
||||
* Get the block containing the space for the new directory entry.
|
||||
*/
|
||||
error = ufs_blkatoff(dvp, (off_t)dp->i_offset, &dirbuf, &bp);
|
||||
error = ufs_blkatoff(dvp, (off_t)dp->i_offset, &dirbuf, &bp, true);
|
||||
if (error) {
|
||||
if (DOINGSOFTDEP(dvp) && newdirbp != NULL)
|
||||
bdwrite(newdirbp);
|
||||
|
@ -1044,7 +1045,7 @@ ufs_dirremove(struct vnode *dvp, struct inode *ip, int flags, int isrmdir)
|
|||
* Whiteout entry: set d_ino to WINO.
|
||||
*/
|
||||
error = ufs_blkatoff(dvp, (off_t)dp->i_offset, (void *)&ep,
|
||||
&bp);
|
||||
&bp, true);
|
||||
if (error)
|
||||
return (error);
|
||||
ep->d_ino = ufs_rw32(WINO, needswap);
|
||||
|
@ -1053,7 +1054,7 @@ ufs_dirremove(struct vnode *dvp, struct inode *ip, int flags, int isrmdir)
|
|||
}
|
||||
|
||||
if ((error = ufs_blkatoff(dvp,
|
||||
(off_t)(dp->i_offset - dp->i_count), (void *)&ep, &bp)) != 0)
|
||||
(off_t)(dp->i_offset - dp->i_count), (void *)&ep, &bp, true)) != 0)
|
||||
return (error);
|
||||
|
||||
#ifdef UFS_DIRHASH
|
||||
|
@ -1135,7 +1136,7 @@ ufs_dirrewrite(struct inode *dp, struct inode *oip, ino_t newinum, int newtype,
|
|||
struct vnode *vdp = ITOV(dp);
|
||||
int error;
|
||||
|
||||
error = ufs_blkatoff(vdp, (off_t)dp->i_offset, (void *)&ep, &bp);
|
||||
error = ufs_blkatoff(vdp, (off_t)dp->i_offset, (void *)&ep, &bp, true);
|
||||
if (error)
|
||||
return (error);
|
||||
ep->d_ino = ufs_rw32(newinum, UFS_MPNEEDSWAP(dp->i_ump));
|
||||
|
@ -1316,7 +1317,8 @@ int ufs_dirrablks = UFS_DIRRABLKS;
|
|||
*/
|
||||
|
||||
int
|
||||
ufs_blkatoff(struct vnode *vp, off_t offset, char **res, struct buf **bpp)
|
||||
ufs_blkatoff(struct vnode *vp, off_t offset, char **res, struct buf **bpp,
|
||||
bool modify)
|
||||
{
|
||||
struct inode *ip;
|
||||
struct buf *bp;
|
||||
|
@ -1355,7 +1357,7 @@ ufs_blkatoff(struct vnode *vp, off_t offset, char **res, struct buf **bpp)
|
|||
}
|
||||
KASSERT(run >= 1);
|
||||
error = breadn(vp, blks[0], blksizes[0], &blks[1], &blksizes[1],
|
||||
run - 1, NOCRED, &bp);
|
||||
run - 1, NOCRED, (modify ? B_MODIFY : 0), &bp);
|
||||
if (error != 0) {
|
||||
brelse(bp, 0);
|
||||
*bpp = NULL;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ufs_readwrite.c,v 1.87 2008/04/24 15:35:31 ad Exp $ */
|
||||
/* $NetBSD: ufs_readwrite.c,v 1.88 2008/05/16 09:22:01 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.87 2008/04/24 15:35:31 ad Exp $");
|
||||
__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.88 2008/05/16 09:22:01 hannken Exp $");
|
||||
|
||||
#ifdef LFS_READWRITE
|
||||
#define FS struct lfs
|
||||
|
@ -144,11 +144,11 @@ READ(void *v)
|
|||
bytesinfile);
|
||||
|
||||
if (lblktosize(fs, nextlbn) >= ip->i_size)
|
||||
error = bread(vp, lbn, size, NOCRED, &bp);
|
||||
error = bread(vp, lbn, size, NOCRED, 0, &bp);
|
||||
else {
|
||||
int nextsize = blksize(fs, ip, nextlbn);
|
||||
error = breadn(vp, lbn,
|
||||
size, &nextlbn, &nextsize, 1, NOCRED, &bp);
|
||||
size, &nextlbn, &nextsize, 1, NOCRED, 0, &bp);
|
||||
}
|
||||
if (error)
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue