|
|
1.1 root 1: /*
2: * Routines to handle the counting of links for each i-node
3: */
4:
5: #include "fsck.h"
6:
7: linkincr(inum)
8: ino_t inum;
9: {
10: if (inclinkctr(inum) == 0 )
11: fatal("Too many links in i-node, %d", inum);
12: }
13:
14: /*
15: * The following is the beginning of thinking of how to change
16: * the number of bits used in the link count tables from 8-per
17: * i-node to 2-per i-node, with additional tables for those
18: * i-nodes with more than 2 links. The changes would be to the
19: * definition of i_lnks, the macro linkctr(), the function linkincr(),
20: * and in init.c, the allocation of table space.
21: */
22:
23: #ifdef NEWLINKSTUFFF
24:
25: char *linkmap; /* table of inodes with one link */
26:
27: #define testlink(in) ( linkmap[((unsigned)bn)>>(LOGNBPC-1)] & \
28: 3 << (((unsigned)bn)&(NBPC>>1)) )
29: #define marklink(in) ( linkmap[((unsigned)bn)>>(LOGNBPC-1)] |= \
30: 1 << (((unsigned)bn)&(NBPC-2)) )
31: #define unmarklink(in) ( linkmap[((unsigned)bn)>>(LOGNBPC-1)] ^= \
32: 1 << (((unsigned)bn)&(NBPC-2)) )
33:
34: linkcntr(inum)
35: ino_t inum;
36: {
37: index = ((unsigned) inum) >> (LOGNBPC-1) ;
38: distance = ((unsigned) inum) & ((NBPC>>1) - 1) ;
39: mask = 3 << distance;
40: answer = ( linkmap[index] & mask ) >> distance;
41:
42: if ( answer < 3 )
43: return(answer);
44:
45: hash = inum & 0xFF;
46: bucket = &linktable[hash];
47: bktinum = bucket->inumb;
48:
49: if ( bktinum == inum ) {
50: answer = bucket->numlink;
51: if ( answer == 0xFF )
52: return( bigcntr(inum) );
53: else
54: return( answer + 3 );
55: }
56:
57: if ( bktinum > inum )
58: fatal("internal linktable corruption.");
59:
60:
61: }
62:
63: linkincr(inum)
64: ino_t inum;
65: {
66: }
67:
68: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.