int ffs_reload_vnode(struct vnode *vp, void *args) { struct ffs_reload_args *fra = args; struct inode *ip; struct buf *bp; int error; /* * Step 4: invalidate all inactive vnodes. */ if (vp->v_usecount == 0) { vgonel(vp, fra->p); return (0); } /* * Step 5: invalidate all cached file data. */ if (vget(vp, LK_EXCLUSIVE, fra->p)) return (0); if (vinvalbuf(vp, 0, fra->cred, fra->p, 0, 0)) panic("ffs_reload: dirty2"); /* * Step 6: re-read inode data for all active vnodes. */ ip = VTOI(vp); error = bread(fra->devvp, fsbtodb(fra->fs, ino_to_fsba(fra->fs, ip->i_number)), (int)fra->fs->fs_bsize, NOCRED, &bp); if (error) { brelse(bp); vput(vp); return (error); } *ip->i_din1 = *((struct ufs1_dinode *)bp->b_data + ino_to_fsbo(fra->fs, ip->i_number)); ip->i_effnlink = DIP(ip, nlink); brelse(bp); vput(vp); return (0); }
int ext2fs_reload_vnode(struct vnode *vp, void *args) { struct ext2fs_reload_args *era = args; struct buf *bp; struct inode *ip; int error; caddr_t cp; /* * Step 4: invalidate all inactive vnodes. */ if (vp->v_usecount == 0) { vgonel(vp, era->p); return (0); } /* * Step 5: invalidate all cached file data. */ if (vget(vp, LK_EXCLUSIVE, era->p)) return (0); if (vinvalbuf(vp, 0, era->cred, era->p, 0, 0)) panic("ext2fs_reload: dirty2"); /* * Step 6: re-read inode data for all active vnodes. */ ip = VTOI(vp); error = bread(era->devvp, fsbtodb(era->fs, ino_to_fsba(era->fs, ip->i_number)), (int)era->fs->e2fs_bsize, &bp); if (error) { vput(vp); return (error); } cp = (caddr_t)bp->b_data + (ino_to_fsbo(era->fs, ip->i_number) * EXT2_DINODE_SIZE(era->fs)); e2fs_iload((struct ext2fs_dinode *)cp, ip->i_e2din); brelse(bp); vput(vp); return (0); }
/* Try to discard pages, in order to recycle a vcache entry. * * We also make some sanity checks: ref count, open count, held locks. * * We also do some non-VM-related chores, such as releasing the cred pointer * (for AIX and Solaris) and releasing the gnode (for AIX). * * Locking: afs_xvcache lock is held. If it is dropped and re-acquired, * *slept should be set to warn the caller. * * Formerly, afs_xvcache was dropped and re-acquired for Solaris, but now it * is not dropped and re-acquired for any platform. It may be that *slept is * therefore obsolescent. * * OSF/1 Locking: VN_LOCK has been called. * We do not lock the vnode here, but instead require that it be exclusive * locked by code calling osi_VM_StoreAllSegments directly, or scheduling it * from the bqueue - Matt * Maybe better to just call vnode_pager_setsize()? */ int osi_VM_FlushVCache(struct vcache *avc, int *slept) { struct vm_object *obj; struct vnode *vp; if (VREFCOUNT(avc) > 1) return EBUSY; if (avc->opens) return EBUSY; /* if a lock is held, give up */ if (CheckLock(&avc->lock)) return EBUSY; return(0); AFS_GUNLOCK(); vp = AFSTOV(avc); #ifndef AFS_FBSD70_ENV lock_vnode(vp); #endif if (VOP_GETVOBJECT(vp, &obj) == 0) { VM_OBJECT_LOCK(obj); vm_object_page_remove(obj, 0, 0, FALSE); #if 1 if (obj->ref_count == 0) { simple_lock(&vp->v_interlock); vgonel(vp, curthread); vp->v_tag = VT_AFS; SetAfsVnode(vp); } #endif VM_OBJECT_UNLOCK(obj); } #ifndef AFS_FBSD70_ENV unlock_vnode(vp); #endif AFS_GLOCK(); return 0; }