vm_pager: add pgo_set_writeable_dirty method
specialized for swap and vnode pagers, and used to implement vm_object_set_writeable_dirty(). Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30070
This commit is contained in:
parent
ee4211bca6
commit
180bcaa46c
@ -433,6 +433,7 @@ static void swap_pager_update_writecount(vm_object_t object,
|
||||
vm_offset_t start, vm_offset_t end);
|
||||
static void swap_pager_release_writecount(vm_object_t object,
|
||||
vm_offset_t start, vm_offset_t end);
|
||||
static void swap_pager_set_writeable_dirty(vm_object_t object);
|
||||
|
||||
struct pagerops swappagerops = {
|
||||
.pgo_init = swap_pager_init, /* early system initialization of pager */
|
||||
@ -445,6 +446,7 @@ struct pagerops swappagerops = {
|
||||
.pgo_pageunswapped = swap_pager_unswapped, /* remove swap related to page */
|
||||
.pgo_update_writecount = swap_pager_update_writecount,
|
||||
.pgo_release_writecount = swap_pager_release_writecount,
|
||||
.pgo_set_writeable_dirty = swap_pager_set_writeable_dirty,
|
||||
};
|
||||
|
||||
/*
|
||||
@ -3123,3 +3125,10 @@ swap_pager_release_writecount(vm_object_t object, vm_offset_t start,
|
||||
object->un_pager.swp.writemappings -= (vm_ooffset_t)end - start;
|
||||
VM_OBJECT_WUNLOCK(object);
|
||||
}
|
||||
|
||||
static void
|
||||
swap_pager_set_writeable_dirty(vm_object_t object)
|
||||
{
|
||||
if ((object->flags & OBJ_TMPFS_NODE) != 0)
|
||||
vm_object_set_writeable_dirty_(object);
|
||||
}
|
||||
|
@ -2332,13 +2332,8 @@ vm_object_coalesce(vm_object_t prev_object, vm_ooffset_t prev_offset,
|
||||
}
|
||||
|
||||
void
|
||||
vm_object_set_writeable_dirty(vm_object_t object)
|
||||
vm_object_set_writeable_dirty_(vm_object_t object)
|
||||
{
|
||||
|
||||
/* Only set for vnodes & tmpfs */
|
||||
if (object->type != OBJT_VNODE &&
|
||||
(object->flags & OBJ_TMPFS_NODE) == 0)
|
||||
return;
|
||||
atomic_add_int(&object->generation, 1);
|
||||
}
|
||||
|
||||
|
@ -378,6 +378,7 @@ void vm_object_deallocate (vm_object_t);
|
||||
void vm_object_destroy (vm_object_t);
|
||||
void vm_object_terminate (vm_object_t);
|
||||
void vm_object_set_writeable_dirty (vm_object_t);
|
||||
void vm_object_set_writeable_dirty_(vm_object_t object);
|
||||
void vm_object_init (void);
|
||||
int vm_object_kvme_type(vm_object_t object, struct vnode **vpp);
|
||||
void vm_object_madvise(vm_object_t, vm_pindex_t, vm_pindex_t, int);
|
||||
|
@ -497,3 +497,14 @@ pbrelbo(struct buf *bp)
|
||||
bp->b_bufobj = NULL;
|
||||
bp->b_flags &= ~B_PAGING;
|
||||
}
|
||||
|
||||
void
|
||||
vm_object_set_writeable_dirty(vm_object_t object)
|
||||
{
|
||||
pgo_set_writeable_dirty_t *method;
|
||||
|
||||
method = pagertab[object->type]->pgo_set_writeable_dirty;
|
||||
if (method != NULL)
|
||||
method(object);
|
||||
}
|
||||
|
||||
|
@ -62,6 +62,7 @@ typedef int pgo_populate_t(vm_object_t, vm_pindex_t, int, vm_prot_t,
|
||||
vm_pindex_t *, vm_pindex_t *);
|
||||
typedef void pgo_pageunswapped_t(vm_page_t);
|
||||
typedef void pgo_writecount_t(vm_object_t, vm_offset_t, vm_offset_t);
|
||||
typedef void pgo_set_writeable_dirty_t(vm_object_t);
|
||||
|
||||
struct pagerops {
|
||||
pgo_init_t *pgo_init; /* Initialize pager. */
|
||||
@ -73,9 +74,9 @@ struct pagerops {
|
||||
pgo_haspage_t *pgo_haspage; /* Query page. */
|
||||
pgo_populate_t *pgo_populate; /* Bulk spec pagein. */
|
||||
pgo_pageunswapped_t *pgo_pageunswapped;
|
||||
/* Operations for specialized writecount handling */
|
||||
pgo_writecount_t *pgo_update_writecount;
|
||||
pgo_writecount_t *pgo_release_writecount;
|
||||
pgo_set_writeable_dirty_t *pgo_set_writeable_dirty;
|
||||
};
|
||||
|
||||
extern struct pagerops defaultpagerops;
|
||||
|
@ -115,6 +115,7 @@ struct pagerops vnodepagerops = {
|
||||
.pgo_haspage = vnode_pager_haspage,
|
||||
.pgo_update_writecount = vnode_pager_update_writecount,
|
||||
.pgo_release_writecount = vnode_pager_release_writecount,
|
||||
.pgo_set_writeable_dirty = vm_object_set_writeable_dirty_,
|
||||
};
|
||||
|
||||
static struct domainset *vnode_domainset = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user