*** ffs_vfsops.c-	Wed Nov  1 07:37:15 1995
--- ffs_vfsops.c	Mon Apr  8 16:50:34 1996
***************
*** 674,679 ****
--- 674,683 ----
  	register struct ufsmount *ump = VFSTOUFS(mp);
  	register struct fs *fs;
  	int error, allerror = 0;
+ #ifdef REES
+ 	static int dirtydata;
+ 	int syncmeta;
+ #endif /* REES */
  
  	fs = ump->um_fs;
  	/*
***************
*** 693,698 ****
--- 697,713 ----
  	/*
  	 * Write back each (modified) inode.
  	 */
+ #ifdef REES
+ 	/*
+ 	 * Possibly dangerous power-saving hack:
+ 	 * If no data blocks were written at the last sync,
+ 	 * then don't write metadata this time.
+ 	 * The idea is to avoid spinning the disk up just to write new
+ 	 * atimes on things like /dev/pty0 and /dev/vga.
+ 	 */
+ 	syncmeta = dirtydata;
+ 	dirtydata = 0;
+ #endif /* REES */
  loop:
  	for (vp = mp->mnt_vnodelist.lh_first;
  	     vp != NULL;
***************
*** 706,713 ****
--- 721,736 ----
  		if (VOP_ISLOCKED(vp))
  			continue;
  		ip = VTOI(vp);
+ #ifndef REES
  		if ((ip->i_flag &
  		    (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0 &&
+ #else /* REES */
+ 		if (vp->v_dirtyblkhd.lh_first)
+ 			dirtydata++;
+ 		if ((!syncmeta ||
+ 		     (ip->i_flag &
+ 		      (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0) &&
+ #endif /* REES */
  		    vp->v_dirtyblkhd.lh_first == NULL)
  			continue;
  		if (vget(vp, 1))
