mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-03 14:48:57 +00:00
o Condition the compilation and use of vm_freeze_copyopts()
on ENABLE_VFS_IOOPT.
This commit is contained in:
parent
6953f5da1a
commit
c0b6bbb80b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=96095
@ -473,12 +473,13 @@ WRITE(ap)
|
||||
if ((ioflag & IO_SYNC) && !DOINGASYNC(vp))
|
||||
flags = B_SYNC;
|
||||
|
||||
#ifdef ENABLE_VFS_IOOPT
|
||||
if (object && (object->flags & OBJ_OPT)) {
|
||||
vm_freeze_copyopts(object,
|
||||
OFF_TO_IDX(uio->uio_offset),
|
||||
OFF_TO_IDX(uio->uio_offset + uio->uio_resid + PAGE_MASK));
|
||||
}
|
||||
|
||||
#endif
|
||||
for (error = 0; uio->uio_resid > 0;) {
|
||||
lbn = lblkno(fs, uio->uio_offset);
|
||||
blkoffset = blkoff(fs, uio->uio_offset);
|
||||
|
@ -276,12 +276,13 @@ RetryFault:;
|
||||
fs.vp = vnode_pager_lock(fs.first_object);
|
||||
vm_object_pip_add(fs.first_object, 1);
|
||||
|
||||
#ifdef ENABLE_VFS_IOOPT
|
||||
if ((fault_type & VM_PROT_WRITE) &&
|
||||
(fs.first_object->type == OBJT_VNODE)) {
|
||||
vm_freeze_copyopts(fs.first_object,
|
||||
fs.first_pindex, fs.first_pindex + 1);
|
||||
}
|
||||
|
||||
#endif
|
||||
fs.lookup_still_valid = TRUE;
|
||||
|
||||
if (wired)
|
||||
|
@ -401,7 +401,9 @@ vm_object_vndeallocate(vm_object_t object)
|
||||
object->ref_count--;
|
||||
if (object->ref_count == 0) {
|
||||
vp->v_flag &= ~VTEXT;
|
||||
#ifdef ENABLE_VFS_IOOPT
|
||||
vm_object_clear_flag(object, OBJ_OPT);
|
||||
#endif
|
||||
}
|
||||
/*
|
||||
* vrele may need a vop lock
|
||||
@ -496,8 +498,10 @@ doterm:
|
||||
if (temp) {
|
||||
TAILQ_REMOVE(&temp->shadow_head, object, shadow_list);
|
||||
temp->shadow_count--;
|
||||
#ifdef ENABLE_VFS_IOOPT
|
||||
if (temp->ref_count == 0)
|
||||
vm_object_clear_flag(temp, OBJ_OPT);
|
||||
#endif
|
||||
temp->generation++;
|
||||
object->backing_object = NULL;
|
||||
}
|
||||
@ -547,11 +551,12 @@ vm_object_terminate(vm_object_t object)
|
||||
if (object->type == OBJT_VNODE) {
|
||||
struct vnode *vp;
|
||||
|
||||
#ifdef ENABLE_VFS_IOOPT
|
||||
/*
|
||||
* Freeze optimized copies.
|
||||
*/
|
||||
vm_freeze_copyopts(object, 0, object->size);
|
||||
|
||||
#endif
|
||||
/*
|
||||
* Clean pages and flush buffers.
|
||||
*/
|
||||
@ -1783,7 +1788,10 @@ vm_object_set_writeable_dirty(vm_object_t object)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VFS_IOOPT
|
||||
/*
|
||||
* Experimental support for zero-copy I/O
|
||||
*
|
||||
* Performs the copy_on_write operations necessary to allow the virtual copies
|
||||
* into user space to work. This has to be called for write(2) system calls
|
||||
* from other processes, file unlinking, and file size shrinkage.
|
||||
@ -1859,6 +1867,7 @@ vm_freeze_copyopts(vm_object_t object, vm_pindex_t froma, vm_pindex_t toa)
|
||||
|
||||
vm_object_clear_flag(object, OBJ_OPT);
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#ifdef DDB
|
||||
|
@ -291,7 +291,9 @@ vnode_pager_setsize(vp, nsize)
|
||||
* File has shrunk. Toss any cached pages beyond the new EOF.
|
||||
*/
|
||||
if (nsize < object->un_pager.vnp.vnp_size) {
|
||||
#ifdef ENABLE_VFS_IOOPT
|
||||
vm_freeze_copyopts(object, OFF_TO_IDX(nsize), object->size);
|
||||
#endif
|
||||
if (nobjsize < object->size) {
|
||||
vm_object_page_remove(object, nobjsize, object->size,
|
||||
FALSE);
|
||||
|
Loading…
Reference in New Issue
Block a user