summaryrefslogtreecommitdiff
path: root/ufs
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1995-06-21 18:49:52 +0000
committerMichael I. Bushnell <mib@gnu.org>1995-06-21 18:49:52 +0000
commit0c530682ff67d4cbc3a7edb0e3c38af7736b27c2 (patch)
tree2ff1a8fa0fa7a4ab4ff8baafa2f6a1a43c1f59e9 /ufs
parent761724b64a9ef22d682bb1207259bcaa496c3380 (diff)
(pager_clear_user_data): Don't maintain pager linked list.
(diskfs_get_filemap): Don't maintain pager linked list. (pager_dropweak): New function. (pager_traverse): Delete function. (diskfs_shutdown_pager): Use ports_bucket_iterate instead of pager_traverse. (diskfs_sync_everything): Use ports_bucket_iterate instead of pager_traverse.
Diffstat (limited to 'ufs')
-rw-r--r--ufs/pager.c73
1 files changed, 19 insertions, 54 deletions
diff --git a/ufs/pager.c b/ufs/pager.c
index a430c761..ea5c1e66 100644
--- a/ufs/pager.c
+++ b/ufs/pager.c
@@ -19,9 +19,6 @@
#include <strings.h>
#include <stdio.h>
-spin_lock_t pagerlistlock = SPIN_LOCK_INITIALIZER;
-struct user_pager_info *filepagerlist;
-
spin_lock_t node2pagelock = SPIN_LOCK_INITIALIZER;
#ifdef DONT_CACHE_MEMORY_OBJECTS
@@ -367,15 +364,16 @@ pager_clear_user_data (struct user_pager_info *upi)
upi->np->dn->fileinfo = 0;
spin_unlock (&node2pagelock);
diskfs_nrele_light (upi->np);
- spin_lock (&pagerlistlock);
- *upi->prevp = upi->next;
- if (upi->next)
- upi->next->prevp = upi->prevp;
- spin_unlock (&pagerlistlock);
}
free (upi);
}
+void
+pager_dropweak (struct user_pager_info *upi __attribute__ ((unused)))
+{
+}
+
+
/* Create a the DISK pager, initializing DISKPAGER, and DISKPAGERPORT */
@@ -463,14 +461,6 @@ diskfs_get_filemap (struct node *np)
upi->p = pager_create (upi, pager_bucket,
MAY_CACHE, MEMORY_OBJECT_COPY_DELAY);
np->dn->fileinfo = upi;
-
- spin_lock (&pagerlistlock);
- upi->next = filepagerlist;
- upi->prevp = &filepagerlist;
- if (upi->next)
- upi->next->prevp = &upi->next;
- filepagerlist = upi;
- spin_unlock (&pagerlistlock);
}
right = pager_get_port (np->dn->fileinfo->p);
spin_unlock (&node2pagelock);
@@ -531,64 +521,39 @@ diskfs_get_filemap_pager_struct (struct node *np)
return np->dn->fileinfo->p;
}
-/* Call function FUNC (which takes one argument, a pager) on each pager, with
- all file pagers being processed before the disk pager. Make the calls
- while holding no locks. */
-static void
-pager_traverse (void (*func)(struct user_pager_info *))
-{
- struct user_pager_info *p;
- struct item {struct item *next; struct user_pager_info *p;} *list = 0;
- struct item *i;
-
- spin_lock (&pagerlistlock);
- for (p = filepagerlist; p; p = p->next)
- {
- i = alloca (sizeof (struct item));
- i->next = list;
- list = i;
- ports_port_ref (p->p);
- i->p = p;
- }
- spin_unlock (&pagerlistlock);
-
- for (i = list; i; i = i->next)
- {
- (*func)(i->p);
- ports_port_deref (i->p->p);
- }
-
- (*func)(diskpager);
-}
-
/* Shutdown all the pagers. */
void
diskfs_shutdown_pager ()
{
- void shutdown_one (struct user_pager_info *p)
+ error_t shutdown_one (struct pager *p)
{
- pager_shutdown (p->p);
+ /* Make sure the disk pager is done last. */
+ if (p->upi != diskpager)
+ pager_shutdown (p);
+ return 0;
}
copy_sblock ();
write_all_disknodes ();
- pager_traverse (shutdown_one);
+ ports_bucket_iterate (pager_bucket, shutdown_one);
+ pager_shutdown (diskpager->p);
}
/* Sync all the pagers. */
void
diskfs_sync_everything (int wait)
{
- void sync_one (struct user_pager_info *p)
+ error_t sync_one (struct pager *p)
{
+ /* Make sure the disk pager is done last. */
if (p != diskpager)
- pager_sync (p->p, wait);
- else
- sync_disk (wait);
+ pager_sync (p, wait);
+ return 0;
}
copy_sblock ();
write_all_disknodes ();
- pager_traverse (sync_one);
+ ports_bucket_iterate (pager_bucket, sync_one);
+ sync_disk (wait);
}