Added AppendUnlocked() version that appends a list of pages.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35010 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2010-01-11 16:31:44 +00:00
parent eb7157a4b6
commit a0b07ebaab

View File

@ -18,11 +18,10 @@
#include <vm/vm_types.h>
struct VMPageQueue {
public:
typedef DoublyLinkedList<vm_page, DoublyLinkedListMemberGetLink<vm_page,
&vm_page::queue_link> > PageList;
typedef DoublyLinkedList<vm_page,
DoublyLinkedListMemberGetLink<vm_page, &vm_page::queue_link> > PageList;
typedef PageList::ConstIterator Iterator;
public:
@ -39,6 +38,7 @@ public:
inline void Requeue(vm_page* page, bool tail);
inline void AppendUnlocked(vm_page* page);
inline void AppendUnlocked(PageList& pages, uint32 count);
inline void PrependUnlocked(vm_page* page);
inline void RemoveUnlocked(vm_page* page);
inline vm_page* RemoveHeadUnlocked();
@ -186,6 +186,29 @@ VMPageQueue::AppendUnlocked(vm_page* page)
}
void
VMPageQueue::AppendUnlocked(PageList& pages, uint32 count)
{
#if DEBUG_PAGE_QUEUE
for (PageList::Iterator it = pages.GetIterator();
vm_page* page = it.next();) {
if (page->queue != NULL) {
panic("%p->VMPageQueue::AppendUnlocked(): page %p thinks it is "
"already in queue %p", this, page, page->queue);
}
page->queue = this;
}
#endif // DEBUG_PAGE_QUEUE
InterruptsSpinLocker locker(fLock);
fPages.MoveFrom(&pages);
fCount += count;
}
void
VMPageQueue::PrependUnlocked(vm_page* page)
{