diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2017-04-05 16:57:53 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2017-04-05 16:57:53 +0000 |
commit | 0226f659407424ddf97e802233324b9e1ad7905e (patch) | |
tree | 5222df7687f9c1771051280943a38d3d99b63a5a /sys/kern | |
parent | 4af540d197ad7098904f44593abef1da987be04f (diff) | |
download | src-0226f659407424ddf97e802233324b9e1ad7905e.tar.gz src-0226f659407424ddf97e802233324b9e1ad7905e.zip |
Add V_VMIO flag for vinvalbuf(9) to indicate that the flush request
was issued during VM-initiated i/o (pageout), so that the function
does not try to flush or remove pages or wait for the vm object
paging-in-progress counter.
Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
X-Differential revision: https://reviews.freebsd.org/D10241
Notes
Notes:
svn path=/head/; revision=316528
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_subr.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 12da621d7605..9edce97fc009 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1673,13 +1673,15 @@ bufobj_invalbuf(struct bufobj *bo, int flags, int slpflag, int slptimeo) */ do { bufobj_wwait(bo, 0, 0); - BO_UNLOCK(bo); - if (bo->bo_object != NULL) { - VM_OBJECT_WLOCK(bo->bo_object); - vm_object_pip_wait(bo->bo_object, "bovlbx"); - VM_OBJECT_WUNLOCK(bo->bo_object); + if ((flags & V_VMIO) == 0) { + BO_UNLOCK(bo); + if (bo->bo_object != NULL) { + VM_OBJECT_WLOCK(bo->bo_object); + vm_object_pip_wait(bo->bo_object, "bovlbx"); + VM_OBJECT_WUNLOCK(bo->bo_object); + } + BO_LOCK(bo); } - BO_LOCK(bo); } while (bo->bo_numoutput > 0); BO_UNLOCK(bo); @@ -1687,7 +1689,7 @@ bufobj_invalbuf(struct bufobj *bo, int flags, int slpflag, int slptimeo) * Destroy the copy in the VM cache, too. */ if (bo->bo_object != NULL && - (flags & (V_ALT | V_NORMAL | V_CLEANONLY)) == 0) { + (flags & (V_ALT | V_NORMAL | V_CLEANONLY | V_VMIO)) == 0) { VM_OBJECT_WLOCK(bo->bo_object); vm_object_page_remove(bo->bo_object, 0, 0, (flags & V_SAVE) ? OBJPR_CLEANONLY : 0); @@ -1696,7 +1698,7 @@ bufobj_invalbuf(struct bufobj *bo, int flags, int slpflag, int slptimeo) #ifdef INVARIANTS BO_LOCK(bo); - if ((flags & (V_ALT | V_NORMAL | V_CLEANONLY)) == 0 && + if ((flags & (V_ALT | V_NORMAL | V_CLEANONLY | V_VMIO)) == 0 && (bo->bo_dirty.bv_cnt > 0 || bo->bo_clean.bv_cnt > 0)) panic("vinvalbuf: flush failed"); BO_UNLOCK(bo); |