Coda Distributed File System
recov_vollog.h
Go to the documentation of this file.
1/* BLURB lgpl
2
3 Coda File System
4 Release 8
5
6 Copyright (c) 1987-2025 Carnegie Mellon University
7 Additional copyrights listed below
8
9This code is distributed "AS IS" without warranty of any kind under
10the terms of the GNU Library General Public Licence Version 2, as
11shown in the file LICENSE. The technical and financial contributors to
12Coda are listed in the file CREDITS.
13
14 Additional copyrights
15 none currently
16
17#*/
18
19#ifndef _RECOV_VOLLOG_H
20#define _RECOV_VOLLOG_H 1
21/*
22 * recov_vollog.h
23 * Created 2/12/92 -- Puneet Kumar
24 * Declaration of the volume log structure in RVM
25 */
26
27#include <bitmap.h>
28
29#define LOGRECORD_BLOCKSIZE 32 /* # log records in each block allocated */
30#define VOLLOG_GROWSIZE 32 /* # log records to grow by */
31#define SEQNO_GROWSIZE \
32 200 /* increase seq no on log records in rvm every 200 spools */
33#define VERSION_NUMBER 1
34
35#define MAXWRAPTRIES 32 // no of tries to wrap around
36
37class recov_vol_log;
38class recle;
39class rec_dlist;
40class resstats;
41#include "res.h"
42#include <cvnode.h>
43#include <volume.h>
44
46
48 friend long RS_LockAndFetch(RPC2_Handle, ViceFid *, ResFetchType,
49 ViceVersionVector *, ResStatus *,
50 RPC2_Integer *);
51 friend void DumpLog(rec_dlist *, struct Volume *, char **, int *, int *);
52 friend int DumpVolDiskData(int, VolumeDiskData *);
53
54 // recoverable part
55 unsigned Version : 8; // version information for resolution system
56 unsigned malloced : 8;
57 int admin_limit; // absolute limit on # of log entries changed by volutil
58 int size; // <= admin_limit; number of entries in volume log
59 recle **index; // array of ptrs to log record blocks :
60 // size = admin_limit/LOGRECORD_BLOCKSIZE
61 int rec_max_seqno;
62 bitmap
63 recov_inuse; // bitmap in rvm to indicate if an index in the log is being used
64 VnodeId wrapvn; // vnode number of wrap around vnode
65 Unique_t wrapun; // uniquifier of wrap around vnode
66 int lastwrapindex; // index of last log entry that was wrapped over
67
68 // transient part - only in VM
69 int nused; // entries being used currently
70 bitmap *vm_inuse; // bitmap as above but only in VM
71 int max_seqno;
72
73 // private routines
74 int Grow(int = -1) REQUIRES_TRANSACTION;
75 void FreeBlock(int) REQUIRES_TRANSACTION;
76 void Increase_rec_max_seqno(int i = SEQNO_GROWSIZE);
77 void *IndexToAddr(int); // given an index, returns the address of block
78 void PrintUnreachableRecords(bitmap *);
79 int ChooseWrapAroundVnode(Volume *, int different = 0) EXCLUDES_TRANSACTION;
80
81public:
82 resstats *vmrstats; // res statistics (only in VM)
83 int reserved[10]; // for future use
84
85 void *operator new(size_t) REQUIRES_TRANSACTION;
86 recov_vol_log(VolumeId = 0, int adm = 4096); // default: max 4k log entries
88 void operator delete(void *) REQUIRES_TRANSACTION;
89 int init(int);
90 void ResetTransients(VolumeId = 0);
91
93
94 int AllocRecord(int *index, int *seqno); // in vm only
95 void DeallocRecord(int index); // in vm only
96 int AllocViaWrapAround(int *, int *, Volume *,
97 dlist * = NULL) EXCLUDES_TRANSACTION; // reuse record
98 recle *RecovPutRecord(int index) REQUIRES_TRANSACTION; // in rvm
99 void RecovFreeRecord(int index) REQUIRES_TRANSACTION; // in rvm
100 int bmsize();
101 int LogSize();
102
103 void purge() REQUIRES_TRANSACTION; // purge all the logs
105 void print();
106 void print(FILE *);
107 void print(int);
108};
109
110/* export definitions */
112extern void CreateResLog(Volume *, Vnode *);
113
114// subresphase3.c
115#endif /* _RECOV_VOLLOG_H */
Definition: bitmap.h:52
Definition: dlist.h:50
Definition: rec_dlist.h:49
Definition: recle.h:30
Definition: recov_vollog.h:47
recov_vol_log(VolumeId=0, int adm=4096)
Definition: recov_vollog.cc:69
~recov_vol_log()
Definition: recov_vollog.cc:112
int LogSize()
Definition: recov_vollog.cc:218
void RecovFreeRecord(int index) REQUIRES_TRANSACTION
Definition: recov_vollog.cc:320
friend void DumpLog(rec_dlist *, struct Volume *, char **, int *, int *)
Definition: ops.cc:542
void purge() REQUIRES_TRANSACTION
Definition: recov_vollog.cc:330
int AllocViaWrapAround(int *, int *, Volume *, dlist *=NULL) EXCLUDES_TRANSACTION
Definition: recov_vollog.cc:512
friend long RS_LockAndFetch(RPC2_Handle, ViceFid *, ResFetchType, ViceVersionVector *, ResStatus *, RPC2_Integer *)
Definition: reslock.cc:60
void DeallocRecord(int index)
Definition: recov_vollog.cc:283
void SalvageLog(bitmap *) REQUIRES_TRANSACTION
Definition: recov_vollog.cc:356
friend int DumpVolDiskData(int, VolumeDiskData *)
Definition: norton-reinit.cc:129
int init(int)
void Increase_Admin_Limit(int) REQUIRES_TRANSACTION
Definition: recov_vollog.cc:232
resstats * vmrstats
Definition: recov_vollog.h:82
void print()
Definition: recov_vollog.cc:398
void ResetTransients(VolumeId=0)
Definition: recov_vollog.cc:100
int reserved[10]
Definition: recov_vollog.h:83
int bmsize()
Definition: recov_vollog.cc:394
recle * RecovPutRecord(int index) REQUIRES_TRANSACTION
Definition: recov_vollog.cc:302
int AllocRecord(int *index, int *seqno)
Definition: recov_vollog.cc:264
Definition: resstats.h:215
#define REQUIRES_TRANSACTION
Definition: coda_tsa.h:107
#define EXCLUDES_TRANSACTION
Definition: coda_tsa.h:108
void CreateRootLog(Volume *, Vnode *) REQUIRES_TRANSACTION
Definition: ops.cc:314
#define SEQNO_GROWSIZE
Definition: recov_vollog.h:31
void CreateResLog(Volume *, Vnode *)
Definition: ops.cc:346
int32_t RPC2_Integer
Definition: rpc2.h:297
RPC2_Integer RPC2_Handle
Definition: rpc2.h:345
Definition: cvnode.h:155
Definition: volume.h:108
Definition: volume.h:234
#define NULL
Definition: voltypes.h:44