summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1994-06-02 17:31:45 +0000
committerMichael I. Bushnell <mib@gnu.org>1994-06-02 17:31:45 +0000
commit3041ad64ac920872650a5ea5cd782c61e10eb726 (patch)
tree0653c1d5fbc9e06f0f0603a13c33faafebe3f632
parent3bd314651358d830a46dd2c687d517abef7cbc36 (diff)
Formerly hyper.c.~5~
-rw-r--r--ufs/hyper.c44
1 files changed, 32 insertions, 12 deletions
diff --git a/ufs/hyper.c b/ufs/hyper.c
index bd58b7e4..7bb8d7c8 100644
--- a/ufs/hyper.c
+++ b/ufs/hyper.c
@@ -72,22 +72,42 @@ diskfs_set_hypermetadata (int wait, int clean)
error_t (*writefn) (daddr_t, vm_address_t, long);
writefn = (wait ? dev_write_sync : dev_write);
- (*writefn)(fsbtodb (sblock->fs_csaddr), (vm_address_t) csum,
- sblock->fs_fsize * howmany (sblock->fs_cssize,
- sblock->fs_fsize));
+ spin_lock (&alloclock);
+ if (csum_dirty)
+ {
+ (*writefn)(fsbtodb (sblock->fs_csaddr), (vm_address_t) csum,
+ sblock->fs_fsize * howmany (sblock->fs_cssize,
+ sblock->fs_fsize));
+ csum_dirty = 0;
+ }
if (clean)
- sblock->fs_clean = 1;
- if (sblock->fs_postblformat == FS_42POSTBLFMT)
{
- char sblockcopy[SBSIZE];
- bcopy (sblock, sblockcopy, SBSIZE);
- ((struct fs *)sblockcopy)->fs_nrpos = -1;
- (*writefn) (SBLOCK, (vm_address_t) sblockcopy, SBSIZE);
+ sblock->fs_clean = 1;
+ sblock_dirty = 1;
+ }
+
+ if (sblock_dirty)
+ {
+ if (sblock->fs_postblformat == FS_42POSTBLFMT)
+ {
+ char sblockcopy[SBSIZE];
+ bcopy (sblock, sblockcopy, SBSIZE);
+ ((struct fs *)sblockcopy)->fs_nrpos = -1;
+ (*writefn) (SBLOCK, (vm_address_t) sblockcopy, SBSIZE);
+ }
+ else
+ (*writefn) (SBLOCK, (vm_address_t) sblock, SBSIZE);
+ sblock_dirty = 0;
}
- else
- (*writefn) (SBLOCK, (vm_address_t) sblock, SBSIZE);
- sblock->fs_clean = 0;
+
+ if (clean)
+ {
+ sblock->fs_clean = 0;
+ sblock_dirty = 1;
+ }
+
+ spin_unlock (&alloclock);
}