From 4a47f4e02439d19d39534203fba7217a809d220f Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Sat, 31 May 2014 08:44:59 +0200 Subject: [PATCH 3/8] ext2fs: use a hard reference for file pagers When a file pager is created, a reference is added to the associated struct node. Previously, a weak reference was used. A weak refeference requires that we might give it up on request. There is no such mechanism here. Instead, we give it up when the pager is destroyed. * ext2fs/pager.c (pager_clear_user_data): Use a hard reference instead. (diskfs_get_filemap): Likewise. --- ext2fs/pager.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext2fs/pager.c b/ext2fs/pager.c index ce5bc6d..e00857a 100644 --- a/ext2fs/pager.c +++ b/ext2fs/pager.c @@ -811,7 +811,7 @@ pager_clear_user_data (struct user_pager_info *upi) upi->node->dn->pager = 0; pthread_spin_unlock (&node_to_page_lock); - diskfs_nrele_light (upi->node); + diskfs_nrele (upi->node); } free (upi); @@ -1278,13 +1278,13 @@ diskfs_get_filemap (struct node *node, vm_prot_t prot) upi->type = FILE_DATA; upi->node = node; upi->max_prot = prot; - diskfs_nref_light (node); + diskfs_nref (node); node->dn->pager = pager_create (upi, file_pager_bucket, MAY_CACHE, MEMORY_OBJECT_COPY_DELAY, 0); if (node->dn->pager == 0) { - diskfs_nrele_light (node); + diskfs_nrele (node); free (upi); pthread_spin_unlock (&node_to_page_lock); return MACH_PORT_NULL; -- 2.0.0.rc2