Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/tmpfs/tmpfs_vfsops.c
Show First 20 Lines • Show All 114 Lines • ▼ Show 20 Lines | tmpfs_update_mtime(struct mount *mp, bool lazy) | ||||
if (VFS_TO_TMPFS(mp)->tm_nomtime) | if (VFS_TO_TMPFS(mp)->tm_nomtime) | ||||
return; | return; | ||||
MNT_VNODE_FOREACH_ALL(vp, mp, mvp) { | MNT_VNODE_FOREACH_ALL(vp, mp, mvp) { | ||||
if (vp->v_type != VREG) { | if (vp->v_type != VREG) { | ||||
VI_UNLOCK(vp); | VI_UNLOCK(vp); | ||||
continue; | continue; | ||||
} | } | ||||
obj = vp->v_object; | obj = vp->v_object; | ||||
KASSERT((obj->flags & (OBJ_TMPFS_NODE | OBJ_TMPFS)) == | MPASS(obj->type == OBJT_SWAP_TMPFS); | ||||
(OBJ_TMPFS_NODE | OBJ_TMPFS), ("non-tmpfs obj")); | MPASS((obj->flags & OBJ_TMPFS) != 0); | ||||
/* | /* | ||||
* In lazy case, do unlocked read, avoid taking vnode | * In lazy case, do unlocked read, avoid taking vnode | ||||
* lock if not needed. Lost update will be handled on | * lock if not needed. Lost update will be handled on | ||||
* the next call. | * the next call. | ||||
* For non-lazy case, we must flush all pending | * For non-lazy case, we must flush all pending | ||||
* metadata changes now. | * metadata changes now. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | FOREACH_PROC_IN_SYSTEM(p) { | ||||
if (map->busy) | if (map->busy) | ||||
vm_map_wait_busy(map); | vm_map_wait_busy(map); | ||||
VM_MAP_ENTRY_FOREACH(entry, map) { | VM_MAP_ENTRY_FOREACH(entry, map) { | ||||
if ((entry->eflags & (MAP_ENTRY_GUARD | | if ((entry->eflags & (MAP_ENTRY_GUARD | | ||||
MAP_ENTRY_IS_SUB_MAP | MAP_ENTRY_COW)) != 0 || | MAP_ENTRY_IS_SUB_MAP | MAP_ENTRY_COW)) != 0 || | ||||
(entry->max_protection & VM_PROT_WRITE) == 0) | (entry->max_protection & VM_PROT_WRITE) == 0) | ||||
continue; | continue; | ||||
object = entry->object.vm_object; | object = entry->object.vm_object; | ||||
if (object == NULL || object->type != OBJT_SWAP || | if (object == NULL || object->type != OBJT_SWAP_TMPFS) | ||||
(object->flags & OBJ_TMPFS_NODE) == 0) | |||||
continue; | continue; | ||||
/* | /* | ||||
* No need to dig into shadow chain, mapping | * No need to dig into shadow chain, mapping | ||||
* of the object not at top is readonly. | * of the object not at top is readonly. | ||||
*/ | */ | ||||
VM_OBJECT_RLOCK(object); | VM_OBJECT_RLOCK(object); | ||||
if (object->type == OBJT_DEAD) { | if (object->type == OBJT_DEAD) { | ||||
VM_OBJECT_RUNLOCK(object); | VM_OBJECT_RUNLOCK(object); | ||||
continue; | continue; | ||||
} | } | ||||
MPASS(object->ref_count > 1); | MPASS(object->ref_count > 1); | ||||
if ((object->flags & (OBJ_TMPFS_NODE | OBJ_TMPFS)) != | if ((object->flags & OBJ_TMPFS) == 0) { | ||||
(OBJ_TMPFS_NODE | OBJ_TMPFS)) { | |||||
VM_OBJECT_RUNLOCK(object); | VM_OBJECT_RUNLOCK(object); | ||||
continue; | continue; | ||||
} | } | ||||
vp = object->un_pager.swp.swp_tmpfs; | vp = object->un_pager.swp.swp_tmpfs; | ||||
if (vp->v_mount != mp) { | if (vp->v_mount != mp) { | ||||
VM_OBJECT_RUNLOCK(object); | VM_OBJECT_RUNLOCK(object); | ||||
continue; | continue; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 442 Lines • Show Last 20 Lines |