Exemplo n.º 1
0
void	jnl_file_close(gd_region *reg, bool clean, bool dummy)
{
	jnl_file_header		header;
	sgmnt_addrs		*csa;
	jnl_private_control	*jpc;
	jnl_buffer_ptr_t	jb;
	struct_jrec_eof		eof_record;
	off_jnl_t		eof_addr;
	uint4			status;
	error_def		(ERR_PREMATEOF);
	error_def		(ERR_JNLCLOSE);
	error_def		(ERR_JNLWRERR);

	csa = &FILE_INFO(reg)->s_addrs;
	assert(csa->now_crit || (csa->hdr->clustered && (CCST_CLOSED == csa->nl->ccp_state)));
	ASSERT_JNLFILEID_NOT_NULL(csa)
	jpc = csa->jnl;
#if defined(UNIX)
	if (csa->dbsync_timer)
	{
		cancel_timer((TID)csa);
		csa->dbsync_timer = FALSE;
	}
#elif defined(VMS)
	/* See comment about ordering of the two statements below, in similar code in gds_rundown */
	if (csa->dbsync_timer)
	{
		csa->dbsync_timer = FALSE;
		++astq_dyn_avail;
	}
	sys$cantim(csa, PSL$C_USER);	/* cancel all dbsync-timers for this region */
#endif
	if ((NULL == jpc) || (NOJNL == jpc->channel))
		return;
	if (clean)
	{
		jb = jpc->jnl_buff;
		jnl_write_eof_rec(csa, &eof_record);
		jnl_flush(reg);
		assert(jb->dskaddr == jb->freeaddr);
		UNIX_ONLY(jnl_fsync(reg, jb->dskaddr);)
		UNIX_ONLY(assert(jb->freeaddr == jb->fsync_dskaddr);)
Exemplo n.º 2
0
void	jnl_file_close(gd_region *reg, bool clean, bool dummy)
{
	jnl_file_header		*header;
	unsigned char		hdr_base[REAL_JNL_HDR_LEN + MAX_IO_BLOCK_SIZE];
	sgmnt_addrs		*csa;
	sgmnt_data_ptr_t	csd;
	jnl_private_control	*jpc;
	jnl_buffer_ptr_t	jb;
	struct_jrec_eof		eof_record;
	off_jnl_t		eof_addr;
	uint4			status, read_write_size;
	int			rc, save_errno, idx;
	uint4			jnl_fs_block_size;

	csa = &FILE_INFO(reg)->s_addrs;
	csd = csa->hdr;
	assert(!clean || csa->now_crit || (csd->clustered && (CCST_CLOSED == csa->nl->ccp_state)));
	DEBUG_ONLY(
		if (clean)
			ASSERT_JNLFILEID_NOT_NULL(csa);
	)