LOGSYNC_UNLOCK(log); 
LOGSYNC_UNLOCK(log, flags); 
static int lmLogSync(struct jfs_log * log, int nosyncwait){	int logsize;	int written;		/* written since last syncpt */	int free;		/* free space left available */	int delta;		/* additional delta to write normally */	int more;		/* additional write granted */	struct lrd lrd;	int lsn;	struct logsyncblk *lp;	/*	 *      forward syncpt	 */	/* if last sync is same as last syncpt,	 * invoke sync point forward processing to update sync.	 */	if (log->sync == log->syncpt) {		LOGSYNC_LOCK(log);		/* ToDo: push dirty metapages out to disk *///              bmLogSync(log);		if (list_empty(&log->synclist))			log->sync = log->lsn;		else {			lp = list_entry(log->synclist.next,					struct logsyncblk, synclist);			log->sync = lp->lsn;		}		LOGSYNC_UNLOCK(log);	}	/* if sync is different from last syncpt,	 * write a SYNCPT record with syncpt = sync.	 * reset syncpt = sync	 */	if (log->sync != log->syncpt) {		struct jfs_sb_info *sbi;		/*		 * We need to make sure all of the "written" metapages		 * actually make it to disk		 */		list_for_each_entry(sbi, &log->sb_list, log_list) {			if (sbi->flag & JFS_NOINTEGRITY)				continue;			filemap_fdatawrite(sbi->ipbmap->i_mapping);			filemap_fdatawrite(sbi->ipimap->i_mapping);			filemap_fdatawrite(sbi->sb->s_bdev->bd_inode->i_mapping);		}		list_for_each_entry(sbi, &log->sb_list, log_list) {			if (sbi->flag & JFS_NOINTEGRITY)				continue;			filemap_fdatawait(sbi->ipbmap->i_mapping);			filemap_fdatawait(sbi->ipimap->i_mapping);			filemap_fdatawait(sbi->sb->s_bdev->bd_inode->i_mapping);		}		lrd.logtid = 0;		lrd.backchain = 0;		lrd.type = cpu_to_le16(LOG_SYNCPT);		lrd.length = 0;		lrd.log.syncpt.sync = cpu_to_le32(log->sync);		lsn = lmWriteRecord(log, NULL, &lrd, NULL);		log->syncpt = log->sync;	} else		lsn = log->lsn;	/*	 *      setup next syncpt trigger (SWAG)	 */	logsize = log->logsize;	logdiff(written, lsn, log);	free = logsize - written;	delta = LOGSYNC_DELTA(logsize);	more = min(free / 2, delta);	if (more < 2 * LOGPSIZE) {		jfs_warn("\n ... Log Wrap ... Log Wrap ... Log Wrap ...\n");		/*		 *      log wrapping		 *		 * option 1 - panic ? No.!		 * option 2 - shutdown file systems		 *            associated with log ?		 * option 3 - extend log ?		 */		/*		 * option 4 - second chance		 *		 * mark log wrapped, and continue.		 * when all active transactions are completed,		 * mark log vaild for recovery.		 * if crashed during invalid state, log state		 * implies invald log, forcing fsck().		 */		/* mark log state log wrap in log superblock */		/* log->state = LOGWRAP; */		/* reset sync point computation */		log->syncpt = log->sync = lsn;		log->nextsync = delta;	} else		/* next syncpt trigger = written + more */		log->nextsync = written + more;	/* return if lmLogSync() from outside of transaction, e.g., sync() */	if (nosyncwait)		return lsn;	/* if number of bytes written from last sync point is more	 * than 1/4 of the log size, stop new transactions from	 * starting until all current transactions are completed	 * by setting syncbarrier flag.	 */	if (written > LOGSYNC_BARRIER(logsize) && logsize > 32 * LOGPSIZE) {		set_bit(log_SYNCBARRIER, &log->flag);		jfs_info("log barrier on: lsn=0x%x syncpt=0x%x", lsn,			 log->syncpt);		/*		 * We may have to initiate group commit		 */		jfs_flush_journal(log, 0);	}	return lsn;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/7fab479bebb96b1b4888bdae9b42e1fa9c5d3f38/jfs_logmgr.c/buggy/fs/jfs/jfs_logmgr.c