Subject: Re: sys_sync
To: Charles M. Hannum <mycroft@mit.edu>
From: Jim Rees <rees@umich.edu>
List: port-i386
Date: 04/06/1996 15:23:41
  I suppose I could buy that.

This is a power saver on notebook computers, because it requires only one
sync to get everything out, so it lets the disk spin down 30 seconds sooner.

% diff -cb vfs_syscalls.c- vfs_syscalls.c
*** vfs_syscalls.c-	Wed Nov  8 07:35:06 1995
--- vfs_syscalls.c	Fri Apr  5 16:40:30 1996
***************
*** 421,432 ****
  	register struct mount *mp, *nmp;
  	int asyncflag;
  
! 	for (mp = mountlist.cqh_first; mp != (void *)&mountlist; mp = nmp) {
  		/*
  		 * Get the next pointer in case we hang on vfs_busy
  		 * while we are being unmounted.
  		 */
! 		nmp = mp->mnt_list.cqe_next;
  		/*
  		 * The lock check below is to avoid races with mount
  		 * and unmount.
--- 421,432 ----
  	register struct mount *mp, *nmp;
  	int asyncflag;
  
! 	for (mp = mountlist.cqh_last; mp != (void *)&mountlist; mp = nmp) {
  		/*
  		 * Get the next pointer in case we hang on vfs_busy
  		 * while we are being unmounted.
  		 */
! 		nmp = mp->mnt_list.cqe_prev;
  		/*
  		 * The lock check below is to avoid races with mount
  		 * and unmount.
***************
*** 442,448 ****
  			 * Get the next pointer again, as the next filesystem
  			 * might have been unmounted while we were sync'ing.
  			 */
! 			nmp = mp->mnt_list.cqe_next;
  			vfs_unbusy(mp);
  		}
  	}
--- 442,448 ----
  			 * Get the next pointer again, as the next filesystem
  			 * might have been unmounted while we were sync'ing.
  			 */
! 			nmp = mp->mnt_list.cqe_prev;
  			vfs_unbusy(mp);
  		}
  	}