summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1995-10-21 00:04:08 +0000
committerMiles Bader <miles@gnu.org>1995-10-21 00:04:08 +0000
commit817618ee8145ded8a3051fae33f9e4ff3bb4233a (patch)
treebb774d6fc65868587950e13381ba3a01c0cda62f
parenta3a91f82ceb982fc40bc27e44b7964500f9449a5 (diff)
(_pokel_exec, pokel_flush): New functions.
(pokel_sync): Use _pokel_exec to do the work.
-rw-r--r--ext2fs/pokel.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/ext2fs/pokel.c b/ext2fs/pokel.c
index 88fa57da..a6d1c65a 100644
--- a/ext2fs/pokel.c
+++ b/ext2fs/pokel.c
@@ -82,9 +82,10 @@ pokel_add (struct pokel *pokel, void *loc, vm_size_t length)
spin_unlock (&pokel->lock);
}
-/* Sync all the modified pieces of disk */
+/* Move all pending pokes from POKEL into its free list. If SYNC is true,
+ otherwise do nothing. */
void
-pokel_sync (struct pokel *pokel, int wait)
+_pokel_exec (struct pokel *pokel, int sync, int wait)
{
struct poke *pl, *pokes, *last = NULL;
@@ -94,10 +95,11 @@ pokel_sync (struct pokel *pokel, int wait)
spin_unlock (&pokel->lock);
for (pl = pokes; pl; last = pl, pl = pl->next)
- {
- ext2_debug ("syncing 0x%x[%ul]", pl->offset, pl->length);
- pager_sync_some (pokel->pager, pl->offset, pl->length, wait);
- }
+ if (sync)
+ {
+ ext2_debug ("syncing 0x%x[%ul]", pl->offset, pl->length);
+ pager_sync_some (pokel->pager, pl->offset, pl->length, wait);
+ }
if (last)
{
@@ -107,3 +109,17 @@ pokel_sync (struct pokel *pokel, int wait)
spin_unlock (&pokel->lock);
}
}
+
+/* Sync all the modified pieces of disk */
+void
+pokel_sync (struct pokel *pokel, int wait)
+{
+ _pokel_exec (pokel, 1, wait);
+}
+
+/* Flush (that is, drop on the ground) all pending pokes in POKEL. */
+void
+pokel_flush (struct pokel *pokel)
+{
+ _pokel_exec (pokel, 0, 0);
+}