summaryrefslogtreecommitdiffstats
path: root/sys/ufs
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2009-12-21 12:29:38 +0000
committerkib <kib@FreeBSD.org>2009-12-21 12:29:38 +0000
commitb79e14054c8e7da84bd67e9e6e02fccceac99d76 (patch)
treef31ce769a217372d32bf761018f280f62a7ef56c /sys/ufs
parent4b6831a03645220a5f7fab0ecd0991b8ca464ac5 (diff)
downloadFreeBSD-src-b79e14054c8e7da84bd67e9e6e02fccceac99d76.zip
FreeBSD-src-b79e14054c8e7da84bd67e9e6e02fccceac99d76.tar.gz
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
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ffs/ffs_rawread.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/sys/ufs/ffs/ffs_rawread.c b/sys/ufs/ffs/ffs_rawread.c
index 434c833..574d89c 100644
--- a/sys/ufs/ffs/ffs_rawread.c
+++ b/sys/ufs/ffs/ffs_rawread.c
@@ -101,6 +101,7 @@ ffs_rawread_sync(struct vnode *vp)
int upgraded;
struct bufobj *bo;
struct mount *mp;
+ vm_object_t obj;
/* Check for dirty mmap, pending writes and dirty buffers */
bo = &vp->v_bufobj;
@@ -108,7 +109,8 @@ ffs_rawread_sync(struct vnode *vp)
VI_LOCK(vp);
if (bo->bo_numoutput > 0 ||
bo->bo_dirty.bv_cnt > 0 ||
- (vp->v_iflag & VI_OBJDIRTY) != 0) {
+ ((obj = vp->v_object) != NULL &&
+ (obj->flags & OBJ_MIGHTBEDIRTY) != 0)) {
VI_UNLOCK(vp);
BO_UNLOCK(bo);
@@ -138,13 +140,12 @@ ffs_rawread_sync(struct vnode *vp)
return (EIO);
}
/* Attempt to msync mmap() regions to clean dirty mmap */
- if ((vp->v_iflag & VI_OBJDIRTY) != 0) {
+ if ((obj = vp->v_object) != NULL &&
+ (obj->flags & OBJ_MIGHTBEDIRTY) != 0) {
VI_UNLOCK(vp);
- if (vp->v_object != NULL) {
- VM_OBJECT_LOCK(vp->v_object);
- vm_object_page_clean(vp->v_object, 0, 0, OBJPC_SYNC);
- VM_OBJECT_UNLOCK(vp->v_object);
- }
+ VM_OBJECT_LOCK(obj);
+ vm_object_page_clean(obj, 0, 0, OBJPC_SYNC);
+ VM_OBJECT_UNLOCK(obj);
} else
VI_UNLOCK(vp);
OpenPOWER on IntegriCloud