Add pgo_mightbedirty method
Used to implement vm_object_mightbedirty() 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
180bcaa46c
commit
c23c555bc1
@ -434,6 +434,7 @@ static void swap_pager_update_writecount(vm_object_t object,
|
||||
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);
|
||||
static bool swap_pager_mightbedirty(vm_object_t object);
|
||||
|
||||
struct pagerops swappagerops = {
|
||||
.pgo_init = swap_pager_init, /* early system initialization of pager */
|
||||
@ -447,6 +448,7 @@ struct pagerops swappagerops = {
|
||||
.pgo_update_writecount = swap_pager_update_writecount,
|
||||
.pgo_release_writecount = swap_pager_release_writecount,
|
||||
.pgo_set_writeable_dirty = swap_pager_set_writeable_dirty,
|
||||
.pgo_mightbedirty = swap_pager_mightbedirty,
|
||||
};
|
||||
|
||||
/*
|
||||
@ -3132,3 +3134,11 @@ swap_pager_set_writeable_dirty(vm_object_t object)
|
||||
if ((object->flags & OBJ_TMPFS_NODE) != 0)
|
||||
vm_object_set_writeable_dirty_(object);
|
||||
}
|
||||
|
||||
static bool
|
||||
swap_pager_mightbedirty(vm_object_t object)
|
||||
{
|
||||
if ((object->flags & OBJ_TMPFS_NODE) != 0)
|
||||
return (vm_object_mightbedirty_(object));
|
||||
return (false);
|
||||
}
|
||||
|
@ -2337,6 +2337,12 @@ vm_object_set_writeable_dirty_(vm_object_t object)
|
||||
atomic_add_int(&object->generation, 1);
|
||||
}
|
||||
|
||||
bool
|
||||
vm_object_mightbedirty_(vm_object_t object)
|
||||
{
|
||||
return (object->generation != object->cleangeneration);
|
||||
}
|
||||
|
||||
/*
|
||||
* vm_object_unwire:
|
||||
*
|
||||
|
@ -330,21 +330,6 @@ vm_object_reserv(vm_object_t object)
|
||||
return (false);
|
||||
}
|
||||
|
||||
static __inline bool
|
||||
vm_object_mightbedirty(vm_object_t object)
|
||||
{
|
||||
|
||||
if (object->type != OBJT_VNODE) {
|
||||
if ((object->flags & OBJ_TMPFS_NODE) == 0)
|
||||
return (false);
|
||||
#ifdef KASSERT
|
||||
KASSERT(object->type == OBJT_SWAP,
|
||||
("TMPFS_NODE obj %p is not swap", object));
|
||||
#endif
|
||||
}
|
||||
return (object->generation != object->cleangeneration);
|
||||
}
|
||||
|
||||
void vm_object_clear_flag(vm_object_t object, u_short bits);
|
||||
void vm_object_pip_add(vm_object_t object, short i);
|
||||
void vm_object_pip_wakeup(vm_object_t object);
|
||||
@ -379,6 +364,8 @@ 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);
|
||||
bool vm_object_mightbedirty(vm_object_t object);
|
||||
bool vm_object_mightbedirty_(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);
|
||||
|
@ -508,3 +508,13 @@ vm_object_set_writeable_dirty(vm_object_t object)
|
||||
method(object);
|
||||
}
|
||||
|
||||
bool
|
||||
vm_object_mightbedirty(vm_object_t object)
|
||||
{
|
||||
pgo_mightbedirty_t *method;
|
||||
|
||||
method = pagertab[object->type]->pgo_mightbedirty;
|
||||
if (method == NULL)
|
||||
return (false);
|
||||
return (method(object));
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ typedef int pgo_populate_t(vm_object_t, vm_pindex_t, int, vm_prot_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);
|
||||
typedef bool pgo_mightbedirty_t(vm_object_t);
|
||||
|
||||
struct pagerops {
|
||||
pgo_init_t *pgo_init; /* Initialize pager. */
|
||||
@ -77,6 +78,7 @@ struct pagerops {
|
||||
pgo_writecount_t *pgo_update_writecount;
|
||||
pgo_writecount_t *pgo_release_writecount;
|
||||
pgo_set_writeable_dirty_t *pgo_set_writeable_dirty;
|
||||
pgo_mightbedirty_t *pgo_mightbedirty;
|
||||
};
|
||||
|
||||
extern struct pagerops defaultpagerops;
|
||||
|
@ -116,6 +116,7 @@ struct pagerops vnodepagerops = {
|
||||
.pgo_update_writecount = vnode_pager_update_writecount,
|
||||
.pgo_release_writecount = vnode_pager_release_writecount,
|
||||
.pgo_set_writeable_dirty = vm_object_set_writeable_dirty_,
|
||||
.pgo_mightbedirty = vm_object_mightbedirty_,
|
||||
};
|
||||
|
||||
static struct domainset *vnode_domainset = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user