Make flushing dirty pages work correctly on filesystems that
unexpectedly do not complete writes even with sync I/O requests. This should help the behavior of mmaped files when using softupdates (and perhaps in other circumstances also.)
This commit is contained in:
parent
949a19fafd
commit
cf2819ccb8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=36275
@ -39,7 +39,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)pmap.c 7.7 (Berkeley) 5/12/91
|
||||
* $Id: pmap.c,v 1.200 1998/05/19 00:06:35 tegge Exp $
|
||||
* $Id: pmap.c,v 1.201 1998/05/19 08:58:48 phk Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -2496,6 +2496,7 @@ pmap_object_init_pt(pmap, addr, object, pindex, size, limit)
|
||||
continue;
|
||||
}
|
||||
if (((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) &&
|
||||
(p->busy == 0) &&
|
||||
(p->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) {
|
||||
if ((p->queue - p->pc) == PQ_CACHE)
|
||||
vm_page_deactivate(p);
|
||||
@ -2516,6 +2517,7 @@ pmap_object_init_pt(pmap, addr, object, pindex, size, limit)
|
||||
p = vm_page_lookup(object, tmpidx + pindex);
|
||||
if (p &&
|
||||
((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) &&
|
||||
(p->busy == 0) &&
|
||||
(p->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) {
|
||||
if ((p->queue - p->pc) == PQ_CACHE)
|
||||
vm_page_deactivate(p);
|
||||
@ -2610,6 +2612,7 @@ pmap_prefault(pmap, addra, entry)
|
||||
break;
|
||||
|
||||
if (((m->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) &&
|
||||
(m->busy == 0) &&
|
||||
(m->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) {
|
||||
|
||||
if ((m->queue - m->pc) == PQ_CACHE) {
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95
|
||||
* $Id: spec_vnops.c,v 1.60 1998/03/08 09:57:36 julian Exp $
|
||||
* $Id: spec_vnops.c,v 1.61 1998/04/19 23:32:26 julian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -551,7 +551,8 @@ spec_strategy(ap)
|
||||
struct buf *bp;
|
||||
|
||||
bp = ap->a_bp;
|
||||
if ((LIST_FIRST(&bp->b_dep)) != NULL && bioops.io_start)
|
||||
if (((bp->b_flags & B_READ) == 0) &&
|
||||
(LIST_FIRST(&bp->b_dep)) != NULL && bioops.io_start)
|
||||
(*bioops.io_start)(bp);
|
||||
(*bdevsw[major(bp->b_dev)]->d_strategy)(bp);
|
||||
return (0);
|
||||
|
@ -39,7 +39,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)pmap.c 7.7 (Berkeley) 5/12/91
|
||||
* $Id: pmap.c,v 1.200 1998/05/19 00:06:35 tegge Exp $
|
||||
* $Id: pmap.c,v 1.201 1998/05/19 08:58:48 phk Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -2496,6 +2496,7 @@ pmap_object_init_pt(pmap, addr, object, pindex, size, limit)
|
||||
continue;
|
||||
}
|
||||
if (((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) &&
|
||||
(p->busy == 0) &&
|
||||
(p->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) {
|
||||
if ((p->queue - p->pc) == PQ_CACHE)
|
||||
vm_page_deactivate(p);
|
||||
@ -2516,6 +2517,7 @@ pmap_object_init_pt(pmap, addr, object, pindex, size, limit)
|
||||
p = vm_page_lookup(object, tmpidx + pindex);
|
||||
if (p &&
|
||||
((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) &&
|
||||
(p->busy == 0) &&
|
||||
(p->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) {
|
||||
if ((p->queue - p->pc) == PQ_CACHE)
|
||||
vm_page_deactivate(p);
|
||||
@ -2610,6 +2612,7 @@ pmap_prefault(pmap, addra, entry)
|
||||
break;
|
||||
|
||||
if (((m->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) &&
|
||||
(m->busy == 0) &&
|
||||
(m->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) {
|
||||
|
||||
if ((m->queue - m->pc) == PQ_CACHE) {
|
||||
|
@ -33,7 +33,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vfs_cluster.c 8.7 (Berkeley) 2/13/94
|
||||
* $Id: vfs_cluster.c,v 1.60 1998/03/19 22:48:13 dyson Exp $
|
||||
* $Id: vfs_cluster.c,v 1.61 1998/05/01 16:29:27 bde Exp $
|
||||
*/
|
||||
|
||||
#include "opt_debug_cluster.h"
|
||||
@ -243,19 +243,15 @@ cluster_read(vp, filesize, lblkno, size, cred, totread, seqcount, bpp)
|
||||
* handle the synchronous read
|
||||
*/
|
||||
if (bp) {
|
||||
if (bp->b_flags & (B_DONE | B_DELWRI)) {
|
||||
panic("cluster_read: DONE bp");
|
||||
} else {
|
||||
#if defined(CLUSTERDEBUG)
|
||||
if (rcluster)
|
||||
printf("S(%d,%d,%d) ",
|
||||
bp->b_lblkno, bp->b_bcount, seqcount);
|
||||
if (rcluster)
|
||||
printf("S(%d,%d,%d) ",
|
||||
bp->b_lblkno, bp->b_bcount, seqcount);
|
||||
#endif
|
||||
if ((bp->b_flags & B_CLUSTER) == 0)
|
||||
vfs_busy_pages(bp, 0);
|
||||
error = VOP_STRATEGY(bp);
|
||||
curproc->p_stats->p_ru.ru_inblock++;
|
||||
}
|
||||
if ((bp->b_flags & B_CLUSTER) == 0)
|
||||
vfs_busy_pages(bp, 0);
|
||||
error = VOP_STRATEGY(bp);
|
||||
curproc->p_stats->p_ru.ru_inblock++;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95
|
||||
* $Id: spec_vnops.c,v 1.60 1998/03/08 09:57:36 julian Exp $
|
||||
* $Id: spec_vnops.c,v 1.61 1998/04/19 23:32:26 julian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -551,7 +551,8 @@ spec_strategy(ap)
|
||||
struct buf *bp;
|
||||
|
||||
bp = ap->a_bp;
|
||||
if ((LIST_FIRST(&bp->b_dep)) != NULL && bioops.io_start)
|
||||
if (((bp->b_flags & B_READ) == 0) &&
|
||||
(LIST_FIRST(&bp->b_dep)) != NULL && bioops.io_start)
|
||||
(*bioops.io_start)(bp);
|
||||
(*bdevsw[major(bp->b_dev)]->d_strategy)(bp);
|
||||
return (0);
|
||||
|
@ -61,7 +61,7 @@
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $Id: vm_map.c,v 1.125 1998/05/04 17:12:52 dyson Exp $
|
||||
* $Id: vm_map.c,v 1.126 1998/05/16 23:03:20 dyson Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -76,6 +76,7 @@
|
||||
#include <sys/mman.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_param.h>
|
||||
@ -1631,6 +1632,8 @@ vm_map_clean(map, start, end, syncio, invalidate)
|
||||
}
|
||||
}
|
||||
|
||||
if (invalidate)
|
||||
pmap_remove(vm_map_pmap(map), start, end);
|
||||
/*
|
||||
* Make a second pass, cleaning/uncaching pages from the indicated
|
||||
* objects as we go.
|
||||
@ -1668,9 +1671,6 @@ vm_map_clean(map, start, end, syncio, invalidate)
|
||||
if (object->size < OFF_TO_IDX( offset + size))
|
||||
size = IDX_TO_OFF(object->size) - offset;
|
||||
}
|
||||
if (invalidate)
|
||||
pmap_remove(vm_map_pmap(map), current->start,
|
||||
current->start + size);
|
||||
if (object && (object->type == OBJT_VNODE)) {
|
||||
/*
|
||||
* Flush pages if writing is allowed. XXX should we continue
|
||||
@ -1690,11 +1690,13 @@ vm_map_clean(map, start, end, syncio, invalidate)
|
||||
OFF_TO_IDX(offset),
|
||||
OFF_TO_IDX(offset + size + PAGE_MASK),
|
||||
flags);
|
||||
if (invalidate)
|
||||
if (invalidate) {
|
||||
vm_object_pip_wait(object, "objmcl");
|
||||
vm_object_page_remove(object,
|
||||
OFF_TO_IDX(offset),
|
||||
OFF_TO_IDX(offset + size + PAGE_MASK),
|
||||
FALSE);
|
||||
}
|
||||
if (object->type == OBJT_VNODE)
|
||||
VOP_UNLOCK(object->handle, 0, curproc);
|
||||
}
|
||||
|
@ -61,7 +61,7 @@
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $Id: vm_object.c,v 1.119 1998/03/16 01:55:52 dyson Exp $
|
||||
* $Id: vm_object.c,v 1.120 1998/04/29 04:28:09 dyson Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -74,6 +74,7 @@
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/vmmeter.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_param.h>
|
||||
@ -651,13 +652,20 @@ vm_object_page_clean(object, start, end, flags)
|
||||
ma[index]->flags &= ~PG_CLEANCHK;
|
||||
}
|
||||
runlen = maxb + maxf + 1;
|
||||
|
||||
splx(s);
|
||||
vm_pageout_flush(ma, runlen, pagerflags);
|
||||
for (i = 0; i<runlen; i++) {
|
||||
if (ma[i]->valid & ma[i]->dirty) {
|
||||
vm_page_protect(ma[i], VM_PROT_READ);
|
||||
ma[i]->flags |= PG_CLEANCHK;
|
||||
}
|
||||
}
|
||||
if (object->generation != curgeneration)
|
||||
goto rescan;
|
||||
}
|
||||
|
||||
VOP_FSYNC(vp, NULL, (pagerflags & VM_PAGER_PUT_SYNC)?1:0, curproc);
|
||||
VOP_FSYNC(vp, NULL, (pagerflags & VM_PAGER_PUT_SYNC)?MNT_WAIT:0, curproc);
|
||||
|
||||
object->flags &= ~OBJ_CLEANING;
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user