Commit Diff


commit - 17b19538a48c036dbdc8817d233c0086f327485c
commit + dce4cbabd1bbfa3a8acc05ae0b2c3a9df17f93d2
blob - bf61612c62090b4afa5f2bd4c6467accf2b8ab6d
blob + 7a528b681c3223b485bab7adb5ca09dbb119311a
--- src/cmd/venti/srv/icache.c
+++ src/cmd/venti/srv/icache.c
@@ -15,7 +15,19 @@ struct ICache
 	IHash	*hash;
 	IEntry	*entries;
 	int		nentries;
-	IEntry	free;
+
+	/*
+	* gcc 4.3 inlines the pushfirst loop in initicache,
+	* but the inliner incorrectly deduces that
+	* icache.free.next has a constant value
+	* throughout the loop.  (In fact, pushfirst
+	* assigns to it as ie->prev->next.)
+	* Marking it volatile should avoid this bug.
+	* The speed of linked list operations is dwarfed
+	* by the disk i/o anyway.
+	*/
+	volatile IEntry free;
+
 	IEntry	clean;
 	IEntry	dirty;
 	u32int	maxdirty;