2 * Copyright 2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 * Distributed under the terms of the MIT License.
7 #include "PageCacheLocker.h"
9 #include <vm/VMCache.h>
13 PageCacheLocker::_IgnorePage(vm_page
* page
)
15 if (page
->busy
|| page
->State() == PAGE_STATE_WIRED
16 || page
->State() == PAGE_STATE_FREE
|| page
->State() == PAGE_STATE_CLEAR
17 || page
->State() == PAGE_STATE_UNUSED
|| page
->WiredCount() > 0)
25 PageCacheLocker::Lock(vm_page
* page
, bool dontWait
)
27 if (_IgnorePage(page
))
30 // Grab a reference to this cache.
31 VMCache
* cache
= vm_cache_acquire_locked_page_cache(page
, dontWait
);
35 if (_IgnorePage(page
)) {
36 cache
->ReleaseRefAndUnlock();
46 PageCacheLocker::Unlock()
51 fPage
->Cache()->ReleaseRefAndUnlock();