commit-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hurd] 02/06: ext2fs: Fix adding blocks to free blocks cache


From: Samuel Thibault
Subject: [hurd] 02/06: ext2fs: Fix adding blocks to free blocks cache
Date: Wed, 16 Mar 2016 01:36:35 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch upstream
in repository hurd.

commit b50c419c9b8f59b459d488d7bf11654d56f35511
Author: Samuel Thibault <address@hidden>
Date:   Tue Mar 15 00:27:20 2016 +0100

    ext2fs: Fix adding blocks to free blocks cache
    
    * ext2fs/pager.c (disk_cache_info_free_push): Add prototype.
    (disk_pager_notify_evict): When dropping DC_INCORE flag, if the
    block becomes free (no reference and no DC_DONT_REUSE flags), call
    disk_cache_info_free_push.
    (disk_cache_block_deref): Only call disk_cache_info_free_push if the flags
    of the block do not contain DC_DONT_REUSE flags.
---
 ext2fs/pager.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/ext2fs/pager.c b/ext2fs/pager.c
index 458b822..d395472 100644
--- a/ext2fs/pager.c
+++ b/ext2fs/pager.c
@@ -79,6 +79,9 @@ do { pthread_spin_lock (&ext2s_pager_stats.lock);             
              \
 #else /* !STATS */
 #define STAT_INC(field) /* nop */0
 #endif /* STATS */
+
+static void
+disk_cache_info_free_push (struct disk_cache_info *p);
 
 #define FREE_PAGE_BUFS 24
 
@@ -538,6 +541,9 @@ disk_pager_notify_evict (vm_offset_t page)
 
   pthread_mutex_lock (&disk_cache_lock);
   disk_cache_info[index].flags &= ~DC_INCORE;
+  if (disk_cache_info[index].ref_count == 0 &&
+      !(disk_cache_info[index].flags & DC_DONT_REUSE))
+    disk_cache_info_free_push (&disk_cache_info[index]);
   pthread_mutex_unlock (&disk_cache_lock);
 }
 
@@ -1196,7 +1202,8 @@ disk_cache_block_deref (void *ptr)
   assert (! (disk_cache_info[index].flags & DC_UNTOUCHED));
   assert (disk_cache_info[index].ref_count >= 1);
   disk_cache_info[index].ref_count--;
-  if (disk_cache_info[index].ref_count == 0)
+  if (disk_cache_info[index].ref_count == 0 &&
+      !(disk_cache_info[index].flags & DC_DONT_REUSE))
     disk_cache_info_free_push (&disk_cache_info[index]);
   pthread_mutex_unlock (&disk_cache_lock);
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/hurd.git



reply via email to

[Prev in Thread] Current Thread [Next in Thread]