151882Sbostic /*- 251882Sbostic * Copyright (c) 1991 The Regents of the University of California. 351882Sbostic * All rights reserved. 451882Sbostic * 551882Sbostic * %sccs.include.redist.c% 651882Sbostic * 7*56479Smargo * @(#)lfs_syscalls.c 7.25 (Berkeley) 10/08/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> 25*56479Smargo #define BUMP_FIP(SP) \ 26*56479Smargo (SP)->fip = (FINFO *) (&(SP)->fip->fi_blocks[(SP)->fip->fi_nblocks]) 2751882Sbostic 28*56479Smargo #define INC_FINFO(SP) ++((SEGSUM *)((SP)->segsum))->ss_nfinfo 29*56479Smargo #define DEC_FINFO(SP) --((SEGSUM *)((SP)->segsum))->ss_nfinfo 30*56479Smargo 31*56479Smargo /* 32*56479Smargo * Before committing to add something to a segment summary, make sure there 33*56479Smargo * is enough room. S is the bytes added to the summary. 34*56479Smargo */ 35*56479Smargo #define CHECK_SEG(s) \ 36*56479Smargo if (sp->sum_bytes_left < (s)) { \ 37*56479Smargo (void) lfs_writeseg(fs, sp); \ 38*56479Smargo lfs_initseg(fs, sp); \ 39*56479Smargo } 4055941Sbostic struct buf *lfs_fakebuf __P((struct vnode *, int, size_t, caddr_t)); 4155941Sbostic 4251882Sbostic /* 4351882Sbostic * lfs_markv: 4451882Sbostic * 4551882Sbostic * This will mark inodes and blocks dirty, so they are written into the log. 4651882Sbostic * It will block until all the blocks have been written. The segment create 4751882Sbostic * time passed in the block_info and inode_info structures is used to decide 4851882Sbostic * if the data is valid for each block (in case some process dirtied a block 4951882Sbostic * or inode that is being cleaned between the determination that a block is 5051882Sbostic * live and the lfs_markv call). 5151882Sbostic * 5251882Sbostic * 0 on success 5351882Sbostic * -1/errno is return on error. 5451882Sbostic */ 5551882Sbostic int 5651882Sbostic lfs_markv(p, uap, retval) 5751882Sbostic struct proc *p; 5851882Sbostic struct args { 5951882Sbostic fsid_t fsid; /* file system */ 6051882Sbostic BLOCK_INFO *blkiov; /* block array */ 6151882Sbostic int blkcnt; /* count of block array entries */ 6251882Sbostic } *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); 8355941Sbostic /* Initialize a segment. */ 8455941Sbostic sp = malloc(sizeof(struct segment), M_SEGMENT, M_WAITOK); 8555941Sbostic sp->bpp = malloc(((LFS_SUMMARY_SIZE - sizeof(SEGSUM)) / 8655941Sbostic sizeof(daddr_t) + 1) * sizeof(struct buf *), M_SEGMENT, M_WAITOK); 8755941Sbostic sp->seg_flags = SEGM_CKP; 8856029Sbostic sp->vp = NULL; 8951882Sbostic 9051882Sbostic cnt = uap->blkcnt; 9152996Sbostic start = malloc(cnt * sizeof(BLOCK_INFO), M_SEGMENT, M_WAITOK); 9255941Sbostic if (error = copyin(uap->blkiov, start, cnt * sizeof(BLOCK_INFO))) 9355941Sbostic goto err1; 9451882Sbostic 9555941Sbostic /* Mark blocks/inodes dirty. */ 9652087Sbostic fs = VFSTOUFS(mntp)->um_lfs; 9752820Sbostic bsize = fs->lfs_bsize; 9855941Sbostic error = 0; 9955941Sbostic 10055941Sbostic lfs_seglock(fs); 10155941Sbostic lfs_initseg(fs, sp); 10255941Sbostic sp->seg_flags |= SEGM_CLEAN; 10355941Sbostic for (v_daddr = LFS_UNUSED_DADDR, lastino = LFS_UNUSED_INUM, 10455941Sbostic blkp = start; cnt--; ++blkp) { 10552087Sbostic /* 10652087Sbostic * Get the IFILE entry (only once) and see if the file still 10752087Sbostic * exists. 10852087Sbostic */ 10952087Sbostic if (lastino != blkp->bi_inode) { 11055941Sbostic if (lastino != LFS_UNUSED_INUM) { 111*56479Smargo /* Finish up last file */ 11256029Sbostic lfs_updatemeta(sp); 11355941Sbostic lfs_writeinode(fs, sp, ip); 11455941Sbostic vput(vp); 115*56479Smargo if (sp->fip->fi_nblocks) 116*56479Smargo BUMP_FIP(sp); 117*56479Smargo else { 118*56479Smargo DEC_FINFO(sp); 119*56479Smargo sp->sum_bytes_left += 120*56479Smargo sizeof(FINFO) - sizeof(daddr_t); 121*56479Smargo 12256191Smargo } 12355941Sbostic } 124*56479Smargo 125*56479Smargo /* Start a new file */ 126*56479Smargo CHECK_SEG(sizeof(FINFO)); 127*56479Smargo sp->sum_bytes_left -= sizeof(FINFO) - sizeof(daddr_t); 128*56479Smargo INC_FINFO(sp); 129*56479Smargo sp->start_lbp = &sp->fip->fi_blocks[0]; 130*56479Smargo sp->vp = NULL; 13156369Smargo sp->fip->fi_version = blkp->bi_version; 13256369Smargo sp->fip->fi_nblocks = 0; 13356369Smargo sp->fip->fi_ino = blkp->bi_inode; 13452087Sbostic lastino = blkp->bi_inode; 13556161Sbostic if (blkp->bi_inode == LFS_IFILE_INUM) 13656161Sbostic v_daddr = fs->lfs_idaddr; 13756161Sbostic else { 13856161Sbostic LFS_IENTRY(ifp, fs, blkp->bi_inode, bp); 13956161Sbostic v_daddr = ifp->if_daddr; 14056161Sbostic brelse(bp); 14156161Sbostic } 14255941Sbostic if (v_daddr == LFS_UNUSED_DADDR) 14352087Sbostic continue; 144*56479Smargo 14555941Sbostic /* Get the vnode/inode. */ 14655941Sbostic if (lfs_fastvget(mntp, blkp->bi_inode, v_daddr, &vp, 14756369Smargo blkp->bi_lbn == LFS_UNUSED_LBN ? 14856369Smargo blkp->bi_bp : NULL)) { 14955941Sbostic #ifdef DIAGNOSTIC 15055941Sbostic printf("lfs_markv: VFS_VGET failed (%d)\n", 15155941Sbostic blkp->bi_inode); 15255941Sbostic #endif 15356029Sbostic lastino = LFS_UNUSED_INUM; 154*56479Smargo v_daddr = LFS_UNUSED_DADDR; 15555941Sbostic continue; 15655941Sbostic } 15756029Sbostic sp->vp = vp; 15855941Sbostic ip = VTOI(vp); 15955941Sbostic } else if (v_daddr == LFS_UNUSED_DADDR) 16055941Sbostic continue; 16152087Sbostic 16255941Sbostic /* If this BLOCK_INFO didn't contain a block, keep going. */ 16355941Sbostic if (blkp->bi_lbn == LFS_UNUSED_LBN) 16451882Sbostic continue; 165*56479Smargo if (VOP_BMAP(vp, blkp->bi_lbn, NULL, &b_daddr, NULL) || 16656161Sbostic b_daddr != blkp->bi_daddr) 16752173Sbostic continue; 16855941Sbostic /* 16955941Sbostic * If we got to here, then we are keeping the block. If it 17055941Sbostic * is an indirect block, we want to actually put it in the 17155941Sbostic * buffer cache so that it can be updated in the finish_meta 17255941Sbostic * section. If it's not, we need to allocate a fake buffer 17355941Sbostic * so that writeseg can perform the copyin and write the buffer. 17455941Sbostic */ 17555941Sbostic if (blkp->bi_lbn >= 0) /* Data Block */ 17655941Sbostic bp = lfs_fakebuf(vp, blkp->bi_lbn, bsize, 17755941Sbostic blkp->bi_bp); 17855941Sbostic else { 17955941Sbostic bp = getblk(vp, blkp->bi_lbn, bsize); 18055941Sbostic if (!(bp->b_flags & B_CACHE) && 18155941Sbostic (error = copyin(blkp->bi_bp, bp->b_un.b_addr, 18255941Sbostic bsize))) 18355941Sbostic goto err2; 18455941Sbostic if (error = VOP_BWRITE(bp)) 18555941Sbostic goto err2; 18652087Sbostic } 18756029Sbostic while (lfs_gatherblock(sp, bp, NULL)); 18851882Sbostic } 18956029Sbostic if (sp->vp) { 19056029Sbostic lfs_updatemeta(sp); 19156029Sbostic lfs_writeinode(fs, sp, ip); 19256029Sbostic vput(vp); 193*56479Smargo if (!sp->fip->fi_nblocks) { 194*56479Smargo DEC_FINFO(sp); 195*56479Smargo sp->sum_bytes_left += sizeof(FINFO) - sizeof(daddr_t); 196*56479Smargo } 19756029Sbostic } 19855941Sbostic (void) lfs_writeseg(fs, sp); 19955941Sbostic lfs_segunlock(fs); 20052173Sbostic free(start, M_SEGMENT); 20155941Sbostic free(sp->bpp, M_SEGMENT); 20255941Sbostic free(sp, M_SEGMENT); 20355941Sbostic return (error); 20455941Sbostic /* 20555941Sbostic * XXX If we come in to error 2, we might have indirect blocks that were 20655941Sbostic * updated and now have bad block pointers. I don't know what to do 20755941Sbostic * about this. 20855941Sbostic */ 20951882Sbostic 21055941Sbostic err2: vput(vp); 21155941Sbostic /* Free up fakebuffers */ 21255941Sbostic for (bpp = --sp->cbpp; bpp >= sp->bpp; --bpp) 21355941Sbostic if ((*bpp)->b_flags & B_CALL) { 21455941Sbostic brelvp(*bpp); 21555941Sbostic free(*bpp, M_SEGMENT); 21655941Sbostic } else 21755941Sbostic brelse(*bpp); 21855941Sbostic lfs_segunlock(fs); 21955941Sbostic err1: 22055941Sbostic free(sp->bpp, M_SEGMENT); 22155941Sbostic free(sp, M_SEGMENT); 22252173Sbostic free(start, M_SEGMENT); 22355941Sbostic return(error); 22451882Sbostic } 22551882Sbostic 22651882Sbostic /* 22751882Sbostic * lfs_bmapv: 22851882Sbostic * 22952087Sbostic * This will fill in the current disk address for arrays of blocks. 23051882Sbostic * 23151882Sbostic * 0 on success 23251882Sbostic * -1/errno is return on error. 23351882Sbostic */ 23451882Sbostic int 23551882Sbostic lfs_bmapv(p, uap, retval) 23651882Sbostic struct proc *p; 23751882Sbostic struct args { 23851882Sbostic fsid_t fsid; /* file system */ 23951882Sbostic BLOCK_INFO *blkiov; /* block array */ 24051882Sbostic int blkcnt; /* count of block array entries */ 24151882Sbostic } *uap; 24251882Sbostic int *retval; 24351882Sbostic { 24451882Sbostic BLOCK_INFO *blkp; 24551882Sbostic struct mount *mntp; 24651882Sbostic struct vnode *vp; 24752173Sbostic void *start; 24851882Sbostic daddr_t daddr; 24952173Sbostic int cnt, error, step; 25051882Sbostic 25151882Sbostic if (error = suser(p->p_ucred, &p->p_acflag)) 25251882Sbostic return (error); 25351882Sbostic if ((mntp = getvfs(&uap->fsid)) == NULL) 25451882Sbostic return (EINVAL); 25551882Sbostic 25651882Sbostic cnt = uap->blkcnt; 25752173Sbostic start = blkp = malloc(cnt * sizeof(BLOCK_INFO), M_SEGMENT, M_WAITOK); 25851882Sbostic if (error = copyin(uap->blkiov, blkp, cnt * sizeof(BLOCK_INFO))) { 25951882Sbostic free(blkp, M_SEGMENT); 26051882Sbostic return (error); 26151882Sbostic } 26251882Sbostic 26352173Sbostic for (step = cnt; step--; ++blkp) { 26456161Sbostic if (blkp->bi_lbn == LFS_UNUSED_LBN) 26556161Sbostic continue; 26654662Smckusick if (VFS_VGET(mntp, blkp->bi_inode, &vp)) 26752173Sbostic daddr = LFS_UNUSED_DADDR; 26852173Sbostic else { 269*56479Smargo if (VOP_BMAP(vp, blkp->bi_lbn, NULL, &daddr, NULL)) 27052173Sbostic daddr = LFS_UNUSED_DADDR; 27152173Sbostic vput(vp); 27252173Sbostic } 27352173Sbostic blkp->bi_daddr = daddr; 27452173Sbostic } 27552173Sbostic copyout(start, uap->blkiov, cnt * sizeof(BLOCK_INFO)); 27652173Sbostic free(start, M_SEGMENT); 27751882Sbostic return (0); 27851882Sbostic } 27951882Sbostic 28051882Sbostic /* 28151882Sbostic * lfs_segclean: 28251882Sbostic * 28351882Sbostic * Mark the segment clean. 28451882Sbostic * 28551882Sbostic * 0 on success 28651882Sbostic * -1/errno is return on error. 28751882Sbostic */ 28851882Sbostic int 28951882Sbostic lfs_segclean(p, uap, retval) 29051882Sbostic struct proc *p; 29151882Sbostic struct args { 29251882Sbostic fsid_t fsid; /* file system */ 29351882Sbostic u_long segment; /* segment number */ 29451882Sbostic } *uap; 29551882Sbostic int *retval; 29651882Sbostic { 29751928Sbostic CLEANERINFO *cip; 29851882Sbostic SEGUSE *sup; 29951882Sbostic struct buf *bp; 30051882Sbostic struct mount *mntp; 30151882Sbostic struct lfs *fs; 30251882Sbostic int error; 30351882Sbostic 30451882Sbostic if (error = suser(p->p_ucred, &p->p_acflag)) 30551882Sbostic return (error); 30651882Sbostic if ((mntp = getvfs(&uap->fsid)) == NULL) 30751882Sbostic return (EINVAL); 30851882Sbostic 30951882Sbostic fs = VFSTOUFS(mntp)->um_lfs; 31051928Sbostic 31156369Smargo if (datosn(fs, fs->lfs_curseg) == uap->segment) 31256369Smargo return (EBUSY); 31356369Smargo 31451882Sbostic LFS_SEGENTRY(sup, fs, uap->segment, bp); 31556369Smargo if (sup->su_flags & SEGUSE_ACTIVE) { 31656369Smargo brelse(bp); 31756369Smargo return(EBUSY); 31856369Smargo } 31955941Sbostic fs->lfs_avail += fsbtodb(fs, fs->lfs_ssize) - 1; 32055593Sbostic fs->lfs_bfree += (sup->su_nsums * LFS_SUMMARY_SIZE / DEV_BSIZE) + 32155593Sbostic sup->su_ninos * btodb(fs->lfs_bsize); 32251882Sbostic sup->su_flags &= ~SEGUSE_DIRTY; 32355941Sbostic (void) VOP_BWRITE(bp); 32451928Sbostic 32551928Sbostic LFS_CLEANERINFO(cip, fs, bp); 32651928Sbostic ++cip->clean; 32751928Sbostic --cip->dirty; 32855941Sbostic (void) VOP_BWRITE(bp); 32955941Sbostic wakeup(&fs->lfs_avail); 33051882Sbostic return (0); 33151882Sbostic } 33251882Sbostic 33351882Sbostic /* 33451882Sbostic * lfs_segwait: 33551882Sbostic * 33651882Sbostic * This will block until a segment in file system fsid is written. A timeout 33751882Sbostic * in milliseconds may be specified which will awake the cleaner automatically. 33851882Sbostic * An fsid of -1 means any file system, and a timeout of 0 means forever. 33951882Sbostic * 34051882Sbostic * 0 on success 34151882Sbostic * 1 on timeout 34251882Sbostic * -1/errno is return on error. 34351882Sbostic */ 34451882Sbostic int 34551882Sbostic lfs_segwait(p, uap, retval) 34651882Sbostic struct proc *p; 34751882Sbostic struct args { 34851882Sbostic fsid_t fsid; /* file system */ 34951882Sbostic struct timeval *tv; /* timeout */ 35051882Sbostic } *uap; 35151882Sbostic int *retval; 35251882Sbostic { 35351882Sbostic extern int lfs_allclean_wakeup; 35451882Sbostic struct mount *mntp; 35551882Sbostic struct timeval atv; 35651882Sbostic void *addr; 35751882Sbostic u_long timeout; 35851882Sbostic int error, s; 35951882Sbostic 36055941Sbostic if (error = suser(p->p_ucred, &p->p_acflag)) { 36151882Sbostic return (error); 36255941Sbostic } 36351882Sbostic #ifdef WHEN_QUADS_WORK 36451882Sbostic if (uap->fsid == (fsid_t)-1) 36551882Sbostic addr = &lfs_allclean_wakeup; 36651882Sbostic else { 36751882Sbostic if ((mntp = getvfs(&uap->fsid)) == NULL) 36851882Sbostic return (EINVAL); 36951882Sbostic addr = &VFSTOUFS(mntp)->um_lfs->lfs_nextseg; 37051882Sbostic } 37151882Sbostic #else 37251882Sbostic if ((mntp = getvfs(&uap->fsid)) == NULL) 37351882Sbostic addr = &lfs_allclean_wakeup; 37451882Sbostic else 37551882Sbostic addr = &VFSTOUFS(mntp)->um_lfs->lfs_nextseg; 37651882Sbostic #endif 37751882Sbostic 37851882Sbostic if (uap->tv) { 37951882Sbostic if (error = copyin(uap->tv, &atv, sizeof(struct timeval))) 38051882Sbostic return (error); 38151882Sbostic if (itimerfix(&atv)) 38251882Sbostic return (EINVAL); 38354764Smckusick s = splclock(); 38454764Smckusick timevaladd(&atv, (struct timeval *)&time); 38551882Sbostic timeout = hzto(&atv); 38654277Sbostic splx(s); 38751882Sbostic } else 38851882Sbostic timeout = 0; 38951882Sbostic 39051882Sbostic error = tsleep(addr, PCATCH | PUSER, "segment", timeout); 39151882Sbostic return (error == ERESTART ? EINTR : 0); 39251882Sbostic } 39355941Sbostic 39455941Sbostic /* 39555941Sbostic * VFS_VGET call specialized for the cleaner. The cleaner already knows the 39655941Sbostic * daddr from the ifile, so don't look it up again. If the cleaner is 39755941Sbostic * processing IINFO structures, it may have the ondisk inode already, so 39855941Sbostic * don't go retrieving it again. 39955941Sbostic */ 40055941Sbostic int 40155941Sbostic lfs_fastvget(mp, ino, daddr, vpp, dinp) 40255941Sbostic struct mount *mp; 40355941Sbostic ino_t ino; 40455941Sbostic daddr_t daddr; 40555941Sbostic struct vnode **vpp; 40655941Sbostic struct dinode *dinp; 40755941Sbostic { 40855941Sbostic register struct inode *ip; 40955941Sbostic struct vnode *vp; 41055941Sbostic struct ufsmount *ump; 41155941Sbostic struct buf *bp; 41255941Sbostic dev_t dev; 41355941Sbostic int error; 41455941Sbostic 41555941Sbostic ump = VFSTOUFS(mp); 41655941Sbostic dev = ump->um_dev; 41756191Smargo if ((*vpp = ufs_ihashget(dev, ino)) != NULL) { 41856191Smargo ip = VTOI(*vpp); 41956369Smargo if (!(ip->i_flag & IMOD)) { 42056369Smargo ++ump->um_lfs->lfs_uinodes; 42156369Smargo ip->i_flag |= IMOD; 42256369Smargo } 42356191Smargo ip->i_flag |= IMOD; 42455941Sbostic return (0); 42556191Smargo } 42655941Sbostic 42755941Sbostic /* Allocate new vnode/inode. */ 42855941Sbostic if (error = lfs_vcreate(mp, ino, &vp)) { 42955941Sbostic *vpp = NULL; 43055941Sbostic return (error); 43155941Sbostic } 43255941Sbostic 43355941Sbostic /* 43455941Sbostic * Put it onto its hash chain and lock it so that other requests for 43555941Sbostic * this inode will block if they arrive while we are sleeping waiting 43655941Sbostic * for old data structures to be purged or for the contents of the 43755941Sbostic * disk portion of this inode to be read. 43855941Sbostic */ 43955941Sbostic ip = VTOI(vp); 44055941Sbostic ufs_ihashins(ip); 44155941Sbostic 44255941Sbostic /* 44355941Sbostic * XXX 44455941Sbostic * This may not need to be here, logically it should go down with 44555941Sbostic * the i_devvp initialization. 44655941Sbostic * Ask Kirk. 44755941Sbostic */ 44855941Sbostic ip->i_lfs = ump->um_lfs; 44955941Sbostic 45055941Sbostic /* Read in the disk contents for the inode, copy into the inode. */ 45155941Sbostic if (dinp) 45255941Sbostic if (error = copyin(dinp, &ip->i_din, sizeof(struct dinode))) 45355941Sbostic return (error); 45455941Sbostic else { 45555941Sbostic if (error = bread(ump->um_devvp, daddr, 45655941Sbostic (int)ump->um_lfs->lfs_bsize, NOCRED, &bp)) { 45755941Sbostic /* 45855941Sbostic * The inode does not contain anything useful, so it 45955941Sbostic * would be misleading to leave it on its hash chain. 46055941Sbostic * Iput() will return it to the free list. 46155941Sbostic */ 46255941Sbostic ufs_ihashrem(ip); 46355941Sbostic 46455941Sbostic /* Unlock and discard unneeded inode. */ 46555941Sbostic ufs_iput(ip); 46655941Sbostic brelse(bp); 46755941Sbostic *vpp = NULL; 46855941Sbostic return (error); 46955941Sbostic } 47055941Sbostic ip->i_din = *lfs_ifind(ump->um_lfs, ino, bp->b_un.b_dino); 47155941Sbostic brelse(bp); 47255941Sbostic } 47355941Sbostic 47456054Sbostic /* Inode was just read from user space or disk, make sure it's locked */ 47556054Sbostic ip->i_flag |= ILOCKED; 47656054Sbostic 47755941Sbostic /* 47855941Sbostic * Initialize the vnode from the inode, check for aliases. In all 47955941Sbostic * cases re-init ip, the underlying vnode/inode may have changed. 48055941Sbostic */ 48155941Sbostic if (error = ufs_vinit(mp, lfs_specop_p, LFS_FIFOOPS, &vp)) { 48255941Sbostic ufs_iput(ip); 48355941Sbostic *vpp = NULL; 48455941Sbostic return (error); 48555941Sbostic } 48655941Sbostic /* 48755941Sbostic * Finish inode initialization now that aliasing has been resolved. 48855941Sbostic */ 48955941Sbostic ip->i_devvp = ump->um_devvp; 49055941Sbostic ip->i_flag |= IMOD; 49155941Sbostic ++ump->um_lfs->lfs_uinodes; 49255941Sbostic VREF(ip->i_devvp); 49355941Sbostic *vpp = vp; 49455941Sbostic return (0); 49555941Sbostic } 49655941Sbostic struct buf * 49755941Sbostic lfs_fakebuf(vp, lbn, size, uaddr) 49855941Sbostic struct vnode *vp; 49955941Sbostic int lbn; 50055941Sbostic size_t size; 50155941Sbostic caddr_t uaddr; 50255941Sbostic { 50355941Sbostic struct buf *bp; 50455941Sbostic 50555941Sbostic bp = lfs_newbuf(vp, lbn, 0); 50655941Sbostic bp->b_saveaddr = uaddr; 50755941Sbostic bp->b_bufsize = size; 50855941Sbostic bp->b_bcount = size; 50955941Sbostic bp->b_flags |= B_INVAL; 51055941Sbostic return(bp); 51155941Sbostic } 512