XFS_TRANSACTION, log_flags); 
XFS_TRANSACTION, log_flags, tp->t_type); 
xfs_trans_reserve(	xfs_trans_t	*tp,	uint		blocks,	uint		logspace,	uint		rtextents,	uint		flags,	uint		logcount){	int		log_flags;	int		error;	int	rsvd;	error = 0;	rsvd = (tp->t_flags & XFS_TRANS_RESERVE) != 0;	/* Mark this thread as being in a transaction */        PFLAGS_SET_FSTRANS(&tp->t_pflags);	/*	 * Attempt to reserve the needed disk blocks by decrementing	 * the number needed from the number available.  This will	 * fail if the count would go below zero.	 */	if (blocks > 0) {		error = xfs_mod_incore_sb(tp->t_mountp, XFS_SBS_FDBLOCKS,					  -blocks, rsvd);		if (error != 0) {                        PFLAGS_RESTORE_FSTRANS(&tp->t_pflags);			return (XFS_ERROR(ENOSPC));		}		tp->t_blk_res += blocks;	}	/*	 * Reserve the log space needed for this transaction.	 */	if (logspace > 0) {		ASSERT((tp->t_log_res == 0) || (tp->t_log_res == logspace));		ASSERT((tp->t_log_count == 0) ||			(tp->t_log_count == logcount));		if (flags & XFS_TRANS_PERM_LOG_RES) {			log_flags = XFS_LOG_PERM_RESERV;			tp->t_flags |= XFS_TRANS_PERM_LOG_RES;		} else {			ASSERT(tp->t_ticket == NULL);			ASSERT(!(tp->t_flags & XFS_TRANS_PERM_LOG_RES));			log_flags = 0;		}		error = xfs_log_reserve(tp->t_mountp, logspace, logcount,					&tp->t_ticket,					XFS_TRANSACTION, log_flags);		if (error) {			goto undo_blocks;		}		tp->t_log_res = logspace;		tp->t_log_count = logcount;	}	/*	 * Attempt to reserve the needed realtime extents by decrementing	 * the number needed from the number available.  This will	 * fail if the count would go below zero.	 */	if (rtextents > 0) {		error = xfs_mod_incore_sb(tp->t_mountp, XFS_SBS_FREXTENTS,					  -rtextents, rsvd);		if (error) {			error = XFS_ERROR(ENOSPC);			goto undo_log;		}		tp->t_rtx_res += rtextents;	}	return 0;	/*	 * Error cases jump to one of these labels to undo any	 * reservations which have already been performed.	 */undo_log:	if (logspace > 0) {		if (flags & XFS_TRANS_PERM_LOG_RES) {			log_flags = XFS_LOG_REL_PERM_RESERV;		} else {			log_flags = 0;		}		xfs_log_done(tp->t_mountp, tp->t_ticket, NULL, log_flags);		tp->t_ticket = NULL;		tp->t_log_res = 0;		tp->t_flags &= ~XFS_TRANS_PERM_LOG_RES;	}undo_blocks:	if (blocks > 0) {		(void) xfs_mod_incore_sb(tp->t_mountp, XFS_SBS_FDBLOCKS,					 blocks, rsvd);		tp->t_blk_res = 0;	}        PFLAGS_RESTORE_FSTRANS(&tp->t_pflags);	return (error);}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/7e9c63961558092d584936a874cf3fee80002eb6/xfs_trans.c/buggy/fs/xfs/xfs_trans.c