151882Sbostic /*- 2*63375Sbostic * Copyright (c) 1991, 1993 3*63375Sbostic * The Regents of the University of California. All rights reserved. 451882Sbostic * 551882Sbostic * %sccs.include.redist.c% 651882Sbostic * 7*63375Sbostic * @(#)lfs_syscalls.c 8.1 (Berkeley) 06/11/93 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 */ 5457770Smargo struct lfs_markv_args { 5557770Smargo fsid_t fsid; /* file system */ 5657770Smargo BLOCK_INFO *blkiov; /* block array */ 5757770Smargo int blkcnt; /* count of block array entries */ 5857770Smargo }; 5951882Sbostic int 6051882Sbostic lfs_markv(p, uap, retval) 6151882Sbostic struct proc *p; 6257770Smargo struct lfs_markv_args *uap; 6351882Sbostic int *retval; 6451882Sbostic { 6555941Sbostic struct segment *sp; 6651882Sbostic BLOCK_INFO *blkp; 6751882Sbostic IFILE *ifp; 6855941Sbostic struct buf *bp, **bpp; 6952087Sbostic struct inode *ip; 7051882Sbostic struct lfs *fs; 7151882Sbostic struct mount *mntp; 7251882Sbostic struct vnode *vp; 7352173Sbostic void *start; 7452087Sbostic ino_t lastino; 7555941Sbostic daddr_t b_daddr, v_daddr; 7651882Sbostic u_long bsize; 7751882Sbostic int cnt, error; 7851882Sbostic 7951882Sbostic if (error = suser(p->p_ucred, &p->p_acflag)) 8051882Sbostic return (error); 8151882Sbostic if ((mntp = getvfs(&uap->fsid)) == NULL) 8251882Sbostic return (EINVAL); 8351882Sbostic 8451882Sbostic cnt = uap->blkcnt; 8552996Sbostic start = malloc(cnt * sizeof(BLOCK_INFO), M_SEGMENT, M_WAITOK); 8655941Sbostic if (error = copyin(uap->blkiov, start, cnt * sizeof(BLOCK_INFO))) 8755941Sbostic goto err1; 8851882Sbostic 8955941Sbostic /* Mark blocks/inodes dirty. */ 9052087Sbostic fs = VFSTOUFS(mntp)->um_lfs; 9152820Sbostic bsize = fs->lfs_bsize; 9255941Sbostic error = 0; 9355941Sbostic 9457073Smargo lfs_seglock(fs, SEGM_SYNC | SEGM_CLEAN); 9557073Smargo sp = fs->lfs_sp; 9655941Sbostic for (v_daddr = LFS_UNUSED_DADDR, lastino = LFS_UNUSED_INUM, 9755941Sbostic blkp = start; cnt--; ++blkp) { 9852087Sbostic /* 9952087Sbostic * Get the IFILE entry (only once) and see if the file still 10052087Sbostic * exists. 10152087Sbostic */ 10252087Sbostic if (lastino != blkp->bi_inode) { 10355941Sbostic if (lastino != LFS_UNUSED_INUM) { 10456479Smargo /* Finish up last file */ 10556029Sbostic lfs_updatemeta(sp); 10655941Sbostic lfs_writeinode(fs, sp, ip); 10757073Smargo lfs_vunref(vp); 10856479Smargo if (sp->fip->fi_nblocks) 10956479Smargo BUMP_FIP(sp); 11056479Smargo else { 11156479Smargo DEC_FINFO(sp); 11256479Smargo sp->sum_bytes_left += 11356479Smargo sizeof(FINFO) - sizeof(daddr_t); 11456479Smargo 11556191Smargo } 11655941Sbostic } 11756479Smargo 11856479Smargo /* Start a new file */ 11956479Smargo CHECK_SEG(sizeof(FINFO)); 12056479Smargo sp->sum_bytes_left -= sizeof(FINFO) - sizeof(daddr_t); 12156479Smargo INC_FINFO(sp); 12256479Smargo sp->start_lbp = &sp->fip->fi_blocks[0]; 12356479Smargo sp->vp = NULL; 12456369Smargo sp->fip->fi_version = blkp->bi_version; 12556369Smargo sp->fip->fi_nblocks = 0; 12656369Smargo sp->fip->fi_ino = blkp->bi_inode; 12752087Sbostic lastino = blkp->bi_inode; 12856161Sbostic if (blkp->bi_inode == LFS_IFILE_INUM) 12956161Sbostic v_daddr = fs->lfs_idaddr; 13056161Sbostic else { 13156161Sbostic LFS_IENTRY(ifp, fs, blkp->bi_inode, bp); 13256161Sbostic v_daddr = ifp->if_daddr; 13356161Sbostic brelse(bp); 13456161Sbostic } 13555941Sbostic if (v_daddr == LFS_UNUSED_DADDR) 13652087Sbostic continue; 13756479Smargo 13855941Sbostic /* Get the vnode/inode. */ 13955941Sbostic if (lfs_fastvget(mntp, blkp->bi_inode, v_daddr, &vp, 14056369Smargo blkp->bi_lbn == LFS_UNUSED_LBN ? 14156369Smargo blkp->bi_bp : NULL)) { 14255941Sbostic #ifdef DIAGNOSTIC 14355941Sbostic printf("lfs_markv: VFS_VGET failed (%d)\n", 14455941Sbostic blkp->bi_inode); 14555941Sbostic #endif 14656029Sbostic lastino = LFS_UNUSED_INUM; 14756479Smargo v_daddr = LFS_UNUSED_DADDR; 14855941Sbostic continue; 14955941Sbostic } 15056029Sbostic sp->vp = vp; 15155941Sbostic ip = VTOI(vp); 15255941Sbostic } else if (v_daddr == LFS_UNUSED_DADDR) 15355941Sbostic continue; 15452087Sbostic 15555941Sbostic /* If this BLOCK_INFO didn't contain a block, keep going. */ 15655941Sbostic if (blkp->bi_lbn == LFS_UNUSED_LBN) 15751882Sbostic continue; 15856479Smargo if (VOP_BMAP(vp, blkp->bi_lbn, NULL, &b_daddr, NULL) || 15956161Sbostic b_daddr != blkp->bi_daddr) 16052173Sbostic continue; 16155941Sbostic /* 16255941Sbostic * If we got to here, then we are keeping the block. If it 16355941Sbostic * is an indirect block, we want to actually put it in the 16455941Sbostic * buffer cache so that it can be updated in the finish_meta 16555941Sbostic * section. If it's not, we need to allocate a fake buffer 16655941Sbostic * so that writeseg can perform the copyin and write the buffer. 16755941Sbostic */ 16855941Sbostic if (blkp->bi_lbn >= 0) /* Data Block */ 16955941Sbostic bp = lfs_fakebuf(vp, blkp->bi_lbn, bsize, 17055941Sbostic blkp->bi_bp); 17155941Sbostic else { 17257806Smckusick bp = getblk(vp, blkp->bi_lbn, bsize, 0, 0); 17356625Smargo if (!(bp->b_flags & (B_DELWRI | B_DONE | B_CACHE)) && 17455941Sbostic (error = copyin(blkp->bi_bp, bp->b_un.b_addr, 17555941Sbostic bsize))) 17655941Sbostic goto err2; 17755941Sbostic if (error = VOP_BWRITE(bp)) 17855941Sbostic goto err2; 17952087Sbostic } 18056029Sbostic while (lfs_gatherblock(sp, bp, NULL)); 18151882Sbostic } 18256029Sbostic if (sp->vp) { 18356029Sbostic lfs_updatemeta(sp); 18456029Sbostic lfs_writeinode(fs, sp, ip); 18557073Smargo lfs_vunref(vp); 18656479Smargo if (!sp->fip->fi_nblocks) { 18756479Smargo DEC_FINFO(sp); 18856479Smargo sp->sum_bytes_left += sizeof(FINFO) - sizeof(daddr_t); 18956479Smargo } 19056029Sbostic } 19155941Sbostic (void) lfs_writeseg(fs, sp); 19255941Sbostic lfs_segunlock(fs); 19352173Sbostic free(start, M_SEGMENT); 19455941Sbostic return (error); 19555941Sbostic /* 19655941Sbostic * XXX If we come in to error 2, we might have indirect blocks that were 19755941Sbostic * updated and now have bad block pointers. I don't know what to do 19855941Sbostic * about this. 19955941Sbostic */ 20051882Sbostic 20157073Smargo err2: lfs_vunref(vp); 20255941Sbostic /* Free up fakebuffers */ 20355941Sbostic for (bpp = --sp->cbpp; bpp >= sp->bpp; --bpp) 20455941Sbostic if ((*bpp)->b_flags & B_CALL) { 20555941Sbostic brelvp(*bpp); 20655941Sbostic free(*bpp, M_SEGMENT); 20755941Sbostic } else 20855941Sbostic brelse(*bpp); 20955941Sbostic lfs_segunlock(fs); 21055941Sbostic err1: 21152173Sbostic free(start, M_SEGMENT); 21255941Sbostic return(error); 21351882Sbostic } 21451882Sbostic 21551882Sbostic /* 21651882Sbostic * lfs_bmapv: 21751882Sbostic * 21852087Sbostic * This will fill in the current disk address for arrays of blocks. 21951882Sbostic * 22051882Sbostic * 0 on success 22151882Sbostic * -1/errno is return on error. 22251882Sbostic */ 22357770Smargo struct lfs_bmapv_args { 22457770Smargo fsid_t fsid; /* file system */ 22557770Smargo BLOCK_INFO *blkiov; /* block array */ 22657770Smargo int blkcnt; /* count of block array entries */ 22757770Smargo }; 22851882Sbostic int 22951882Sbostic lfs_bmapv(p, uap, retval) 23051882Sbostic struct proc *p; 23157770Smargo struct lfs_bmapv_args *uap; 23251882Sbostic int *retval; 23351882Sbostic { 23451882Sbostic BLOCK_INFO *blkp; 23551882Sbostic struct mount *mntp; 23651882Sbostic struct vnode *vp; 23752173Sbostic void *start; 23851882Sbostic daddr_t daddr; 23952173Sbostic int cnt, error, step; 24051882Sbostic 24151882Sbostic if (error = suser(p->p_ucred, &p->p_acflag)) 24251882Sbostic return (error); 24351882Sbostic if ((mntp = getvfs(&uap->fsid)) == NULL) 24451882Sbostic return (EINVAL); 24551882Sbostic 24651882Sbostic cnt = uap->blkcnt; 24752173Sbostic start = blkp = malloc(cnt * sizeof(BLOCK_INFO), M_SEGMENT, M_WAITOK); 24851882Sbostic if (error = copyin(uap->blkiov, blkp, cnt * sizeof(BLOCK_INFO))) { 24951882Sbostic free(blkp, M_SEGMENT); 25051882Sbostic return (error); 25151882Sbostic } 25251882Sbostic 25352173Sbostic for (step = cnt; step--; ++blkp) { 25456161Sbostic if (blkp->bi_lbn == LFS_UNUSED_LBN) 25556161Sbostic continue; 25657073Smargo /* Could be a deadlock ? */ 25754662Smckusick if (VFS_VGET(mntp, blkp->bi_inode, &vp)) 25852173Sbostic daddr = LFS_UNUSED_DADDR; 25952173Sbostic else { 26056479Smargo if (VOP_BMAP(vp, blkp->bi_lbn, NULL, &daddr, NULL)) 26152173Sbostic daddr = LFS_UNUSED_DADDR; 26252173Sbostic vput(vp); 26352173Sbostic } 26452173Sbostic blkp->bi_daddr = daddr; 26552173Sbostic } 26652173Sbostic copyout(start, uap->blkiov, cnt * sizeof(BLOCK_INFO)); 26752173Sbostic free(start, M_SEGMENT); 26851882Sbostic return (0); 26951882Sbostic } 27051882Sbostic 27151882Sbostic /* 27251882Sbostic * lfs_segclean: 27351882Sbostic * 27451882Sbostic * Mark the segment clean. 27551882Sbostic * 27651882Sbostic * 0 on success 27751882Sbostic * -1/errno is return on error. 27851882Sbostic */ 27957770Smargo struct lfs_segclean_args { 28057770Smargo fsid_t fsid; /* file system */ 28157770Smargo u_long segment; /* segment number */ 28257770Smargo }; 28351882Sbostic int 28451882Sbostic lfs_segclean(p, uap, retval) 28551882Sbostic struct proc *p; 28657770Smargo struct lfs_segclean_args *uap; 28751882Sbostic int *retval; 28851882Sbostic { 28951928Sbostic CLEANERINFO *cip; 29051882Sbostic SEGUSE *sup; 29151882Sbostic struct buf *bp; 29251882Sbostic struct mount *mntp; 29351882Sbostic struct lfs *fs; 29451882Sbostic int error; 29551882Sbostic 29651882Sbostic if (error = suser(p->p_ucred, &p->p_acflag)) 29751882Sbostic return (error); 29851882Sbostic if ((mntp = getvfs(&uap->fsid)) == NULL) 29951882Sbostic return (EINVAL); 30051882Sbostic 30151882Sbostic fs = VFSTOUFS(mntp)->um_lfs; 30251928Sbostic 30356369Smargo if (datosn(fs, fs->lfs_curseg) == uap->segment) 30456369Smargo return (EBUSY); 30556369Smargo 30651882Sbostic LFS_SEGENTRY(sup, fs, uap->segment, bp); 30756369Smargo if (sup->su_flags & SEGUSE_ACTIVE) { 30856369Smargo brelse(bp); 30956369Smargo return(EBUSY); 31056369Smargo } 31155941Sbostic fs->lfs_avail += fsbtodb(fs, fs->lfs_ssize) - 1; 31255593Sbostic fs->lfs_bfree += (sup->su_nsums * LFS_SUMMARY_SIZE / DEV_BSIZE) + 31355593Sbostic sup->su_ninos * btodb(fs->lfs_bsize); 31451882Sbostic sup->su_flags &= ~SEGUSE_DIRTY; 31555941Sbostic (void) VOP_BWRITE(bp); 31651928Sbostic 31751928Sbostic LFS_CLEANERINFO(cip, fs, bp); 31851928Sbostic ++cip->clean; 31951928Sbostic --cip->dirty; 32055941Sbostic (void) VOP_BWRITE(bp); 32155941Sbostic wakeup(&fs->lfs_avail); 32251882Sbostic return (0); 32351882Sbostic } 32451882Sbostic 32551882Sbostic /* 32651882Sbostic * lfs_segwait: 32751882Sbostic * 32851882Sbostic * This will block until a segment in file system fsid is written. A timeout 32951882Sbostic * in milliseconds may be specified which will awake the cleaner automatically. 33051882Sbostic * An fsid of -1 means any file system, and a timeout of 0 means forever. 33151882Sbostic * 33251882Sbostic * 0 on success 33351882Sbostic * 1 on timeout 33451882Sbostic * -1/errno is return on error. 33551882Sbostic */ 33657770Smargo struct lfs_segwait_args { 33757770Smargo fsid_t fsid; /* file system */ 33857770Smargo struct timeval *tv; /* timeout */ 33957770Smargo }; 34051882Sbostic int 34151882Sbostic lfs_segwait(p, uap, retval) 34251882Sbostic struct proc *p; 34357770Smargo struct lfs_segwait_args *uap; 34451882Sbostic int *retval; 34551882Sbostic { 34651882Sbostic extern int lfs_allclean_wakeup; 34751882Sbostic struct mount *mntp; 34851882Sbostic struct timeval atv; 34951882Sbostic void *addr; 35051882Sbostic u_long timeout; 35151882Sbostic int error, s; 35251882Sbostic 35355941Sbostic if (error = suser(p->p_ucred, &p->p_acflag)) { 35451882Sbostic return (error); 35555941Sbostic } 35651882Sbostic #ifdef WHEN_QUADS_WORK 35751882Sbostic if (uap->fsid == (fsid_t)-1) 35851882Sbostic addr = &lfs_allclean_wakeup; 35951882Sbostic else { 36051882Sbostic if ((mntp = getvfs(&uap->fsid)) == NULL) 36151882Sbostic return (EINVAL); 36251882Sbostic addr = &VFSTOUFS(mntp)->um_lfs->lfs_nextseg; 36351882Sbostic } 36451882Sbostic #else 36551882Sbostic if ((mntp = getvfs(&uap->fsid)) == NULL) 36651882Sbostic addr = &lfs_allclean_wakeup; 36751882Sbostic else 36851882Sbostic addr = &VFSTOUFS(mntp)->um_lfs->lfs_nextseg; 36951882Sbostic #endif 37051882Sbostic 37151882Sbostic if (uap->tv) { 37251882Sbostic if (error = copyin(uap->tv, &atv, sizeof(struct timeval))) 37351882Sbostic return (error); 37451882Sbostic if (itimerfix(&atv)) 37551882Sbostic return (EINVAL); 37654764Smckusick s = splclock(); 37754764Smckusick timevaladd(&atv, (struct timeval *)&time); 37851882Sbostic timeout = hzto(&atv); 37954277Sbostic splx(s); 38051882Sbostic } else 38151882Sbostic timeout = 0; 38251882Sbostic 38351882Sbostic error = tsleep(addr, PCATCH | PUSER, "segment", timeout); 38451882Sbostic return (error == ERESTART ? EINTR : 0); 38551882Sbostic } 38655941Sbostic 38755941Sbostic /* 38855941Sbostic * VFS_VGET call specialized for the cleaner. The cleaner already knows the 38955941Sbostic * daddr from the ifile, so don't look it up again. If the cleaner is 39055941Sbostic * processing IINFO structures, it may have the ondisk inode already, so 39155941Sbostic * don't go retrieving it again. 39255941Sbostic */ 39355941Sbostic int 39455941Sbostic lfs_fastvget(mp, ino, daddr, vpp, dinp) 39555941Sbostic struct mount *mp; 39655941Sbostic ino_t ino; 39755941Sbostic daddr_t daddr; 39855941Sbostic struct vnode **vpp; 39955941Sbostic struct dinode *dinp; 40055941Sbostic { 40155941Sbostic register struct inode *ip; 40255941Sbostic struct vnode *vp; 40355941Sbostic struct ufsmount *ump; 40455941Sbostic struct buf *bp; 40555941Sbostic dev_t dev; 40655941Sbostic int error; 40755941Sbostic 40855941Sbostic ump = VFSTOUFS(mp); 40955941Sbostic dev = ump->um_dev; 41057073Smargo /* 41157073Smargo * This is playing fast and loose. Someone may have the inode 41257073Smargo * locked, in which case they are going to be distinctly unhappy 41357073Smargo * if we trash something. 41457073Smargo */ 41557073Smargo if ((*vpp = ufs_ihashlookup(dev, ino)) != NULL) { 41657073Smargo lfs_vref(*vpp); 41757073Smargo if ((*vpp)->v_flag & VXLOCK) 41857073Smargo printf ("Cleaned vnode VXLOCKED\n"); 41956191Smargo ip = VTOI(*vpp); 42057073Smargo if (ip->i_flags & ILOCKED) 42157073Smargo printf ("Cleaned vnode ILOCKED\n"); 42256369Smargo if (!(ip->i_flag & IMOD)) { 42356369Smargo ++ump->um_lfs->lfs_uinodes; 42456369Smargo ip->i_flag |= IMOD; 42556369Smargo } 42656191Smargo ip->i_flag |= IMOD; 42755941Sbostic return (0); 42856191Smargo } 42955941Sbostic 43055941Sbostic /* Allocate new vnode/inode. */ 43155941Sbostic if (error = lfs_vcreate(mp, ino, &vp)) { 43255941Sbostic *vpp = NULL; 43355941Sbostic return (error); 43455941Sbostic } 43555941Sbostic 43655941Sbostic /* 43755941Sbostic * Put it onto its hash chain and lock it so that other requests for 43855941Sbostic * this inode will block if they arrive while we are sleeping waiting 43955941Sbostic * for old data structures to be purged or for the contents of the 44055941Sbostic * disk portion of this inode to be read. 44155941Sbostic */ 44255941Sbostic ip = VTOI(vp); 44355941Sbostic ufs_ihashins(ip); 44455941Sbostic 44555941Sbostic /* 44655941Sbostic * XXX 44755941Sbostic * This may not need to be here, logically it should go down with 44855941Sbostic * the i_devvp initialization. 44955941Sbostic * Ask Kirk. 45055941Sbostic */ 45155941Sbostic ip->i_lfs = ump->um_lfs; 45255941Sbostic 45355941Sbostic /* Read in the disk contents for the inode, copy into the inode. */ 45455941Sbostic if (dinp) 45555941Sbostic if (error = copyin(dinp, &ip->i_din, sizeof(struct dinode))) 45655941Sbostic return (error); 45755941Sbostic else { 45855941Sbostic if (error = bread(ump->um_devvp, daddr, 45955941Sbostic (int)ump->um_lfs->lfs_bsize, NOCRED, &bp)) { 46055941Sbostic /* 46155941Sbostic * The inode does not contain anything useful, so it 46255941Sbostic * would be misleading to leave it on its hash chain. 46355941Sbostic * Iput() will return it to the free list. 46455941Sbostic */ 46555941Sbostic ufs_ihashrem(ip); 46655941Sbostic 46755941Sbostic /* Unlock and discard unneeded inode. */ 46857073Smargo lfs_vunref(vp); 46955941Sbostic brelse(bp); 47055941Sbostic *vpp = NULL; 47155941Sbostic return (error); 47255941Sbostic } 47355941Sbostic ip->i_din = *lfs_ifind(ump->um_lfs, ino, bp->b_un.b_dino); 47455941Sbostic brelse(bp); 47555941Sbostic } 47655941Sbostic 47756054Sbostic /* Inode was just read from user space or disk, make sure it's locked */ 47856054Sbostic ip->i_flag |= ILOCKED; 47956054Sbostic 48055941Sbostic /* 48155941Sbostic * Initialize the vnode from the inode, check for aliases. In all 48255941Sbostic * cases re-init ip, the underlying vnode/inode may have changed. 48355941Sbostic */ 48455941Sbostic if (error = ufs_vinit(mp, lfs_specop_p, LFS_FIFOOPS, &vp)) { 48557073Smargo lfs_vunref(vp); 48655941Sbostic *vpp = NULL; 48755941Sbostic return (error); 48855941Sbostic } 48955941Sbostic /* 49055941Sbostic * Finish inode initialization now that aliasing has been resolved. 49155941Sbostic */ 49255941Sbostic ip->i_devvp = ump->um_devvp; 49355941Sbostic ip->i_flag |= IMOD; 49455941Sbostic ++ump->um_lfs->lfs_uinodes; 49555941Sbostic VREF(ip->i_devvp); 49655941Sbostic *vpp = vp; 49755941Sbostic return (0); 49855941Sbostic } 49955941Sbostic struct buf * 50055941Sbostic lfs_fakebuf(vp, lbn, size, uaddr) 50155941Sbostic struct vnode *vp; 50255941Sbostic int lbn; 50355941Sbostic size_t size; 50455941Sbostic caddr_t uaddr; 50555941Sbostic { 50655941Sbostic struct buf *bp; 50755941Sbostic 50855941Sbostic bp = lfs_newbuf(vp, lbn, 0); 50955941Sbostic bp->b_saveaddr = uaddr; 51055941Sbostic bp->b_bufsize = size; 51155941Sbostic bp->b_bcount = size; 51255941Sbostic bp->b_flags |= B_INVAL; 51355941Sbostic return(bp); 51455941Sbostic } 515