From b79e14054c8e7da84bd67e9e6e02fccceac99d76 Mon Sep 17 00:00:00 2001 From: kib Date: Mon, 21 Dec 2009 12:29:38 +0000 Subject: VI_OBJDIRTY vnode flag mirrors the state of OBJ_MIGHTBEDIRTY vm object flag. Besides providing the redundand information, need to update both vnode and object flags causes more acquisition of vnode interlock. OBJ_MIGHTBEDIRTY is only checked for vnode-backed vm objects. Remove VI_OBJDIRTY and make sure that OBJ_MIGHTBEDIRTY is set only for vnode-backed vm objects. Suggested and reviewed by: alc Tested by: pho MFC after: 3 weeks --- sys/vm/vm_object.c | 26 +++++--------------------- sys/vm/vm_object.h | 2 +- 2 files changed, 6 insertions(+), 22 deletions(-) (limited to 'sys/vm') diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index d7a6e97..399cb10 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -773,9 +773,9 @@ vm_object_page_clean(vm_object_t object, vm_pindex_t start, vm_pindex_t end, int int curgeneration; VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); - if (object->type != OBJT_VNODE || - (object->flags & OBJ_MIGHTBEDIRTY) == 0) + if ((object->flags & OBJ_MIGHTBEDIRTY) == 0) return; + KASSERT(object->type == OBJT_VNODE, ("Not a vnode object")); pagerflags = (flags & (OBJPC_SYNC | OBJPC_INVAL)) ? VM_PAGER_PUT_SYNC : VM_PAGER_CLUSTER_OK; pagerflags |= (flags & OBJPC_INVAL) ? VM_PAGER_PUT_INVAL : 0; @@ -875,18 +875,8 @@ vm_object_page_clean(vm_object_t object, vm_pindex_t start, vm_pindex_t end, int pmap_remove_write(p); } - if (clearobjflags && (tstart == 0) && (tend == object->size)) { - struct vnode *vp; - + if (clearobjflags && (tstart == 0) && (tend == object->size)) vm_object_clear_flag(object, OBJ_MIGHTBEDIRTY); - if (object->type == OBJT_VNODE && - (vp = (struct vnode *)object->handle) != NULL) { - VI_LOCK(vp); - if (vp->v_iflag & VI_OBJDIRTY) - vp->v_iflag &= ~VI_OBJDIRTY; - VI_UNLOCK(vp); - } - } rescan: curgeneration = object->generation; @@ -2148,18 +2138,12 @@ vm_object_coalesce(vm_object_t prev_object, vm_ooffset_t prev_offset, void vm_object_set_writeable_dirty(vm_object_t object) { - struct vnode *vp; VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); - if ((object->flags & OBJ_MIGHTBEDIRTY) != 0) + if (object->type != OBJT_VNODE || + (object->flags & OBJ_MIGHTBEDIRTY) != 0) return; vm_object_set_flag(object, OBJ_MIGHTBEDIRTY); - if (object->type == OBJT_VNODE && - (vp = (struct vnode *)object->handle) != NULL) { - VI_LOCK(vp); - vp->v_iflag |= VI_OBJDIRTY; - VI_UNLOCK(vp); - } } #include "opt_ddb.h" diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h index 0b06fed..6a9f129 100644 --- a/sys/vm/vm_object.h +++ b/sys/vm/vm_object.h @@ -154,7 +154,7 @@ struct vm_object { #define OBJ_DEAD 0x0008 /* dead objects (during rundown) */ #define OBJ_NOSPLIT 0x0010 /* dont split this object */ #define OBJ_PIPWNT 0x0040 /* paging in progress wanted */ -#define OBJ_MIGHTBEDIRTY 0x0100 /* object might be dirty */ +#define OBJ_MIGHTBEDIRTY 0x0100 /* object might be dirty, only for vnode */ #define OBJ_CLEANING 0x0200 #define OBJ_COLORED 0x1000 /* pg_color is defined */ #define OBJ_ONEMAPPING 0x2000 /* One USE (a single, non-forked) mapping flag */ -- cgit v1.1