summaryrefslogtreecommitdiff
path: root/libdiskfs
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1999-10-23 18:09:28 +0000
committerRoland McGrath <roland@gnu.org>1999-10-23 18:09:28 +0000
commitaf624dc18cabfe34d7df9256508715bb636bb9ec (patch)
treeb5702cdc68e60599b149cf609f68db4362658f7f /libdiskfs
parentadfbcfadb5203c66e44badf7068ee7960d0300f9 (diff)
1999-10-23 Roland McGrath <roland@baalperazim.frob.com>
* sync-interval.c (periodic_sync): With diskfs_fsys_lock reader lock held, check _diskfs_diskdirty and don't sync if not dirty.
Diffstat (limited to 'libdiskfs')
-rw-r--r--libdiskfs/sync-interval.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libdiskfs/sync-interval.c b/libdiskfs/sync-interval.c
index f2cb8570..8167fc4a 100644
--- a/libdiskfs/sync-interval.c
+++ b/libdiskfs/sync-interval.c
@@ -112,8 +112,14 @@ periodic_sync (int interval)
if (! diskfs_readonly)
{
rwlock_reader_lock (&diskfs_fsys_lock);
- diskfs_sync_everything (0);
- diskfs_set_hypermetadata (0, 0);
+ /* Only sync if we need to, to avoid clearing the clean flag
+ when it's just been set. Any other thread doing a sync
+ will have held the lock while it did its work. */
+ if (_diskfs_diskdirty)
+ {
+ diskfs_sync_everything (0);
+ diskfs_set_hypermetadata (0, 0);
+ }
rwlock_reader_unlock (&diskfs_fsys_lock);
}
ports_end_rpc (pi, &link);