File: rc_rundown.c

package info (click to toggle)
fis-gtm 6.3-007-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 36,284 kB
  • sloc: ansic: 328,861; asm: 5,182; csh: 5,102; sh: 1,918; awk: 291; makefile: 69; sed: 13
file content (63 lines) | stat: -rwxr-xr-x 1,770 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/****************************************************************
 *								*
 *	Copyright 2001, 2010 Fidelity Information Services, Inc	*
 *								*
 *	This source code contains the intellectual property	*
 *	of its copyright holder(s), and is made available	*
 *	under a license.  If you do not know the terms of	*
 *	the license, please stop and do not read further.	*
 *								*
 ****************************************************************/

/* rc_rundown - GT.CM global database cleanup
 * Go through each global database and reset the "dsid" field in the header
 * to zero, indicating that GT.CM is not accessing this file.  This is
 * necessary so that GT.M processes will not try to access the GT.CM
 * semaphore lock.
 */

#include "mdef.h"
#include "rc.h"
#include "gtm_facility.h"
#include "fileinfo.h"
#include "gdsroot.h"
#include "gdsbt.h"
#include "gdsfhead.h"
#include "rc_nspace.h"
#include "filestruct.h"

GBLREF	rc_dsid_list		*dsid_list;
GBLREF	sgmnt_addrs		*cs_addrs;
GBLREF	sgmnt_data_ptr_t	cs_data;
GBLREF	gd_region		*gv_cur_region;

void rc_rundown(void)
{
	rc_dsid_list	*fdi_ptr;
	int dsid;

	for (fdi_ptr = dsid_list; fdi_ptr; fdi_ptr = fdi_ptr->next)
	{
		if (fdi_ptr->gda)
		{
			cs_addrs = &FILE_INFO(fdi_ptr->gda->maps[1].reg.addr)->s_addrs;
			gv_cur_region = fdi_ptr->gda->maps[1].reg.addr;

			cs_data = cs_addrs->hdr;
			dsid = cs_data->dsid;

			if (fdi_ptr->dsid != RC_NSPACE_DSID)
			{
			    assert(!cs_addrs->hold_onto_crit);	/* so we can safely do unconditional grab_crit and rel_crit */
			    grab_crit(gv_cur_region);
			    if (--cs_data->rc_srv_cnt <= 0)
			    {
				cs_data->rc_node = cs_data->dsid = 0;
				cs_data->rc_srv_cnt = 0;
				cs_addrs->hdr->dsid = 0;
			    }
			    rel_crit(gv_cur_region);
			}
		}
	}
}