151882Sbostic /*- 251882Sbostic * Copyright (c) 1991 The Regents of the University of California. 351882Sbostic * All rights reserved. 451882Sbostic * 551882Sbostic * %sccs.include.redist.c% 651882Sbostic * 7*57073Smargo * @(#)lfs_syscalls.c 7.28 (Berkeley) 12/10/92 851882Sbostic */ 951882Sbostic 1051882Sbostic #include <sys/param.h> 1151882Sbostic #include <sys/proc.h> 1251882Sbostic #include <sys/buf.h> 1351882Sbostic #include <sys/mount.h> 1451882Sbostic #include <sys/vnode.h> 1551882Sbostic #include <sys/malloc.h> 1651882Sbostic #include <sys/kernel.h> 1751882Sbostic 1851882Sbostic #include <ufs/ufs/quota.h> 1951882Sbostic #include <ufs/ufs/inode.h> 2051882Sbostic #include <ufs/ufs/ufsmount.h> 2155941Sbostic #include <ufs/ufs/ufs_extern.h> 2251882Sbostic 2351882Sbostic #include <ufs/lfs/lfs.h> 2451882Sbostic #include <ufs/lfs/lfs_extern.h> 2556479Smargo #define BUMP_FIP(SP) \ 2656479Smargo (SP)->fip = (FINFO *) (&(SP)->fip->fi_blocks[(SP)->fip->fi_nblocks]) 2751882Sbostic 2856479Smargo #define INC_FINFO(SP) ++((SEGSUM *)((SP)->segsum))->ss_nfinfo 2956479Smargo #define DEC_FINFO(SP) --((SEGSUM *)((SP)->segsum))->ss_nfinfo 3056479Smargo 3156479Smargo /* 3256479Smargo * Before committing to add something to a segment summary, make sure there 3356479Smargo * is enough room. S is the bytes added to the summary. 3456479Smargo */ 3556479Smargo #define CHECK_SEG(s) \ 3656479Smargo if (sp->sum_bytes_left < (s)) { \ 3756479Smargo (void) lfs_writeseg(fs, sp); \ 3856479Smargo } 3955941Sbostic struct buf *lfs_fakebuf __P((struct vnode *, int, size_t, caddr_t)); 4055941Sbostic 4151882Sbostic /* 4251882Sbostic * lfs_markv: 4351882Sbostic * 4451882Sbostic * This will mark inodes and blocks dirty, so they are written into the log. 4551882Sbostic * It will block until all the blocks have been written. The segment create 4651882Sbostic * time passed in the block_info and inode_info structures is used to decide 4751882Sbostic * if the data is valid for each block (in case some process dirtied a block 4851882Sbostic * or inode that is being cleaned between the determination that a block is 4951882Sbostic * live and the lfs_markv call). 5051882Sbostic * 5151882Sbostic * 0 on success 5251882Sbostic * -1/errno is return on error. 5351882Sbostic */ 5451882Sbostic int 5551882Sbostic lfs_markv(p, uap, retval) 5651882Sbostic struct proc *p; 5751882Sbostic struct args { 5851882Sbostic fsid_t fsid; /* file system */ 5951882Sbostic BLOCK_INFO *blkiov; /* block array */ 6051882Sbostic int blkcnt; /* count of block array entries */ 6151882Sbostic } *uap; 6251882Sbostic int *retval; 6351882Sbostic { 6455941Sbostic struct segment *sp; 6551882Sbostic BLOCK_INFO *blkp; 6651882Sbostic IFILE *ifp; 6755941Sbostic struct buf *bp, **bpp; 6852087Sbostic struct inode *ip; 6951882Sbostic struct lfs *fs; 7051882Sbostic struct mount *mntp; 7151882Sbostic struct vnode *vp; 7252173Sbostic void *start; 7352087Sbostic ino_t lastino; 7455941Sbostic daddr_t b_daddr, v_daddr; 7551882Sbostic u_long bsize; 7651882Sbostic int cnt, error; 7751882Sbostic 7851882Sbostic if (error = suser(p->p_ucred, &p->p_acflag)) 7951882Sbostic return (error); 8051882Sbostic if ((mntp = getvfs(&uap->fsid)) == NULL) 8151882Sbostic return (EINVAL); 8251882Sbostic 8351882Sbostic cnt = uap->blkcnt; 8452996Sbostic start = malloc(cnt * sizeof(BLOCK_INFO), M_SEGMENT, M_WAITOK); 8555941Sbostic if (error = copyin(uap->blkiov, start, cnt * sizeof(BLOCK_INFO))) 8655941Sbostic goto err1; 8751882Sbostic 8855941Sbostic /* Mark blocks/inodes dirty. */ 8952087Sbostic fs = VFSTOUFS(mntp)->um_lfs; 9052820Sbostic bsize = fs->lfs_bsize; 9155941Sbostic error = 0; 9255941Sbostic 93*57073Smargo lfs_seglock(fs, SEGM_SYNC | SEGM_CLEAN); 94*57073Smargo sp = fs->lfs_sp; 9555941Sbostic for (v_daddr = LFS_UNUSED_DADDR, lastino = LFS_UNUSED_INUM, 9655941Sbostic blkp = start; cnt--; ++blkp) { 9752087Sbostic /* 9852087Sbostic * Get the IFILE entry (only once) and see if the file still 9952087Sbostic * exists. 10052087Sbostic */ 10152087Sbostic if (lastino != blkp->bi_inode) { 10255941Sbostic if (lastino != LFS_UNUSED_INUM) { 10356479Smargo /* Finish up last file */ 10456029Sbostic lfs_updatemeta(sp); 10555941Sbostic lfs_writeinode(fs, sp, ip); 106*57073Smargo lfs_vunref(vp); 10756479Smargo if (sp->fip->fi_nblocks) 10856479Smargo BUMP_FIP(sp); 10956479Smargo else { 11056479Smargo DEC_FINFO(sp); 11156479Smargo sp->sum_bytes_left += 11256479Smargo sizeof(FINFO) - sizeof(daddr_t); 11356479Smargo 11456191Smargo } 11555941Sbostic } 11656479Smargo 11756479Smargo /* Start a new file */ 11856479Smargo CHECK_SEG(sizeof(FINFO)); 11956479Smargo sp->sum_bytes_left -= sizeof(FINFO) - sizeof(daddr_t); 12056479Smargo INC_FINFO(sp); 12156479Smargo sp->start_lbp = &sp->fip->fi_blocks[0]; 12256479Smargo sp->vp = NULL; 12356369Smargo sp->fip->fi_version = blkp->bi_version; 12456369Smargo sp->fip->fi_nblocks = 0; 12556369Smargo sp->fip->fi_ino = blkp->bi_inode; 12652087Sbostic lastino = blkp->bi_inode; 12756161Sbostic if (blkp->bi_inode == LFS_IFILE_INUM) 12856161Sbostic v_daddr = fs->lfs_idaddr; 12956161Sbostic else { 13056161Sbostic LFS_IENTRY(ifp, fs, blkp->bi_inode, bp); 13156161Sbostic v_daddr = ifp->if_daddr; 13256161Sbostic brelse(bp); 13356161Sbostic } 13455941Sbostic if (v_daddr == LFS_UNUSED_DADDR) 13552087Sbostic continue; 13656479Smargo 13755941Sbostic /* Get the vnode/inode. */ 13855941Sbostic if (lfs_fastvget(mntp, blkp->bi_inode, v_daddr, &vp, 13956369Smargo blkp->bi_lbn == LFS_UNUSED_LBN ? 14056369Smargo blkp->bi_bp : NULL)) { 14155941Sbostic #ifdef DIAGNOSTIC 14255941Sbostic printf("lfs_markv: VFS_VGET failed (%d)\n", 14355941Sbostic blkp->bi_inode); 14455941Sbostic #endif 14556029Sbostic lastino = LFS_UNUSED_INUM; 14656479Smargo v_daddr = LFS_UNUSED_DADDR; 14755941Sbostic continue; 14855941Sbostic } 14956029Sbostic sp->vp = vp; 15055941Sbostic ip = VTOI(vp); 15155941Sbostic } else if (v_daddr == LFS_UNUSED_DADDR) 15255941Sbostic continue; 15352087Sbostic 15455941Sbostic /* If this BLOCK_INFO didn't contain a block, keep going. */ 15555941Sbostic if (blkp->bi_lbn == LFS_UNUSED_LBN) 15651882Sbostic continue; 15756479Smargo if (VOP_BMAP(vp, blkp->bi_lbn, NULL, &b_daddr, NULL) || 15856161Sbostic b_daddr != blkp->bi_daddr) 15952173Sbostic continue; 16055941Sbostic /* 16155941Sbostic * If we got to here, then we are keeping the block. If it 16255941Sbostic * is an indirect block, we want to actually put it in the 16355941Sbostic * buffer cache so that it can be updated in the finish_meta 16455941Sbostic * section. If it's not, we need to allocate a fake buffer 16555941Sbostic * so that writeseg can perform the copyin and write the buffer. 16655941Sbostic */ 16755941Sbostic if (blkp->bi_lbn >= 0) /* Data Block */ 16855941Sbostic bp = lfs_fakebuf(vp, blkp->bi_lbn, bsize, 16955941Sbostic blkp->bi_bp); 17055941Sbostic else { 17155941Sbostic bp = getblk(vp, blkp->bi_lbn, bsize); 17256625Smargo if (!(bp->b_flags & (B_DELWRI | B_DONE | B_CACHE)) && 17355941Sbostic (error = copyin(blkp->bi_bp, bp->b_un.b_addr, 17455941Sbostic bsize))) 17555941Sbostic goto err2; 17655941Sbostic if (error = VOP_BWRITE(bp)) 17755941Sbostic goto err2; 17852087Sbostic } 17956029Sbostic while (lfs_gatherblock(sp, bp, NULL)); 18051882Sbostic } 18156029Sbostic if (sp->vp) { 18256029Sbostic lfs_updatemeta(sp); 18356029Sbostic lfs_writeinode(fs, sp, ip); 184*57073Smargo lfs_vunref(vp); 18556479Smargo if (!sp->fip->fi_nblocks) { 18656479Smargo DEC_FINFO(sp); 18756479Smargo sp->sum_bytes_left += sizeof(FINFO) - sizeof(daddr_t); 18856479Smargo } 18956029Sbostic } 19055941Sbostic (void) lfs_writeseg(fs, sp); 19155941Sbostic lfs_segunlock(fs); 19252173Sbostic free(start, M_SEGMENT); 19355941Sbostic return (error); 19455941Sbostic /* 19555941Sbostic * XXX If we come in to error 2, we might have indirect blocks that were 19655941Sbostic * updated and now have bad block pointers. I don't know what to do 19755941Sbostic * about this. 19855941Sbostic */ 19951882Sbostic 200*57073Smargo err2: lfs_vunref(vp); 20155941Sbostic /* Free up fakebuffers */ 20255941Sbostic for (bpp = --sp->cbpp; bpp >= sp->bpp; --bpp) 20355941Sbostic if ((*bpp)->b_flags & B_CALL) { 20455941Sbostic brelvp(*bpp); 20555941Sbostic free(*bpp, M_SEGMENT); 20655941Sbostic } else 20755941Sbostic brelse(*bpp); 20855941Sbostic lfs_segunlock(fs); 20955941Sbostic err1: 21052173Sbostic free(start, M_SEGMENT); 21155941Sbostic return(error); 21251882Sbostic } 21351882Sbostic 21451882Sbostic /* 21551882Sbostic * lfs_bmapv: 21651882Sbostic * 21752087Sbostic * This will fill in the current disk address for arrays of blocks. 21851882Sbostic * 21951882Sbostic * 0 on success 22051882Sbostic * -1/errno is return on error. 22151882Sbostic */ 22251882Sbostic int 22351882Sbostic lfs_bmapv(p, uap, retval) 22451882Sbostic struct proc *p; 22551882Sbostic struct args { 22651882Sbostic fsid_t fsid; /* file system */ 22751882Sbostic BLOCK_INFO *blkiov; /* block array */ 22851882Sbostic int blkcnt; /* count of block array entries */ 22951882Sbostic } *uap; 23051882Sbostic int *retval; 23151882Sbostic { 23251882Sbostic BLOCK_INFO *blkp; 23351882Sbostic struct mount *mntp; 23451882Sbostic struct vnode *vp; 23552173Sbostic void *start; 23651882Sbostic daddr_t daddr; 23752173Sbostic int cnt, error, step; 23851882Sbostic 23951882Sbostic if (error = suser(p->p_ucred, &p->p_acflag)) 24051882Sbostic return (error); 24151882Sbostic if ((mntp = getvfs(&uap->fsid)) == NULL) 24251882Sbostic return (EINVAL); 24351882Sbostic 24451882Sbostic cnt = uap->blkcnt; 24552173Sbostic start = blkp = malloc(cnt * sizeof(BLOCK_INFO), M_SEGMENT, M_WAITOK); 24651882Sbostic if (error = copyin(uap->blkiov, blkp, cnt * sizeof(BLOCK_INFO))) { 24751882Sbostic free(blkp, M_SEGMENT); 24851882Sbostic return (error); 24951882Sbostic } 25051882Sbostic 25152173Sbostic for (step = cnt; step--; ++blkp) { 25256161Sbostic if (blkp->bi_lbn == LFS_UNUSED_LBN) 25356161Sbostic continue; 254*57073Smargo /* Could be a deadlock ? */ 25554662Smckusick if (VFS_VGET(mntp, blkp->bi_inode, &vp)) 25652173Sbostic daddr = LFS_UNUSED_DADDR; 25752173Sbostic else { 25856479Smargo if (VOP_BMAP(vp, blkp->bi_lbn, NULL, &daddr, NULL)) 25952173Sbostic daddr = LFS_UNUSED_DADDR; 26052173Sbostic vput(vp); 26152173Sbostic } 26252173Sbostic blkp->bi_daddr = daddr; 26352173Sbostic } 26452173Sbostic copyout(start, uap->blkiov, cnt * sizeof(BLOCK_INFO)); 26552173Sbostic free(start, M_SEGMENT); 26651882Sbostic return (0); 26751882Sbostic } 26851882Sbostic 26951882Sbostic /* 27051882Sbostic * lfs_segclean: 27151882Sbostic * 27251882Sbostic * Mark the segment clean. 27351882Sbostic * 27451882Sbostic * 0 on success 27551882Sbostic * -1/errno is return on error. 27651882Sbostic */ 27751882Sbostic int 27851882Sbostic lfs_segclean(p, uap, retval) 27951882Sbostic struct proc *p; 28051882Sbostic struct args { 28151882Sbostic fsid_t fsid; /* file system */ 28251882Sbostic u_long segment; /* segment number */ 28351882Sbostic } *uap; 28451882Sbostic int *retval; 28551882Sbostic { 28651928Sbostic CLEANERINFO *cip; 28751882Sbostic SEGUSE *sup; 28851882Sbostic struct buf *bp; 28951882Sbostic struct mount *mntp; 29051882Sbostic struct lfs *fs; 29151882Sbostic int error; 29251882Sbostic 29351882Sbostic if (error = suser(p->p_ucred, &p->p_acflag)) 29451882Sbostic return (error); 29551882Sbostic if ((mntp = getvfs(&uap->fsid)) == NULL) 29651882Sbostic return (EINVAL); 29751882Sbostic 29851882Sbostic fs = VFSTOUFS(mntp)->um_lfs; 29951928Sbostic 30056369Smargo if (datosn(fs, fs->lfs_curseg) == uap->segment) 30156369Smargo return (EBUSY); 30256369Smargo 30351882Sbostic LFS_SEGENTRY(sup, fs, uap->segment, bp); 30456369Smargo if (sup->su_flags & SEGUSE_ACTIVE) { 30556369Smargo brelse(bp); 30656369Smargo return(EBUSY); 30756369Smargo } 30855941Sbostic fs->lfs_avail += fsbtodb(fs, fs->lfs_ssize) - 1; 30955593Sbostic fs->lfs_bfree += (sup->su_nsums * LFS_SUMMARY_SIZE / DEV_BSIZE) + 31055593Sbostic sup->su_ninos * btodb(fs->lfs_bsize); 31151882Sbostic sup->su_flags &= ~SEGUSE_DIRTY; 31255941Sbostic (void) VOP_BWRITE(bp); 31351928Sbostic 31451928Sbostic LFS_CLEANERINFO(cip, fs, bp); 31551928Sbostic ++cip->clean; 31651928Sbostic --cip->dirty; 31755941Sbostic (void) VOP_BWRITE(bp); 31855941Sbostic wakeup(&fs->lfs_avail); 31951882Sbostic return (0); 32051882Sbostic } 32151882Sbostic 32251882Sbostic /* 32351882Sbostic * lfs_segwait: 32451882Sbostic * 32551882Sbostic * This will block until a segment in file system fsid is written. A timeout 32651882Sbostic * in milliseconds may be specified which will awake the cleaner automatically. 32751882Sbostic * An fsid of -1 means any file system, and a timeout of 0 means forever. 32851882Sbostic * 32951882Sbostic * 0 on success 33051882Sbostic * 1 on timeout 33151882Sbostic * -1/errno is return on error. 33251882Sbostic */ 33351882Sbostic int 33451882Sbostic lfs_segwait(p, uap, retval) 33551882Sbostic struct proc *p; 33651882Sbostic struct args { 33751882Sbostic fsid_t fsid; /* file system */ 33851882Sbostic struct timeval *tv; /* timeout */ 33951882Sbostic } *uap; 34051882Sbostic int *retval; 34151882Sbostic { 34251882Sbostic extern int lfs_allclean_wakeup; 34351882Sbostic struct mount *mntp; 34451882Sbostic struct timeval atv; 34551882Sbostic void *addr; 34651882Sbostic u_long timeout; 34751882Sbostic int error, s; 34851882Sbostic 34955941Sbostic if (error = suser(p->p_ucred, &p->p_acflag)) { 35051882Sbostic return (error); 35155941Sbostic } 35251882Sbostic #ifdef WHEN_QUADS_WORK 35351882Sbostic if (uap->fsid == (fsid_t)-1) 35451882Sbostic addr = &lfs_allclean_wakeup; 35551882Sbostic else { 35651882Sbostic if ((mntp = getvfs(&uap->fsid)) == NULL) 35751882Sbostic return (EINVAL); 35851882Sbostic addr = &VFSTOUFS(mntp)->um_lfs->lfs_nextseg; 35951882Sbostic } 36051882Sbostic #else 36151882Sbostic if ((mntp = getvfs(&uap->fsid)) == NULL) 36251882Sbostic addr = &lfs_allclean_wakeup; 36351882Sbostic else 36451882Sbostic addr = &VFSTOUFS(mntp)->um_lfs->lfs_nextseg; 36551882Sbostic #endif 36651882Sbostic 36751882Sbostic if (uap->tv) { 36851882Sbostic if (error = copyin(uap->tv, &atv, sizeof(struct timeval))) 36951882Sbostic return (error); 37051882Sbostic if (itimerfix(&atv)) 37151882Sbostic return (EINVAL); 37254764Smckusick s = splclock(); 37354764Smckusick timevaladd(&atv, (struct timeval *)&time); 37451882Sbostic timeout = hzto(&atv); 37554277Sbostic splx(s); 37651882Sbostic } else 37751882Sbostic timeout = 0; 37851882Sbostic 37951882Sbostic error = tsleep(addr, PCATCH | PUSER, "segment", timeout); 38051882Sbostic return (error == ERESTART ? EINTR : 0); 38151882Sbostic } 38255941Sbostic 38355941Sbostic /* 38455941Sbostic * VFS_VGET call specialized for the cleaner. The cleaner already knows the 38555941Sbostic * daddr from the ifile, so don't look it up again. If the cleaner is 38655941Sbostic * processing IINFO structures, it may have the ondisk inode already, so 38755941Sbostic * don't go retrieving it again. 38855941Sbostic */ 38955941Sbostic int 39055941Sbostic lfs_fastvget(mp, ino, daddr, vpp, dinp) 39155941Sbostic struct mount *mp; 39255941Sbostic ino_t ino; 39355941Sbostic daddr_t daddr; 39455941Sbostic struct vnode **vpp; 39555941Sbostic struct dinode *dinp; 39655941Sbostic { 39755941Sbostic register struct inode *ip; 39855941Sbostic struct vnode *vp; 39955941Sbostic struct ufsmount *ump; 40055941Sbostic struct buf *bp; 40155941Sbostic dev_t dev; 40255941Sbostic int error; 40355941Sbostic 40455941Sbostic ump = VFSTOUFS(mp); 40555941Sbostic dev = ump->um_dev; 406*57073Smargo /* 407*57073Smargo * This is playing fast and loose. Someone may have the inode 408*57073Smargo * locked, in which case they are going to be distinctly unhappy 409*57073Smargo * if we trash something. 410*57073Smargo */ 411*57073Smargo if ((*vpp = ufs_ihashlookup(dev, ino)) != NULL) { 412*57073Smargo lfs_vref(*vpp); 413*57073Smargo if ((*vpp)->v_flag & VXLOCK) 414*57073Smargo printf ("Cleaned vnode VXLOCKED\n"); 41556191Smargo ip = VTOI(*vpp); 416*57073Smargo if (ip->i_flags & ILOCKED) 417*57073Smargo printf ("Cleaned vnode ILOCKED\n"); 41856369Smargo if (!(ip->i_flag & IMOD)) { 41956369Smargo ++ump->um_lfs->lfs_uinodes; 42056369Smargo ip->i_flag |= IMOD; 42156369Smargo } 42256191Smargo ip->i_flag |= IMOD; 42355941Sbostic return (0); 42456191Smargo } 42555941Sbostic 42655941Sbostic /* Allocate new vnode/inode. */ 42755941Sbostic if (error = lfs_vcreate(mp, ino, &vp)) { 42855941Sbostic *vpp = NULL; 42955941Sbostic return (error); 43055941Sbostic } 43155941Sbostic 43255941Sbostic /* 43355941Sbostic * Put it onto its hash chain and lock it so that other requests for 43455941Sbostic * this inode will block if they arrive while we are sleeping waiting 43555941Sbostic * for old data structures to be purged or for the contents of the 43655941Sbostic * disk portion of this inode to be read. 43755941Sbostic */ 43855941Sbostic ip = VTOI(vp); 43955941Sbostic ufs_ihashins(ip); 44055941Sbostic 44155941Sbostic /* 44255941Sbostic * XXX 44355941Sbostic * This may not need to be here, logically it should go down with 44455941Sbostic * the i_devvp initialization. 44555941Sbostic * Ask Kirk. 44655941Sbostic */ 44755941Sbostic ip->i_lfs = ump->um_lfs; 44855941Sbostic 44955941Sbostic /* Read in the disk contents for the inode, copy into the inode. */ 45055941Sbostic if (dinp) 45155941Sbostic if (error = copyin(dinp, &ip->i_din, sizeof(struct dinode))) 45255941Sbostic return (error); 45355941Sbostic else { 45455941Sbostic if (error = bread(ump->um_devvp, daddr, 45555941Sbostic (int)ump->um_lfs->lfs_bsize, NOCRED, &bp)) { 45655941Sbostic /* 45755941Sbostic * The inode does not contain anything useful, so it 45855941Sbostic * would be misleading to leave it on its hash chain. 45955941Sbostic * Iput() will return it to the free list. 46055941Sbostic */ 46155941Sbostic ufs_ihashrem(ip); 46255941Sbostic 46355941Sbostic /* Unlock and discard unneeded inode. */ 464*57073Smargo lfs_vunref(vp); 46555941Sbostic brelse(bp); 46655941Sbostic *vpp = NULL; 46755941Sbostic return (error); 46855941Sbostic } 46955941Sbostic ip->i_din = *lfs_ifind(ump->um_lfs, ino, bp->b_un.b_dino); 47055941Sbostic brelse(bp); 47155941Sbostic } 47255941Sbostic 47356054Sbostic /* Inode was just read from user space or disk, make sure it's locked */ 47456054Sbostic ip->i_flag |= ILOCKED; 47556054Sbostic 47655941Sbostic /* 47755941Sbostic * Initialize the vnode from the inode, check for aliases. In all 47855941Sbostic * cases re-init ip, the underlying vnode/inode may have changed. 47955941Sbostic */ 48055941Sbostic if (error = ufs_vinit(mp, lfs_specop_p, LFS_FIFOOPS, &vp)) { 481*57073Smargo lfs_vunref(vp); 48255941Sbostic *vpp = NULL; 48355941Sbostic return (error); 48455941Sbostic } 48555941Sbostic /* 48655941Sbostic * Finish inode initialization now that aliasing has been resolved. 48755941Sbostic */ 48855941Sbostic ip->i_devvp = ump->um_devvp; 48955941Sbostic ip->i_flag |= IMOD; 49055941Sbostic ++ump->um_lfs->lfs_uinodes; 49155941Sbostic VREF(ip->i_devvp); 49255941Sbostic *vpp = vp; 49355941Sbostic return (0); 49455941Sbostic } 49555941Sbostic struct buf * 49655941Sbostic lfs_fakebuf(vp, lbn, size, uaddr) 49755941Sbostic struct vnode *vp; 49855941Sbostic int lbn; 49955941Sbostic size_t size; 50055941Sbostic caddr_t uaddr; 50155941Sbostic { 50255941Sbostic struct buf *bp; 50355941Sbostic 50455941Sbostic bp = lfs_newbuf(vp, lbn, 0); 50555941Sbostic bp->b_saveaddr = uaddr; 50655941Sbostic bp->b_bufsize = size; 50755941Sbostic bp->b_bcount = size; 50855941Sbostic bp->b_flags |= B_INVAL; 50955941Sbostic return(bp); 51055941Sbostic } 511