[haiku-commits] r35474 - haiku/trunk/src/system/kernel/vm

  • From: ingo_weinhold@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 15 Feb 2010 19:47:46 +0100 (CET)

Author: bonefish
Date: 2010-02-15 19:47:45 +0100 (Mon, 15 Feb 2010)
New Revision: 35474
Changeset: http://dev.haiku-os.org/changeset/35474/haiku

Modified:
   haiku/trunk/src/system/kernel/vm/vm_page.cpp
Log:
Removed PageWriteWrapper::CheckRemoveFromShrunkenCache() and moved removing
the page to Done().


Modified: haiku/trunk/src/system/kernel/vm/vm_page.cpp
===================================================================
--- haiku/trunk/src/system/kernel/vm/vm_page.cpp        2010-02-15 16:39:54 UTC 
(rev 35473)
+++ haiku/trunk/src/system/kernel/vm/vm_page.cpp        2010-02-15 18:47:45 UTC 
(rev 35474)
@@ -1355,7 +1355,6 @@
        ~PageWriteWrapper();
        void SetTo(vm_page* page, bool dequeuedPage);
        void ClearModifiedFlag();
-       void CheckRemoveFromShrunkenCache();
        void Done(status_t result);
 
 private:
@@ -1423,19 +1422,6 @@
 
 
 /*!    The page's cache must be locked.
-*/
-void
-PageWriteWrapper::CheckRemoveFromShrunkenCache()
-{
-       if (fPage->busy_writing)
-               return;
-
-       vm_remove_all_page_mappings(fPage);
-       fCache->RemovePage(fPage);
-}
-
-
-/*!    The page's cache must be locked.
        The page queues must not be locked.
 */
 void
@@ -1468,20 +1454,20 @@
                        // The busy_writing flag was cleared. That means the 
cache has been
                        // shrunk while we were trying to write the page and we 
have to free
                        // it now.
+                       vm_remove_all_page_mappings(fPage);
+// TODO: Unmapping should already happen when resizing the cache!
+                       fCache->RemovePage(fPage);
+                       free_page(fPage, false);
 
                        // Adjust temporary modified pages count, if necessary.
                        if (fDequeuedPage && fCache->temporary)
                                atomic_add(&sModifiedTemporaryPages, -1);
-
-                       // free the page
-                       free_page(fPage, false);
                } else {
                        fPage->busy_writing = false;
                        DEBUG_PAGE_ACCESS_END(fPage);
                }
        }
 
-
        fCache->NotifyPageEvents(fPage, PAGE_EVENT_NOT_BUSY);
        fIsActive = false;
 }
@@ -1667,12 +1653,6 @@
                PageWriteTransfer& transfer = fTransfers[i];
                transfer.Cache()->Lock();
 
-               if (transfer.Status() != B_OK) {
-                       uint32 checkIndex = wrapperIndex;
-                       for (uint32 j = 0; j < transfer.PageCount(); j++)
-                               
fWrappers[checkIndex++].CheckRemoveFromShrunkenCache();
-               }
-
                for (uint32 j = 0; j < transfer.PageCount(); j++)
                        fWrappers[wrapperIndex++].Done(transfer.Status());
 
@@ -2539,14 +2519,6 @@
                status_t status = transfer.Schedule(0);
                cache->Lock();
 
-               // Before disabling interrupts handle part of the special case 
that
-               // writing the page failed due the cache having been shrunk. We 
need to
-               // remove the page from the cache and free it.
-               if (status != B_OK) {
-                       for (int32 i = 0; i < usedWrappers; i++)
-                               wrappers[i]->CheckRemoveFromShrunkenCache();
-               }
-
                for (int32 i = 0; i < usedWrappers; i++)
                        wrappers[i]->Done(status);
 


Other related posts:

  • » [haiku-commits] r35474 - haiku/trunk/src/system/kernel/vm - ingo_weinhold