Commit | Line | Data |
---|---|---|
805e021f CE |
1 | /*! |
2 | \addtogroup vldb-spec VLDB Server Interface | |
3 | @{ | |
4 | ||
5 | \page title AFS-3 Programmer's Reference: Volume Server/Volume Location | |
6 | Server Interface | |
7 | ||
8 | \author Edward R. Zayas | |
9 | Transarc Corporation | |
10 | \version 1.0 | |
11 | \date 29 August 1991 14:48 Copyright 1991 Transarc Corporation All Rights | |
12 | Reserved FS-00-D165 | |
13 | ||
14 | ||
15 | \page chap1 Chapter 1: Overview | |
16 | ||
17 | \section sec1-1 Section 1.1: Introduction | |
18 | ||
19 | \par | |
20 | This document describes the architecture and interfaces for two of the | |
21 | important agents of the AFS distributed file system, the Volume Server and the | |
22 | Volume Location Server. The Volume Server allows operations affecting entire | |
23 | AFS volumes to be executed, while the Volume Location Server provides a lookup | |
24 | service for volumes, identifying the server or set of servers on which volume | |
25 | instances reside. | |
26 | ||
27 | \section sec1-2 Section 1.2: Volumes | |
28 | ||
29 | \subsection sec1-2-1 Section 1.2.1: Definition | |
30 | ||
31 | \par | |
32 | The underlying concept manipulated by the two AFS servers examined by this | |
33 | document is the volume. Volumes are the basic mechanism for organizing the data | |
34 | stored within the file system. They provide the foundation for addressing, | |
35 | storing, and accessing file data, along with serving as the administrative | |
36 | units for replication, backup, quotas, and data motion between File Servers. | |
37 | \par | |
38 | Specifically, a volume is a container for a hierarchy of files, a connected | |
39 | file system subtree. In this respect, a volume is much like a traditional unix | |
40 | file system partition. Like a partition, a volume can be mounted in the sense | |
41 | that the root directory of the volume can be named within another volume at an | |
42 | AFS mount point. The entire file system hierarchy is built up in this manner, | |
43 | using mount points to glue together the individual subtrees resident within | |
44 | each volume. The root of this hierarchy is then mounted by each AFS client | |
45 | machine using a conventional unix mount point within the workstation's local | |
46 | file system. By convention, this entryway into the AFS domain is mounted on the | |
47 | /afs local directory. From a user's point of view, there is only a single mount | |
48 | point to the system; the internal mount points are generally transparent. | |
49 | ||
50 | \subsection sec1-2-2 Section 1.2.2: Volume Naming | |
51 | ||
52 | \par | |
53 | There are two methods by which volumes may be named. The first is via a | |
54 | human-readable string name, and the second is via a 32-bit numerical | |
55 | identifier. Volume identifiers, whether string or numerical, must be unique | |
56 | within any given cell. AFS mount points may use either representation to | |
57 | specify the volume whose root directory is to be accessed at the given | |
58 | position. Internally, however, AFS agents use the numerical form of | |
59 | identification exclusively, having to translate names to the corresponding | |
60 | 32-bit value. | |
61 | ||
62 | \subsection sec1-2-3 Section 1.2.3: Volume Types | |
63 | ||
64 | \par | |
65 | There are three basic volume types: read-write, read-only, and backup volumes. | |
66 | \li Read-write: The data in this volume may be both read and written by those | |
67 | clients authorized to do so. | |
68 | \li Read-only: It is possible to create one or more read-only snapshots of | |
69 | read-write volumes. The read-write volume serving as the source image is | |
70 | referred to as the parent volume. Each read-only clone, or child, instance must | |
71 | reside on a different unix disk partition than the other clones. Every clone | |
72 | instance generated from the same parent read-write volume has the identical | |
73 | volume name and numerical volume ID. This is the reason why no two clones may | |
74 | appear on the same disk partition, as there would be no way to differentiate | |
75 | the two. AFS clients are allowed to read files and directories from read-only | |
76 | volumes, but cannot overwrite them individually. However, it is possible to | |
77 | make changes to the read-write parent and then release the contents of the | |
78 | entire volume to all the read-only replicas. The release operation fails if it | |
79 | does not reach the appropriate replication sites. | |
80 | \li Backup: A backup volume is a special instance of a read-only volume. While | |
81 | it is also a read-only snapshot of a given read-write volume, only one instance | |
82 | is allowed to exist at any one time. Also, the backup volume must reside on the | |
83 | same partition as the parent read-write volume from which it was created. It is | |
84 | from a backup volume that the AFS backup system writes file system data to | |
85 | tape. In addition, backup volumes may be mounted into the file tree just like | |
86 | the other volume types. In fact, by convention, the backup volume for each | |
87 | user's home directory subtree is typically mounted as OldFiles in that | |
88 | directory. If a user accidentally deletes a file that resides in the backup | |
89 | snapshot, the user may simply copy it out of the backup directly without the | |
90 | assistance of a system administrator, or any kind of tape restore operation. | |
91 | Backup volume are implemented in a copy-on-write fashion. Thus, backup volumes | |
92 | may be envisioned as consisting of a set of pointers to the true data objects | |
93 | in the base read-write volume when they are first created. When a file is | |
94 | overwritten in the read-write version for the first time after the backup | |
95 | volume was created, the original data is physically written to the backup | |
96 | volume, breaking the copyon-write link. With this mechanism, backup volumes | |
97 | maintain the image of the read-write volume at the time the snapshot was taken | |
98 | using the minimum amount of additional disk space. | |
99 | ||
100 | \section sec1-3 Section 1.3: Scope | |
101 | ||
102 | \par | |
103 | This paper is a member of a documentation suite providing specifications of the | |
104 | operation and interfaces offered by the various AFS servers and agents. The | |
105 | scope of this work is to provide readers with a sufficiently detailed | |
106 | description of the Volume Location Server and the Volume Server so that they | |
107 | may construct client applications which call their RPC interface routines. | |
108 | ||
109 | \section sec1-4 Section 1.4: Document Layout | |
110 | ||
111 | \par | |
112 | After this introductory portion of the document, Chapters 2 and 3 examine the | |
113 | architecture and RPC interface of the Volume Location Server and its replicated | |
114 | database. Similarly, Chapters 4 and 5 describe the architecture and RPC | |
115 | interface of the Volume Server. | |
116 | ||
117 | \page chap2 Chapter 2: Volume Location Server Architecture | |
118 | ||
119 | \section sec2-1 Section 2.1: Introduction | |
120 | ||
121 | \par | |
122 | The Volume Location Server allows AFS agents to query the location and basic | |
123 | status of volumes resident within the given cell. Volume Location Server | |
124 | functions may be invoked directly from authorized users via the vos utility. | |
125 | \par | |
126 | This chapter briefly discusses various aspects of the Volume Location Server's | |
127 | architecture. First, the need for volume location is examined, and the specific | |
128 | parties that call the Volume Location Server interface routines are identified. | |
129 | Then, the database maintained to provide volume location service, the Volume | |
130 | Location Database (VLDB), is examined. Finally, the vlserver process which | |
131 | implements the Volume Location Server is considered. | |
132 | \par | |
133 | As with all AFS servers, the Volume Location Server uses the Rx remote | |
134 | procedure call package for communication with its clients. | |
135 | ||
136 | \section sec2-2 Section 2.2: The Need For Volume Location | |
137 | ||
138 | \par | |
139 | The Cache Manager agent is the primary consumer of AFS volume location service, | |
140 | on which it is critically dependent for its own operation. The Cache Manager | |
141 | needs to map volume names or numerical identifiers to the set of File Servers | |
142 | on which its instances reside in order to satisfy the file system requests it | |
143 | is processing on behalf of it clients. Each time a Cache Manager encounters a | |
144 | mount point for which it does not have location information cached, it must | |
145 | acquire this information before the pathname resolution may be successfully | |
146 | completed. Once the File Server set is known for a particular volume, the Cache | |
147 | Manager may then select the proper site among them (e.g. choosing the single | |
148 | home for a read-write volume, or randomly selecting a site from a read-only | |
149 | volume's replication set) and begin addressing its file manipulation operations | |
150 | to that specific server. | |
151 | \par | |
152 | While the Cache Manager consults the volume location service, it is not capable | |
153 | of changing the location of volumes and hence modifying the information | |
154 | contained therein. This capability to perform acts which change volume location | |
155 | is concentrated within the Volume Server. The Volume Server process running on | |
156 | each server machine manages all volume operations affecting that platform, | |
157 | including creations, deletions, and movements between servers. It must update | |
158 | the volume location database every time it performs one of these actions. | |
159 | \par | |
160 | None of the other AFS system agents has a need to access the volume location | |
161 | database for its site. Surprisingly, this also applies to the File Server | |
162 | process. It is only aware of the specific set of volumes that reside on the set | |
163 | of physical disks directly attached to the machine on which they execute. It | |
164 | has no knowlege of the universe of volumes resident on other servers, either | |
165 | within its own cell or in foreign cells. | |
166 | ||
167 | \section sec2-3 Section 2.3: The VLDB | |
168 | ||
169 | \par | |
170 | The Volume Location Database (VLDB) is used to allow AFS application programs | |
171 | to discover the location of any volume within its cell, along with select | |
172 | information about the nature and state of that volume. It is organized in a | |
173 | very straightforward fashion, and uses the ubik [4] [5] facility to to provide | |
174 | replication across multiple server sites. | |
175 | ||
176 | \subsection sec2-3-1 Section 2.3.1: Layout | |
177 | ||
178 | \par | |
179 | The VLDB itself is a very simple structure, and synchronized copies may be | |
180 | maintained at two or more sites. Basically, each copy consists of header | |
181 | information, followed by a linear (yet unbounded) array of entries. There are | |
182 | several associated hash tables used to perform lookups into the VLDB. The first | |
183 | hash table looks up volume location information based on the volume's name. | |
184 | There are three other hash tables used for lookup, based on volume ID/type | |
185 | pairs, one for each possible volume type. | |
186 | \par | |
187 | The VLDB for a large site may grow to contain tens of thousands of entries, so | |
188 | some attempts were made to make each entry as small as possible. For example, | |
189 | server addresses within VLDB entries are represented as single-byte indicies | |
190 | into a table containing the full longword IP addresses. | |
191 | \par | |
192 | A free list is kept for deleted VLDB entries. The VLDB will not grow unless all | |
193 | the entries on the free list have been exhausted, keeping it as compact as | |
194 | possible. | |
195 | ||
196 | \subsection sec2-3-2 Section 2.3.2: Database Replication | |
197 | ||
198 | \par | |
199 | The VLDB, along with other important AFS databases, may be replicated to | |
200 | multiple sites to improve its availability. The ubik replication package is | |
201 | used to implement this functionality for the VLDB. A full description of ubik | |
202 | and of the quorum completion algorithm it implements may be found in [4] and | |
203 | [5]. The basic abstraction provided by ubik is that of a disk file replicated | |
204 | to multiple server locations. One machine is considered to be the | |
205 | synchronization site, handling all write operations on the database file. Read | |
206 | operations may be directed to any of the active members of the quorum, namely a | |
207 | subset of the replication sites large enough to insure integrity across such | |
208 | failures as individual server crashes and network partitions. All of the quorum | |
209 | members participate in regular elections to determine the current | |
210 | synchronization site. The ubik algorithms allow server machines to enter and | |
211 | exit the quorum in an orderly and consistent fashion. All operations to one of | |
212 | these replicated "abstract files" are performed as part of a transaction. If | |
213 | all the related operations performed under a transaction are successful, then | |
214 | the transaction is committed, and the changes are made permanent. Otherwise, | |
215 | the transaction is aborted, and all of the operations for that transaction are | |
216 | undone. | |
217 | ||
218 | \section sec2-4 Section 2.4: The vlserver Process | |
219 | ||
220 | \par | |
221 | The user-space vlserver process is in charge of providing volume location | |
222 | service for AFS clients. This program maintains the VLDB replica at its | |
223 | particular server, and cooperates with all other vlserver processes running in | |
224 | the given cell to propagate updates to the database. It implements the RPC | |
225 | interface defined in the vldbint.xg definition file for the rxgen RPC stub | |
226 | generator program. As part of its startup sequence, it must discover the VLDB | |
227 | version it has on its local disk, move to join the quorum of replication sites | |
228 | for the VLDB, and get the latest version if the one it came up with was out of | |
229 | date. Eventually, it will synchronize with the other VLDB replication sites, | |
230 | and it will begin accepting calls. | |
231 | \par | |
232 | The vlserver program uses at most three Rx worker threads to listen for | |
233 | incoming Volume Location Server calls. It has a single, optional command line | |
234 | argument. If the string "-noauth" appears when the program is invoked, then | |
235 | vlserver will run in an unauthenticated mode where any individual is considered | |
236 | authorized to perform any VLDB operation. This mode is necessary when first | |
237 | bootstrapping an AFS installation. | |
238 | ||
239 | \page chap3 Chapter 3: Volume Location Server Interface | |
240 | ||
241 | \section sec3-1 Section 3.1: Introduction | |
242 | ||
243 | \par | |
244 | This chapter documents the API for the Volume Location Server facility, as | |
245 | defined by the vldbint.xg Rxgen interface file and the vldbint.h include file. | |
246 | Descriptions of all the constants, structures, macros, and interface functions | |
247 | available to the application programmer appear here. | |
248 | \par | |
249 | It is expected that Volume Location Server client programs run in user space, | |
250 | as does the associated vos volume utility. However, the kernel-resident Cache | |
251 | Manager agent also needs to call a subset of the Volume Location Server's RPC | |
252 | interface routines. Thus, a second Volume Location Server interface is | |
253 | available, built exclusively to satisfy the Cache Manager's limited needs. This | |
254 | subset interface is defined by the afsvlint.xg Rxgen interface file, and is | |
255 | examined in the final section of this chapter. | |
256 | ||
257 | \section sec3-2 3.2: Constants | |
258 | ||
259 | \par | |
260 | This section covers the basic constant definitions of interest to the Volume | |
261 | Location Server application programmer. These definitions appear in the | |
262 | vldbint.h file, automatically generated from the vldbint.xg Rxgen interface | |
263 | file, and in vlserver.h. | |
264 | \par | |
265 | Each subsection is devoted to describing the constants falling into the | |
266 | following categories: | |
267 | \li Configuration and boundary quantities | |
268 | \li Update entry bits | |
269 | \li List-by-attribute bits | |
270 | \li Volume type indices | |
271 | \li States for struct vlentry | |
272 | \li States for struct vldbentry | |
273 | \li ReleaseType argument values | |
274 | \li Miscellaneous items | |
275 | ||
276 | \subsection sec3-2-1 Section 3.2.1: Configuration and Boundary | |
277 | Quantities | |
278 | ||
279 | \par | |
280 | These constants define some basic system values, including configuration | |
281 | information. | |
282 | ||
283 | \par Name | |
284 | MAXNAMELEN | |
285 | \par Value | |
286 | 65 | |
287 | \par Description | |
288 | Maximum size of various character strings, including volume name fields in | |
289 | structures and host names. | |
290 | ||
291 | \par Name | |
292 | MAXNSERVERS | |
293 | \par Value | |
294 | 8 | |
295 | \par Description | |
296 | Maximum number of replications sites for a volume. | |
297 | ||
298 | \par Name | |
299 | MAXTYPES | |
300 | \par Value | |
301 | 3 | |
302 | \par Description | |
303 | Maximum number of volume types. | |
304 | ||
305 | \par Name | |
306 | VLDBVERSION | |
307 | \par Value | |
308 | 1 | |
309 | \par Description | |
310 | VLDB database version number | |
311 | ||
312 | \par Name | |
313 | HASHSIZE | |
314 | \par Value | |
315 | 8,191 | |
316 | \par Description | |
317 | Size of internal Volume Location Server volume name and volume ID hash tables. | |
318 | This must always be a prime number. | |
319 | ||
320 | \par Name | |
321 | NULLO | |
322 | \par Value | |
323 | 0 | |
324 | \par Description | |
325 | Specifies a null pointer value. | |
326 | ||
327 | \par Name | |
328 | VLDBALLOCCOUNT | |
329 | \par Value | |
330 | 40 | |
331 | \par Description | |
332 | Value used when allocating memory internally for VLDB entry records. | |
333 | ||
334 | \par Name | |
335 | BADSERVERID | |
336 | \par Value | |
337 | 255 | |
338 | \par Description | |
339 | Illegal Volume Location Server host ID. | |
340 | ||
341 | \par Name | |
342 | MAXSERVERID | |
343 | \par Value | |
344 | 30 | |
345 | \par Description | |
346 | Maximum number of servers appearing in the VLDB. | |
347 | ||
348 | \par Name | |
349 | MAXSERVERFLAG | |
350 | \par Value | |
351 | 0x80 | |
352 | \par Description | |
353 | First unused flag value in such fields as serverFlags in struct vldbentry and | |
354 | RepsitesNewFlags in struct VldbUpdateEntry. | |
355 | ||
356 | \par Name | |
357 | MAXPARTITIONID | |
358 | \par Value | |
359 | 126 | |
360 | \par Description | |
361 | Maximum number of AFS disk partitions for any one server. | |
362 | ||
363 | \par Name | |
364 | MAXBUMPCOUNT | |
365 | \par Value | |
366 | 0x7fffffff | |
367 | \par Description | |
368 | Maximum interval that the current high-watermark value for a volume ID can be | |
369 | increased in one operation. | |
370 | ||
371 | \par Name | |
372 | MAXLOCKTIME | |
373 | \par Value | |
374 | 0x7fffffff | |
375 | \par Description | |
376 | Maximum number of seconds that any VLDB entry can remain locked. | |
377 | ||
378 | \par Name | |
379 | SIZE | |
380 | \par Value | |
381 | 1,024 | |
382 | \par Description | |
383 | Maximum size of the name field within a struct. | |
384 | ||
385 | \subsection sec3-2-2 Section 3.2.2: Update Entry Bits | |
386 | ||
387 | \par | |
388 | These constants define bit values for the Mask field in the struct | |
389 | VldbUpdateEntry. Specifically, setting these bits is equivalent to declaring | |
390 | that the corresponding field within an object of type struct VldbUpdateEntry | |
391 | has been set. For example, setting the VLUPDATE VOLUMENAME flag in Mask | |
392 | indicates that the name field contains a valid value. | |
393 | ||
394 | \par Name | |
395 | VLUPDATE VOLUMENAME | |
396 | \par Value | |
397 | 0x0001 | |
398 | \par Description | |
399 | If set, indicates that the name field is valid. | |
400 | ||
401 | \par Name | |
402 | VLUPDATE VOLUMETYPE | |
403 | \par Value | |
404 | 0x0002 | |
405 | \par Description | |
406 | If set, indicates that the volumeType field is valid. | |
407 | ||
408 | \par Name | |
409 | VLUPDATE FLAGS | |
410 | \par Value | |
411 | 0x0004 | |
412 | \par Description | |
413 | If set, indicates that the flags field is valid. | |
414 | ||
415 | \par Name | |
416 | VLUPDATE READONLYID | |
417 | \par Value | |
418 | 0x0008 | |
419 | \par Description | |
420 | If set, indicates that the ReadOnlyId field is valid. | |
421 | ||
422 | \par Name | |
423 | VLUPDATE BACKUPID | |
424 | \par Value | |
425 | 0x0010 | |
426 | \par Description | |
427 | If set, indicates that the BackupId field is valid. | |
428 | ||
429 | \par Name | |
430 | VLUPDATE REPSITES | |
431 | \par Value | |
432 | 0x0020 | |
433 | \par Description | |
434 | If set, indicates that the nModifiedRepsites field is valid. | |
435 | ||
436 | \par Name | |
437 | VLUPDATE CLONEID | |
438 | \par Value | |
439 | 0x0080 | |
440 | \par Description | |
441 | If set, indicates that the cloneId field is valid. | |
442 | ||
443 | \par Name | |
444 | VLUPDATE REPS DELETE | |
445 | \par Value | |
446 | 0x0100 | |
447 | \par Description | |
448 | Is the replica being deleted? | |
449 | ||
450 | \par Name | |
451 | VLUPDATE REPS ADD | |
452 | \par Value | |
453 | 0x0200 | |
454 | \par Description | |
455 | Is the replica being added? | |
456 | ||
457 | \par Name | |
458 | VLUPDATE REPS MODSERV | |
459 | \par Value | |
460 | 0x0400 | |
461 | \par Description | |
462 | Is the server part of the replica location correct? | |
463 | ||
464 | \par Name | |
465 | VLUPDATE REPS MODPART | |
466 | \par Value | |
467 | 0x0800 | |
468 | \par Description | |
469 | Is the partition part of the replica location correct? | |
470 | ||
471 | \par Name | |
472 | VLUPDATE REPS MODFLAG | |
473 | \par Value | |
474 | 0x1000 | |
475 | \par Description | |
476 | Various modification flag values. | |
477 | ||
478 | \subsection sec3-2-3 Section 3.2.3: List-By-Attribute Bits | |
479 | ||
480 | \par | |
481 | These constants define bit values for the Mask field in the struct | |
482 | VldbListByAttributes is to be used in a match. Specifically, setting these bits | |
483 | is equivalent to declaring that the corresponding field within an object of | |
484 | type struct VldbListByAttributes is set. For example, setting the VLLIST SERVER | |
485 | flag in Mask indicates that the server field contains a valid value. | |
486 | ||
487 | \par Name | |
488 | VLLIST SERVER | |
489 | \par Value | |
490 | 0x1 | |
491 | \par Description | |
492 | If set, indicates that the server field is valid. | |
493 | ||
494 | \par Name | |
495 | VLLIST PARTITION | |
496 | \par Value | |
497 | 0x2 | |
498 | \par Description | |
499 | If set, indicates that the partition field is valid. | |
500 | ||
501 | \par Name | |
502 | VLLIST VOLUMETYPE | |
503 | \par Value | |
504 | 0x4 | |
505 | \par Description | |
506 | If set, indicates that the volumetype field is valid. | |
507 | ||
508 | \par Name | |
509 | VLLIST VOLUMEID | |
510 | \par Value | |
511 | 0x8 | |
512 | \par Description | |
513 | If set, indicates that the volumeid field is valid. | |
514 | ||
515 | \par Name | |
516 | VLLIST FLAG | |
517 | \par Value | |
518 | 0x10 | |
519 | \par Description | |
520 | If set, indicates that that flag field is valid. | |
521 | ||
522 | \subsection sec3-2-4 Section 3.2.4: Volume Type Indices | |
523 | ||
524 | \par | |
525 | These constants specify the order of entries in the volumeid array in an object | |
526 | of type struct vldbentry. They also identify the three different types of | |
527 | volumes in AFS. | |
528 | ||
529 | \par Name | |
530 | RWVOL | |
531 | \par Value | |
532 | 0 | |
533 | \par Description | |
534 | Read-write volume. | |
535 | ||
536 | \par Name | |
537 | ROVOL | |
538 | \par Value | |
539 | 1 | |
540 | \par Description | |
541 | Read-only volume. | |
542 | ||
543 | \par Name | |
544 | BACKVOL | |
545 | \par Value | |
546 | 2 | |
547 | \par Description | |
548 | Backup volume. | |
549 | ||
550 | \subsection sec3-2-5 Section 3.2.5: States for struct vlentry | |
551 | ||
552 | \par | |
553 | The following constants appear in the flags field in objects of type struct | |
554 | vlentry. The first three values listed specify the state of the entry, while | |
555 | all the rest stamp the entry with the type of an ongoing volume operation, such | |
556 | as a move, clone, backup, deletion, and dump. These volume operations are the | |
557 | legal values to provide to the voloper parameter of the VL SetLock() interface | |
558 | routine. | |
559 | \par | |
560 | For convenience, the constant VLOP ALLOPERS is defined as the inclusive OR of | |
561 | the above values from VLOP MOVE through VLOP DUMP. | |
562 | ||
563 | \par Name | |
564 | VLFREE | |
565 | \par Value | |
566 | 0x1 | |
567 | \par Description | |
568 | Entry is in the free list. | |
569 | ||
570 | \par Name | |
571 | VLDELETED | |
572 | \par Value | |
573 | 0x2 | |
574 | \par Description | |
575 | Entry is soft-deleted. | |
576 | ||
577 | \par Name | |
578 | VLLOCKED | |
579 | \par Value | |
580 | 0x4 | |
581 | \par Description | |
582 | Advisory lock held on the entry. | |
583 | ||
584 | \par Name | |
585 | VLOP MOVE | |
586 | \par Value | |
587 | 0x10 | |
588 | \par Description | |
589 | The associated volume is being moved between servers. | |
590 | ||
591 | \par Name | |
592 | VLOP RELEASE | |
593 | \par Value | |
594 | 0x20 | |
595 | \par Description | |
596 | The associated volume is being cloned to its replication sites. | |
597 | ||
598 | \par Name | |
599 | VLOP BACKUP | |
600 | \par Value | |
601 | 0x40 | |
602 | \par Description | |
603 | A backup volume is being created for the associated volume. | |
604 | ||
605 | \par Name | |
606 | VLOP DELETE | |
607 | \par Value | |
608 | 0x80 | |
609 | \par Description | |
610 | The associated volume is being deleted. | |
611 | ||
612 | \par Name | |
613 | VLOP DUMP | |
614 | \par Value | |
615 | 0x100 | |
616 | \par Description | |
617 | A dump is being taken of the associated volume. | |
618 | ||
619 | \subsection sec3-2-6 Section 3.2.6: States for struct vldbentry | |
620 | ||
621 | \par | |
622 | Of the following constants, the first three appear in the flags field within an | |
623 | object of type struct vldbentry, advising of the existence of the basic volume | |
624 | types for the given volume, and hence the validity of the entries in the | |
625 | volumeId array field. The rest of the values provided in this table appear in | |
626 | the serverFlags array field, and apply to the instances of the volume appearing | |
627 | in the various replication sites. | |
628 | \par | |
629 | This structure appears in numerous Volume Location Server interface calls, | |
630 | namely VL CreateEntry(), VL GetEntryByID(), VL GetEntryByName(), VL | |
631 | ReplaceEntry() and VL ListEntry(). | |
632 | ||
633 | \par Name | |
634 | VLF RWEXISTS | |
635 | \par Value | |
636 | 0x1000 | |
637 | \par Description | |
638 | The read-write volume ID is valid. | |
639 | ||
640 | \par Name | |
641 | VLF ROEXISTS | |
642 | \par Value | |
643 | 0x2000 | |
644 | \par Description | |
645 | The read-only volume ID is valid. | |
646 | ||
647 | \par Name | |
648 | VLF BACKEXISTS | |
649 | \par Value | |
650 | 0x4000 | |
651 | \par Description | |
652 | The backup volume ID is valid. | |
653 | ||
654 | \par Name | |
655 | VLSF NEWREPSITE | |
656 | \par Value | |
657 | 0x01 | |
658 | \par Description | |
659 | Not used; originally intended to mark an entry as belonging to a | |
660 | partially-created volume instance. | |
661 | ||
662 | \par Name | |
663 | VLSF ROVOL | |
664 | \par Value | |
665 | 0x02 | |
666 | \par Description | |
667 | A read-only version of the volume appears at this server. | |
668 | ||
669 | \par Name | |
670 | VLSF RWVOL | |
671 | \par Value | |
672 | 0x02 | |
673 | \par Description | |
674 | A read-write version of the volume appears at this server. | |
675 | ||
676 | \par Name | |
677 | VLSF BACKVOL | |
678 | \par Value | |
679 | 0x08 | |
680 | \par Description | |
681 | A backup version of the volume appears at this server. | |
682 | ||
683 | \subsection sec3-2-7 Section 3.2.7: ReleaseType Argument Values | |
684 | ||
685 | \par | |
686 | The following values are used in the ReleaseType argument to various Volume | |
687 | Location Server interface routines, namely VL ReplaceEntry(), VL UpdateEntry() | |
688 | and VL ReleaseLock(). | |
689 | ||
690 | \par Name | |
691 | LOCKREL TIMESTAMP | |
692 | \par Value | |
693 | 1 | |
694 | \par Description | |
695 | Is the LockTimestamp field valid? | |
696 | ||
697 | \par Name | |
698 | LOCKREL OPCODE | |
699 | \par Value | |
700 | 2 | |
701 | \par Description | |
702 | Are any of the bits valid in the flags field? | |
703 | ||
704 | \par Name | |
705 | LOCKREL AFSID | |
706 | \par Value | |
707 | 4 | |
708 | \par Description | |
709 | Is the LockAfsId field valid? | |
710 | ||
711 | \subsection sec3-2-8 Section 3.2.8: Miscellaneous | |
712 | ||
713 | \par | |
714 | Miscellaneous values. | |
715 | \par Name | |
716 | VLREPSITE NEW | |
717 | \par Value | |
718 | 1 | |
719 | \par Description | |
720 | Has a replication site gotten a new release of a volume? | |
721 | \par | |
722 | A synonym for this constant is VLSF NEWREPSITE. | |
723 | ||
724 | \section sec3-3 Section 3.3: Structures and Typedefs | |
725 | ||
726 | \par | |
727 | This section describes the major exported Volume Location Server data | |
728 | structures of interest to application programmers, along with the typedefs | |
729 | based upon those structures. | |
730 | ||
731 | \subsection sec3-3-1 Section 3.3.1: struct vldbentry | |
732 | ||
733 | \par | |
734 | This structure represents an entry in the VLDB as made visible to Volume | |
735 | Location Server clients. It appears in numerous Volume Location Server | |
736 | interface calls, namely VL CreateEntry(), VL GetEntryByID(), VL | |
737 | GetEntryByName(), VL ReplaceEntry() and VL ListEntry(). | |
738 | \n \b Fields | |
739 | \li char name[] - The string name for the volume, with a maximum length of | |
740 | MAXNAMELEN (65) characters, including the trailing null. | |
741 | \li long volumeType - The volume type, one of RWVOL, ROVOL, or BACKVOL. | |
742 | \li long nServers - The number of servers that have an instance of this volume. | |
743 | \li long serverNumber[] - An array of indices into the table of servers, | |
744 | identifying the sites holding an instance of this volume. There are at most | |
745 | MAXNSERVERS (8) of these server sites allowed by the Volume Location Server. | |
746 | \li long serverPartition[] - An array of partition identifiers, corresponding | |
747 | directly to the serverNumber array, specifying the partition on which each of | |
748 | those volume instances is located. As with the serverNumber array, | |
749 | serverPartition has up to MAXNSERVERS (8) entries. | |
750 | \li long serverFlags[] - This array holds one flag value for each of the | |
751 | servers in the previous arrays. Again, there are MAXNSERVERS (8) slots in this | |
752 | array. | |
753 | \li u long volumeId[] - An array of volume IDs, one for each volume type. There | |
754 | are MAXTYPES slots in this array. | |
755 | \li long cloneId - This field is used during a cloning operation. | |
756 | \li long flags - Flags concerning the status of the fields within this | |
757 | structure; see Section 3.2.6 for the bit values that apply. | |
758 | ||
759 | \subsection sec3-3-2 Section 3.3.2: struct vlentry | |
760 | ||
761 | \par | |
762 | This structure is used internally by the Volume Location Server to fully | |
763 | represent a VLDB entry. The client-visible struct vldbentry represents merely a | |
764 | subset of the information contained herein. | |
765 | \n \b Fields | |
766 | \li u long volumeId[] - An array of volume IDs, one for each of the MAXTYPES of | |
767 | volume types. | |
768 | \li long flags - Flags concerning the status of the fields within this | |
769 | structure; see Section 3.2.6 for the bit values that apply. | |
770 | \li long LockAfsId - The individual who locked the entry. This feature has not | |
771 | yet been implemented. | |
772 | \li long LockTimestamp - Time stamp on the entry lock. | |
773 | \li long cloneId - This field is used during a cloning operation. | |
774 | \li long AssociatedChain - Pointer to the linked list of associated VLDB | |
775 | entries. | |
776 | \li long nextIdHash[] - Array of MAXTYPES next pointers for the ID hash table | |
777 | pointer, one for each related volume ID. | |
778 | \li long nextNameHash - Next pointer for the volume name hash table. | |
779 | \li long spares1[] - Two longword spare fields. | |
780 | \li char name[] - The volume's string name, with a maximum of MAXNAMELEN (65) | |
781 | characters, including the trailing null. | |
782 | \li u char volumeType - The volume's type, one of RWVOL, ROVOL, or BACKVOL. | |
783 | \li u char serverNumber[] - An array of indices into the table of servers, | |
784 | identifying the sites holding an instance of this volume. There are at most | |
785 | MAXNSERVERS (8) of these server sites allowed by the Volume Location Server. | |
786 | \li u char serverPartition[] - An array of partition identifiers, corresponding | |
787 | directly to the serverNumber array, specifying the partition on which each of | |
788 | those volume instances is located. As with the serverNumber array, | |
789 | serverPartition has up to MAXNSERVERS (8) entries. | |
790 | \li u char serverFlags[] - This array holds one flag value for each of the | |
791 | servers in the previous arrays. Again, there are MAXNSERVERS (8) slots in this | |
792 | array. | |
793 | \li u char RefCount - Only valid for read-write volumes, this field serves as a | |
794 | reference count, basically the number of dependent children volumes. | |
795 | \li char spares2[] - This field is used for 32-bit alignment. | |
796 | ||
797 | \subsection sec3-3-3 Section 3.3.3: struct vital vlheader | |
798 | ||
799 | \par | |
800 | This structure defines the leading section of the VLDB header, of type struct | |
801 | vlheader. It contains frequently-used global variables and general statistics | |
802 | information. | |
803 | \n \b Fields | |
804 | \li long vldbversion - The VLDB version number. This field must appear first in | |
805 | the structure. | |
806 | \li long headersize - The total number of bytes in the header. | |
807 | \li long freePtr - Pointer to the first free enry in the free list, if any. | |
808 | \li long eofPtr - Pointer to the first free byte in the header file. | |
809 | \li long allocs - The total number of calls to the internal AllocBlock() | |
810 | function directed at this file. | |
811 | \li long frees - The total number of calls to the internal FreeBlock() function | |
812 | directed at this file. | |
813 | \li long MaxVolumeId - The largest volume ID ever granted for this cell. | |
814 | \li long totalEntries[] - The total number of VLDB entries by volume type in | |
815 | the VLDB. This array has MAXTYPES slots, one for each volume type. | |
816 | ||
817 | \subsection sec3-3-4 Section 3.3.4: struct vlheader | |
818 | ||
819 | \par | |
820 | This is the layout of the information stored in the VLDB header. Notice it | |
821 | includes an object of type struct vital vlheader described above (see Section | |
822 | 3.3.3) as the first field. | |
823 | \n \b Fields | |
824 | \li struct vital vlheader vital header - Holds critical VLDB header | |
825 | information. | |
826 | \li u long IpMappedAddr[] - Keeps MAXSERVERID+1 mappings of IP addresses to | |
827 | relative ones. | |
828 | \li long VolnameHash[] - The volume name hash table, with HASHSIZE slots. | |
829 | \li long VolidHash[][] - The volume ID hash table. The first dimension in this | |
830 | array selects which of the MAXTYPES volume types is desired, and the second | |
831 | dimension actually implements the HASHSIZE hash table buckets for the given | |
832 | volume type. | |
833 | ||
834 | \subsection sec3-3-5 Section 3.3.5: struct VldbUpdateEntry | |
835 | ||
836 | \par | |
837 | This structure is used as an argument to the VL UpdateEntry() routine (see | |
838 | Section 3.6.7). Please note that multiple entries can be updated at once by | |
839 | setting the appropriate Mask bits. The bit values for this purpose are defined | |
840 | in Section 3.2.2. | |
841 | \n \b Fields | |
842 | \li u long Mask - Bit values determining which fields are to be affected by the | |
843 | update operation. | |
844 | \li char name[] - The volume name, up to MAXNAMELEN (65) characters including | |
845 | the trailing null. | |
846 | \li long volumeType - The volume type. | |
847 | \li long flags - This field is used in conjuction with Mask (in fact, one of | |
848 | the Mask bits determines if this field is valid) to choose the valid fields in | |
849 | this record. | |
850 | \li u long ReadOnlyId - The read-only ID. | |
851 | \li u long BackupId - The backup ID. | |
852 | \li long cloneId - The clone ID. | |
853 | \li long nModifiedRepsites - Number of replication sites whose entry is to be | |
854 | changed as below. | |
855 | \li u long RepsitesMask[] - Array of bit masks applying to the up to | |
856 | MAXNSERVERS (8) replication sites involved. | |
857 | \li long RepsitesTargetServer[] - Array of target servers for the operation, at | |
858 | most MAXNSERVERS (8) of them. | |
859 | \li long RepsitesTargetPart[] - Array of target server partitions for the | |
860 | operation, at most MAXNSERVERS (8) of them. | |
861 | \li long RepsitesNewServer[] - Array of new server sites, at most MAXNSERVERS | |
862 | (8) of them. | |
863 | \li long RepsitesNewPart[] - Array of new server partitions for the operation, | |
864 | at most MAXNSERVERS (8) of them. | |
865 | \li long RepsitesNewFlags[] - Flags applying to each of the new sites, at most | |
866 | MAXNSERVERS (8) of them. | |
867 | ||
868 | \subsection sec3-3-6 Section 3.3.6: struct VldbListByAttributes | |
869 | ||
870 | \par | |
871 | This structure is used by the VL ListAttributes() routine (see Section 3.6.11). | |
872 | \n \b Fields | |
873 | \li u long Mask - Bit mask used to select the following attribute fields on | |
874 | which to match. | |
875 | \li long server - The server address to match. | |
876 | \li long partition - The partition ID to match. | |
877 | \li long volumetype - The volume type to match. | |
878 | \li long volumeid - The volume ID to match. | |
879 | \li long flag - Flags concerning these values. | |
880 | ||
881 | \subsection sec3-3-7 Section 3.3.7: struct single vldbentry | |
882 | ||
883 | \par | |
884 | This structure is used to construct the vldblist object (See Section 3.3.12), | |
885 | which basically generates a queueable (singly-linked) version of struct | |
886 | vldbentry. | |
887 | \n \b Fields | |
888 | \li vldbentry VldbEntry - The VLDB entry to be queued. | |
889 | \li vldblist next vldb - The next pointer in the list. | |
890 | ||
891 | \subsection sec3-3-8 Section 3.3.8: struct vldb list | |
892 | ||
893 | \par | |
894 | This structure defines the item returned in linked list form from the VL | |
895 | LinkedList() function (see Section 3.6.12). This same object is also returned | |
896 | in bulk form in calls to the VL ListAttributes() routine (see Section 3.6.11). | |
897 | \n \b Fields | |
898 | \li vldblist node - The body of the first object in the linked list. | |
899 | ||
900 | \subsection sec3-3-9 Section 3.3.9: struct vldstats | |
901 | ||
902 | \par | |
903 | This structure defines fields to record statistics on opcode hit frequency. The | |
904 | MAX NUMBER OPCODES constant has been defined as the maximum number of opcodes | |
905 | supported by this structure, and is set to 30. | |
906 | \n \b Fields | |
907 | \li unsigned long start time - Clock time when opcode statistics were last | |
908 | cleared. | |
909 | \li long requests[] - Number of requests received for each of the MAX NUMBER | |
910 | OPCODES opcode types. | |
911 | \li long aborts[] - Number of aborts experienced for each of the MAX NUMBER | |
912 | OPCODES opcode types. | |
913 | \li long reserved[] - These five longword fields are reserved for future use. | |
914 | ||
915 | \subsection sec3-3-10 Section 3.3.10: bulk | |
916 | ||
917 | \code | |
918 | typedef opaque bulk<DEFAULTBULK>; | |
919 | \endcode | |
920 | \par | |
921 | This typedef may be used to transfer an uninterpreted set of bytes across the | |
922 | Volume Location Server interface. It may carry up to DEFAULTBULK (10,000) | |
923 | bytes. | |
924 | \n \b Fields | |
925 | \li bulk len - The number of bytes contained within the data pointed to by the | |
926 | next field. | |
927 | \li bulk val - A pointer to a sequence of bulk len bytes. | |
928 | ||
929 | \subsection sec3-3-11 Section 3.3.11: bulkentries | |
930 | ||
931 | \code | |
932 | typedef vldbentry bulkentries<>; | |
933 | \endcode | |
934 | \par | |
935 | This typedef is used to transfer an unbounded number of struct vldbentry | |
936 | objects. It appears in the parameter list for the VL ListAttributes() interface | |
937 | function. | |
938 | \n \b Fields | |
939 | \li bulkentries len - The number of vldbentry structures contained within the | |
940 | data pointed to by the next field. | |
941 | \li bulkentries val - A pointer to a sequence of bulkentries len vldbentry | |
942 | structures. | |
943 | ||
944 | \subsection sec3-3-12 Section 3.3.12: vldblist | |
945 | ||
946 | \code | |
947 | typedef struct single_vldbentry *vldblist; | |
948 | \endcode | |
949 | \par | |
950 | This typedef defines a queueable struct vldbentry object, referenced by the | |
951 | single vldbentry typedef as well as struct vldb list. | |
952 | ||
953 | \subsection sec3-3-13 Section 3.3.13: vlheader | |
954 | ||
955 | \code | |
956 | typedef struct vlheader vlheader; | |
957 | \endcode | |
958 | \par | |
959 | This typedef provides a short name for objects of type struct vlheader (see | |
960 | Section 3.3.4). | |
961 | ||
962 | \subsection sec3-3-14 Section 3.3.14: vlentry | |
963 | ||
964 | \code | |
965 | typedef struct vlentry vlentry; | |
966 | \endcode | |
967 | \par | |
968 | This typedef provides a short name for objects of type struct vlentry (see | |
969 | Section 3.3.2). | |
970 | ||
971 | \section sec3-4 Section 3.4: Error Codes | |
972 | ||
973 | \par | |
974 | This section covers the set of error codes exported by the Volume Location | |
975 | Server, displaying the printable phrases with which they are associated. | |
976 | ||
977 | \par Name | |
978 | VL IDEXIST | |
979 | \par Value | |
980 | (363520L) | |
981 | \par Description | |
982 | Volume Id entry exists in vl database. | |
983 | ||
984 | \par Name | |
985 | VL IO | |
986 | \par Value | |
987 | (363521L) | |
988 | \par Description | |
989 | I/O related error. | |
990 | ||
991 | \par Name | |
992 | VL NAMEEXIST | |
993 | \par Value | |
994 | (363522L) | |
995 | \par Description | |
996 | Volume name entry exists in vl database. | |
997 | ||
998 | \par Name | |
999 | VL CREATEFAIL | |
1000 | \par Value | |
1001 | (363523L) | |
1002 | \par Description | |
1003 | Internal creation failure. | |
1004 | ||
1005 | \par Name | |
1006 | VL NOENT | |
1007 | \par Value | |
1008 | (363524L) | |
1009 | \par Description | |
1010 | No such entry. | |
1011 | ||
1012 | \par Name | |
1013 | VL EMPTY | |
1014 | \par Value | |
1015 | (363525L) | |
1016 | \par Description | |
1017 | Vl database is empty. | |
1018 | ||
1019 | \par Name | |
1020 | VL ENTDELETED | |
1021 | \par Value | |
1022 | (363526L) | |
1023 | \par Description | |
1024 | Entry is deleted (soft delete). | |
1025 | ||
1026 | \par Name | |
1027 | VL BADNAME | |
1028 | \par Value | |
1029 | (363527L) | |
1030 | \par Description | |
1031 | Volume name is illegal. | |
1032 | ||
1033 | \par Name | |
1034 | VL BADINDEX | |
1035 | \par Value | |
1036 | (363528L) | |
1037 | \par Description | |
1038 | Index is out of range. | |
1039 | ||
1040 | \par Name | |
1041 | VL BADVOLTYPE | |
1042 | \par Value | |
1043 | (363529L) | |
1044 | \par Description | |
1045 | Bad volume range. | |
1046 | ||
1047 | \par Name | |
1048 | VL BADSERVER | |
1049 | \par Value | |
1050 | (363530L) | |
1051 | \par Description | |
1052 | Illegal server number (out of range). | |
1053 | ||
1054 | \par Name | |
1055 | VL BADPARTITION | |
1056 | \par Value | |
1057 | (363531L) | |
1058 | \par Description | |
1059 | Bad partition number. | |
1060 | ||
1061 | \par Name | |
1062 | VL REPSFULL | |
1063 | \par Value | |
1064 | (363532L) | |
1065 | \par Description | |
1066 | Run out of space for Replication sites. | |
1067 | ||
1068 | \par Name | |
1069 | VL NOREPSERVER | |
1070 | \par Value | |
1071 | (363533L) | |
1072 | \par Description | |
1073 | No such Replication server site exists. | |
1074 | ||
1075 | \par Name | |
1076 | VL DUPREPSERVER | |
1077 | \par Value | |
1078 | (363534L) | |
1079 | \par Description | |
1080 | Replication site already exists. | |
1081 | ||
1082 | \par Name | |
1083 | RL RWNOTFOUND | |
1084 | \par Value | |
1085 | (363535L) | |
1086 | \par Description | |
1087 | Parent R/W entry not found. | |
1088 | ||
1089 | \par Name | |
1090 | VL BADREFCOUNT | |
1091 | \par Value | |
1092 | (363536L) | |
1093 | \par Description | |
1094 | Illegal Reference Count number. | |
1095 | ||
1096 | \par Name | |
1097 | VL SIZEEXCEEDED | |
1098 | \par Value | |
1099 | (363537L) | |
1100 | \par Description | |
1101 | Vl size for attributes exceeded. | |
1102 | ||
1103 | \par Name | |
1104 | VL BADENTRY | |
1105 | \par Value | |
1106 | (363538L) | |
1107 | \par Description | |
1108 | Bad incoming vl entry. | |
1109 | ||
1110 | \par Name | |
1111 | VL BADVOLIDBUMP | |
1112 | \par Value | |
1113 | (363539L) | |
1114 | \par Description | |
1115 | Illegal max volid increment. | |
1116 | ||
1117 | \par Name | |
1118 | VL IDALREADYHASHED | |
1119 | \par Value | |
1120 | (363540L) | |
1121 | \par Description | |
1122 | RO/BACK id already hashed. | |
1123 | ||
1124 | \par Name | |
1125 | VL ENTRYLOCKED | |
1126 | \par Value | |
1127 | (363541L) | |
1128 | \par Description | |
1129 | Vl entry is already locked. | |
1130 | ||
1131 | \par Name | |
1132 | VL BADVOLOPER | |
1133 | \par Value | |
1134 | (363542L) | |
1135 | \par Description | |
1136 | Bad volume operation code. | |
1137 | ||
1138 | \par Name | |
1139 | VL BADRELLOCKTYPE | |
1140 | \par Value | |
1141 | (363543L) | |
1142 | \par Description | |
1143 | Bad release lock type. | |
1144 | ||
1145 | \par Name | |
1146 | VL RERELEASE | |
1147 | \par Value | |
1148 | (363544L) | |
1149 | \par Description | |
1150 | Status report: last release was aborted. | |
1151 | ||
1152 | \par Name | |
1153 | VL BADSERVERFLAG | |
1154 | \par Value | |
1155 | (363545L) | |
1156 | \par Description | |
1157 | Invalid replication site server flag. | |
1158 | ||
1159 | \par Name | |
1160 | VL PERM | |
1161 | \par Value | |
1162 | (363546L) | |
1163 | \par Description | |
1164 | No permission access. | |
1165 | ||
1166 | \par Name | |
1167 | VL NOMEM | |
1168 | \par Value | |
1169 | (363547L) | |
1170 | \par Description | |
1171 | malloc(realloc) failed to alloc enough memory. | |
1172 | ||
1173 | \section sec3-5 Section 3.5: Macros | |
1174 | ||
1175 | \par | |
1176 | The Volume Location Server defines a small number of macros, as described in | |
1177 | this section. They are used to update the internal statistics variables and to | |
1178 | compute offsets into character strings. All of these macros really refer to | |
1179 | internal operations, and strictly speaking should not be exposed in this | |
1180 | interface. | |
1181 | ||
1182 | \subsection sec3-5-1 Section 3.5.1: COUNT REQ() | |
1183 | ||
1184 | \code | |
1185 | #define COUNT_REQ(op) | |
1186 | static int this_op = op-VL_LOWEST_OPCODE; | |
1187 | dynamic_statistics.requests[this_op]++ | |
1188 | \endcode | |
1189 | \par | |
1190 | Bump the appropriate entry in the variable maintaining opcode usage statistics | |
1191 | for the Volume Location Server. Note that a static variable is set up to record | |
1192 | this op, namely the index into the opcode monitoring array. This static | |
1193 | variable is used by the related COUNT ABO() macro defined below. | |
1194 | ||
1195 | \subsection sec3-5-2 Section 3.5.2: COUNT ABO() | |
1196 | ||
1197 | \code | |
1198 | #define COUNT_ABO dynamic_statistics.aborts[this_op]++ | |
1199 | \endcode | |
1200 | \par | |
1201 | Bump the appropriate entry in the variable maintaining opcode abort statistics | |
1202 | for the Volume Location Server. Note that this macro does not take any | |
1203 | arguemnts. It expects to find a this op variable in its environment, and thus | |
1204 | depends on its related macro, COUNT REQ() to define that variable. | |
1205 | ||
1206 | \subsection sec3-5-3 Section 3.5.3: DOFFSET() | |
1207 | ||
1208 | \code | |
1209 | #define DOFFSET(abase, astr, aitem) ((abase)+(((char *)(aitem)) -((char | |
1210 | *)(astr)))) | |
1211 | \endcode | |
1212 | \par | |
1213 | Compute the byte offset of charcter object aitem within the enclosing object | |
1214 | astr, also expressed as a character-based object, then offset the resulting | |
1215 | address by abase. This macro is used ot compute locations within the VLDB when | |
1216 | actually writing out information. | |
1217 | ||
1218 | \section sec3-6 Section 3.6: Functions | |
1219 | ||
1220 | \par | |
1221 | This section covers the Volume Location Server RPC interface routines. The | |
1222 | majority of them are generated from the vldbint.xg Rxgen file, and are meant to | |
1223 | be used by user-space agents. There is also a subset interface definition | |
1224 | provided in the afsvlint.xg Rxgen file. These routines, described in Section | |
1225 | 3.7, are meant to be used by a kernel-space agent when dealing with the Volume | |
1226 | Location Server; in particular, they are called by the Cache Manager. | |
1227 | ||
1228 | \subsection sec3-6-1 Section 3.6.1: VL CreateEntry - Create a VLDB | |
1229 | entry | |
1230 | ||
1231 | \code | |
1232 | int VL CreateEntry(IN struct rx connection *z conn, | |
1233 | IN vldbentry *newentry) | |
1234 | \endcode | |
1235 | \par Description | |
1236 | This function creates a new entry in the VLDB, as specified in the newentry | |
1237 | argument. Both the name and numerical ID of the new volume must be unique | |
1238 | (e.g., it must not already appear in the VLDB). For non-read-write entries, the | |
1239 | read-write parent volume is accessed so that its reference count can be | |
1240 | updated, and the new entry is added to the parent's chain of associated | |
1241 | entries. | |
1242 | The VLDB is write-locked for the duration of this operation. | |
1243 | \par Error Codes | |
1244 | VL PERM The caller is not authorized to execute this function. VL NAMEEXIST The | |
1245 | volume name already appears in the VLDB. VL CREATEFAIL Space for the new entry | |
1246 | cannot be allocated within the VLDB. VL BADNAME The volume name is invalid. VL | |
1247 | BADVOLTYPE The volume type is invalid. VL BADSERVER The indicated server | |
1248 | information is invalid. VL BADPARTITION The indicated partition information is | |
1249 | invalid. VL BADSERVERFLAG The server flag field is invalid. VL IO An error | |
1250 | occurred while writing to the VLDB. | |
1251 | ||
1252 | \subsection sec3-6-2 Section 3.6.2: VL DeleteEntry - Delete a VLDB | |
1253 | entry | |
1254 | ||
1255 | \code | |
1256 | int VL DeleteEntry(IN struct rx connection *z conn, | |
1257 | IN long Volid, | |
1258 | IN long voltype) | |
1259 | \endcode | |
1260 | \par Description | |
1261 | Delete the entry matching the given volume identifier and volume type as | |
1262 | specified in the Volid and voltype arguments. For a read-write entry whose | |
1263 | reference count is greater than 1, the entry is not actually deleted, since at | |
1264 | least one child (read-only or backup) volume still depends on it. For cases of | |
1265 | non-read-write volumes, the parent's reference count and associated chains are | |
1266 | updated. | |
1267 | \par | |
1268 | If the associated VLDB entry is already marked as deleted (i.e., its flags | |
1269 | field has the VLDELETED bit set), then no further action is taken, and VL | |
1270 | ENTDELETED is returned. The VLDB is write-locked for the duration of this | |
1271 | operation. | |
1272 | \par Error Codes | |
1273 | VL PERM The caller is not authorized to execute this function. VL BADVOLTYPE An | |
1274 | illegal volume type has been specified by the voltype argument. VL NOENT This | |
1275 | volume instance does not appear in the VLDB. VL ENTDELETED The given VLDB entry | |
1276 | has already been marked as deleted. VL IO An error occurred while writing to | |
1277 | the VLDB. | |
1278 | ||
1279 | \subsection sec3-6-3 Section 3.6.3: VL GetEntryByID - Get VLDB entry by | |
1280 | volume ID/type | |
1281 | ||
1282 | \code | |
1283 | int VL GetEntryByID(IN struct rx connection *z conn, IN long Volid, IN long | |
1284 | voltype, OUT vldbentry *entry) | |
1285 | \endcode | |
1286 | \par Description | |
1287 | Given a volume's numerical identifier (Volid) and type (voltype), return a | |
1288 | pointer to the entry in the VLDB describing the given volume instance. | |
1289 | \par | |
1290 | The VLDB is read-locked for the duration of this operation. | |
1291 | \par Error Codes | |
1292 | VL BADVOLTYPE An illegal volume type has been specified by the voltype | |
1293 | argument. | |
1294 | \n VL NOENT This volume instance does not appear in the VLDB. | |
1295 | \n VL ENTDELETED The given VLDB entry has already been marked as deleted. | |
1296 | ||
1297 | \subsection sec3-6-4 Section 3.6.4: VL GetEntryByName - Get VLDB entry | |
1298 | by volume name | |
1299 | ||
1300 | \code | |
1301 | int VL GetEntryByName(IN struct rx connection *z conn, | |
1302 | IN char *volumename, | |
1303 | OUT vldbentry *entry) | |
1304 | \endcode | |
1305 | \par Description | |
1306 | Given the volume name in the volumename parameter, return a pointer to the | |
1307 | entry in the VLDB describing the given volume. The name in volumename may be no | |
1308 | longer than MAXNAMELEN (65) characters, including the trailing null. Note that | |
1309 | it is legal to use the volume's numerical identifier (in string form) as the | |
1310 | volume name. | |
1311 | \par | |
1312 | The VLDB is read-locked for the duration of this operation. | |
1313 | \par | |
1314 | This function is closely related to the VL GetEntryByID() routine, as might be | |
1315 | expected. In fact, the by-ID routine is called if the volume name provided in | |
1316 | volumename is the string version of the volume's numerical identifier. | |
1317 | \par Error Codes | |
1318 | VL BADVOLTYPE An illegal volume type has been specified by the voltype | |
1319 | argument. | |
1320 | \n VL NOENT This volume instance does not appear in the VLDB. | |
1321 | \n VL ENTDELETED The given VLDB entry has already been marked as deleted. | |
1322 | \n VL BADNAME The volume name is invalid. | |
1323 | ||
1324 | \subsection sec3-6-5 Section 3.6.5: VL GetNewVolumeId - Generate a new | |
1325 | volume ID | |
1326 | ||
1327 | \code | |
1328 | int VL GetNewVolumeId(IN struct rx connection *z conn, | |
1329 | IN long bumpcount, | |
1330 | OUT long *newvolumid) | |
1331 | \endcode | |
1332 | \par Description | |
1333 | Acquire bumpcount unused, consecutively-numbered volume identifiers from the | |
1334 | Volume Location Server. The lowest-numbered of the newly-acquired set is placed | |
1335 | in the newvolumid argument. The largest number of volume IDs that may be | |
1336 | generated with any one call is bounded by the MAXBUMPCOUNT constant defined in | |
1337 | Section 3.2.1. Currently, there is (effectively) no restriction on the number | |
1338 | of volume identifiers that may thus be reserved in a single call. | |
1339 | \par | |
1340 | The VLDB is write-locked for the duration of this operation. | |
1341 | \par Error Codes | |
1342 | VL PERM The caller is not authorized to execute this function. | |
1343 | \n VL BADVOLIDBUMP The value of the bumpcount parameter exceeds the system | |
1344 | limit of MAXBUMPCOUNT. | |
1345 | \n VL IO An error occurred while writing to the VLDB. | |
1346 | ||
1347 | \subsection sec3-6-6 Section 3.6.6: VL ReplaceEntry - Replace entire | |
1348 | contents of VLDB entry | |
1349 | ||
1350 | \code | |
1351 | int VL ReplaceEntry(IN struct rx connection *z conn, | |
1352 | IN long Volid, | |
1353 | IN long voltype, | |
1354 | IN vldbentry *newentry, | |
1355 | IN long ReleaseType) | |
1356 | \endcode | |
1357 | \par Description | |
1358 | Perform a wholesale replacement of the VLDB entry corresponding to the volume | |
1359 | instance whose identifier is Volid and type voltype with the information | |
1360 | contained in the newentry argument. Individual VLDB entry fields cannot be | |
1361 | selectively changed while the others are preserved; VL UpdateEntry() should be | |
1362 | used for this objective. The permissible values for the ReleaseType parameter | |
1363 | are defined in Section 3.2.7. | |
1364 | \par | |
1365 | The VLDB is write-locked for the duration of this operation. All of the hash | |
1366 | tables impacted are brought up to date to incorporate the new information. | |
1367 | \par Error Codes | |
1368 | VL PERM The caller is not authorized to execute this function. | |
1369 | \n VL BADVOLTYPE An illegal volume type has been specified by the voltype | |
1370 | argument. | |
1371 | \n VL BADRELLOCKTYPE An illegal release lock has been specified by the | |
1372 | ReleaseType argument. | |
1373 | \n VL NOENT This volume instance does not appear in the VLDB. | |
1374 | \n VL BADENTRY An attempt was made to change a read-write volume ID. | |
1375 | \n VL IO An error occurred while writing to the VLDB. | |
1376 | ||
1377 | \subsection sec3-6-7 Section 3.6.7: VL UpdateEntry - Update contents of | |
1378 | VLDB entry | |
1379 | ||
1380 | \code | |
1381 | int VL UpdateEntry(IN struct rx connection *z conn, | |
1382 | IN long Volid, | |
1383 | IN long voltype, | |
1384 | IN VldbUpdateEntry *UpdateEntry, | |
1385 | IN long ReleaseType) | |
1386 | \endcode | |
1387 | \par Description | |
1388 | Update the VLDB entry corresponding to the volume instance whose identifier is | |
1389 | Volid and type voltype with the information contained in the UpdateEntry | |
1390 | argument. Most of the entry's fields can be modified in a single call to VL | |
1391 | UpdateEntry(). The Mask field within the UpdateEntry parameter selects the | |
1392 | fields to update with the values stored within the other UpdateEntry fields. | |
1393 | Permissible values for the ReleaseType parameter are defined in Section 3.2.7. | |
1394 | \par | |
1395 | The VLDB is write-locked for the duration of this operation. | |
1396 | \par Error Codes | |
1397 | VL PERM The caller is not authorized to execute this function. | |
1398 | \n VL BADVOLTYPE An illegal volume type has been specified by the voltype | |
1399 | argument. | |
1400 | \n VL BADRELLOCKTYPE An illegal release lock has been specified by the | |
1401 | ReleaseType argument. | |
1402 | \n VL NOENT This volume instance does not appear in the VLDB. | |
1403 | \n VL IO An error occurred while writing to the VLDB. | |
1404 | ||
1405 | \subsection sec3-6-8 Section 3.6.8: VL SetLock - Lock VLDB entry | |
1406 | ||
1407 | \code | |
1408 | int VL SetLock(IN struct rx connection *z conn, | |
1409 | IN long Volid, | |
1410 | IN long voltype, | |
1411 | IN long voloper) | |
1412 | \endcode | |
1413 | \par Description | |
1414 | Lock the VLDB entry matching the given volume ID (Volid) and type (voltype) for | |
1415 | volume operation voloper (e.g., VLOP MOVE and VLOP RELEASE). If the entry is | |
1416 | currently unlocked, then its LockTimestamp will be zero. If the lock is | |
1417 | obtained, the given voloper is stamped into the flags field, and the | |
1418 | LockTimestamp is set to the time of the call. | |
1419 | \Note | |
1420 | When the caller attempts to lock the entry for a release operation, special | |
1421 | care is taken to abort the operation if the entry has already been locked for | |
1422 | this operation, and the existing lock has timed out. In this case, VL SetLock() | |
1423 | returns VL RERELEASE. | |
1424 | \par | |
1425 | The VLDB is write-locked for the duration of this operation. | |
1426 | \par Error Codes | |
1427 | VL PERM The caller is not authorized to execute this function. | |
1428 | \n VL BADVOLTYPE An illegal volume type has been specified by the voltype | |
1429 | argument. | |
1430 | \n VL BADVOLOPER An illegal volume operation was specified in the voloper | |
1431 | argument. Legal values are defined in the latter part of the table in Section | |
1432 | 3.2.5. | |
1433 | \n VL ENTDELETED The given VLDB entry has already been marked as deleted. | |
1434 | \n VL ENTRYLOCKED The given VLDB entry has already been locked (which has not | |
1435 | yet timed out). | |
1436 | \n VL RERELEASE A VLDB entry locked for release has timed out, and the caller | |
1437 | also wanted to perform a release operation on it. | |
1438 | \n VL IO An error was experienced while attempting to write to the VLDB. | |
1439 | ||
1440 | \subsection sec3-6-9 Section 3.6.9: VL ReleaseLock - Unlock VLDB entry | |
1441 | ||
1442 | \code | |
1443 | int VL ReleaseLock(IN struct rx connection *z conn, | |
1444 | IN long Volid, | |
1445 | IN long voltype, | |
1446 | IN long ReleaseType) | |
1447 | \endcode | |
1448 | \par Description | |
1449 | Unlock the VLDB entry matching the given volume ID (Volid) and type (voltype). | |
1450 | The ReleaseType argument determines which VLDB entry fields from flags and | |
1451 | LockAfsId will be cleared along with the lock timestamp in LockTimestamp. | |
1452 | Permissible values for the ReleaseType parameter are defined in Section 3.2.7. | |
1453 | \par | |
1454 | The VLDB is write-locked for the duration of this operation. | |
1455 | \par Error Codes | |
1456 | VL PERM The caller is not authorized to execute this function. | |
1457 | \n VL BADVOLTYPE An illegal volume type has been specified by the voltype | |
1458 | argument. | |
1459 | \n VL BADRELLOCKTYPE An illegal release lock has been specified by the | |
1460 | ReleaseType argument. | |
1461 | \n VL NOENT This volume instance does not appear in the VLDB. | |
1462 | \n VL ENTDELETED The given VLDB entry has already been marked as deleted. | |
1463 | \n VL IO An error was experienced while attempting to write to the VLDB. | |
1464 | ||
1465 | \subsection sec3-6-10 Section 3.6.10: VL ListEntry - Get contents of | |
1466 | VLDB via index | |
1467 | ||
1468 | \code | |
1469 | int VL ListEntry(IN struct rx connection *z conn, | |
1470 | IN long previous index, | |
1471 | OUT long *count, | |
1472 | OUT long *next index, | |
1473 | OUT vldbentry *entry) | |
1474 | \endcode | |
1475 | \par Description | |
1476 | This function assists in the task of enumerating the contents of the VLDB. | |
1477 | Given an index into the database, previous index, this call return the single | |
1478 | VLDB entry at that offset, placing it in the entry argument. The number of VLDB | |
1479 | entries left to list is placed in count, and the index of the next entry to | |
1480 | request is returned in next index. If an illegal index is provided, count is | |
1481 | set to -1. | |
1482 | \par | |
1483 | The VLDB is read-locked for the duration of this operation. | |
1484 | \par Error Codes | |
1485 | ---None. | |
1486 | ||
1487 | \subsection sec3-6-11 Section 3.6.11: VL ListAttributes - List all VLDB | |
1488 | entry matching given attributes, single return object | |
1489 | ||
1490 | \code | |
1491 | int VL ListAttributes(IN struct rx connection *z conn, | |
1492 | IN VldbListByAttributes *attributes, | |
1493 | OUT long *nentries, | |
1494 | OUT bulkentries *blkentries) | |
1495 | \endcode | |
1496 | \par Description | |
1497 | Retrieve all the VLDB entries that match the attributes listed in the | |
1498 | attributes parameter, placing them in the blkentries object. The number of | |
1499 | matching entries is placed in nentries. Matching can be done by server number, | |
1500 | partition, volume type, flag, or volume ID. The legal values to use in the | |
1501 | attributes argument are listed in Section 3.2.3. Note that if the VLLIST | |
1502 | VOLUMEID bit is set in attributes, all other bit values are ignored and the | |
1503 | volume ID provided is the sole search criterion. | |
1504 | \par | |
1505 | The VLDB is read-locked for the duration of this operation. | |
1506 | \par | |
1507 | Note that VL ListAttributes() is a potentially expensive function, as | |
1508 | sequential search through all of the VLDB entries is performed in most cases. | |
1509 | \par Error Codes | |
1510 | VL NOMEM Memory for the blkentries object could not be allocated. | |
1511 | \n VL NOENT This specified volume instance does not appear in the VLDB. | |
1512 | \n VL SIZEEXCEEDED Ran out of room in the blkentries object. | |
1513 | \n VL IO Error while reading from the VLDB. | |
1514 | ||
1515 | \subsection sec3-6-12 Section 3.6.12: VL LinkedList - List all VLDB | |
1516 | entry matching given attributes, linked list return object | |
1517 | ||
1518 | \code | |
1519 | int VL LinkedList(IN struct rx connection *z conn, | |
1520 | IN VldbListByAttributes *attributes, | |
1521 | OUT long *nentries, | |
1522 | OUT vldb list *linkedentries) | |
1523 | \endcode | |
1524 | \par Description | |
1525 | Retrieve all the VLDB entries that match the attributes listed in the | |
1526 | attributes parameter, creating a linked list of entries based in the | |
1527 | linkedentries object. The number of matching entries is placed in nentries. | |
1528 | Matching can be done by server number, partition, volume type, flag, or volume | |
1529 | ID. The legal values to use in the attributes argument are listed in Section | |
1530 | 3.2.3. Note that if the VLLIST VOLUMEID bit is set in attributes, all other bit | |
1531 | values are ignored and the volume ID provided is the sole search criterion. | |
1532 | \par | |
1533 | The VL LinkedList() function is identical to the VL ListAttributes(), except | |
1534 | for the method of delivering the VLDB entries to the caller. | |
1535 | \par | |
1536 | The VLDB is read-locked for the duration of this operation. | |
1537 | \par Error Codes | |
1538 | VL NOMEM Memory for an entry in the list based at linkedentries object could | |
1539 | not be allocated. | |
1540 | \n VL NOENT This specified volume instance does not appear in the VLDB. | |
1541 | \n VL SIZEEXCEEDED Ran out of room in the current list object. | |
1542 | \n VL IO Error while reading from the VLDB. | |
1543 | ||
1544 | \subsection sec3-6-13 Section 3.6.13: VL GetStats - Get Volume Location | |
1545 | Server statistics | |
1546 | ||
1547 | \code | |
1548 | int VL GetStats(IN struct rx connection *z conn, | |
1549 | OUT vldstats *stats, | |
1550 | OUT vital vlheader *vital header) | |
1551 | \endcode | |
1552 | \par Description | |
1553 | Collect the different types of VLDB statistics. Part of the VLDB header is | |
1554 | returned in vital header, which includes such information as the number of | |
1555 | allocations and frees performed, and the next volume ID to be allocated. The | |
1556 | dynamic per-operation stats are returned in the stats argument, reporting the | |
1557 | number and types of operations and aborts. | |
1558 | \par | |
1559 | The VLDB is read-locked for the duration of this operation. | |
1560 | \par Error Codes | |
1561 | VL PERM The caller is not authorized to execute this function. | |
1562 | ||
1563 | \subsection sec3-6-14 Section 3.6.14: VL Probe - Verify Volume Location | |
1564 | Server connectivity/status | |
1565 | ||
1566 | \code | |
1567 | int VL Probe(IN struct rx connection *z conn) | |
1568 | \endcode | |
1569 | \par Description | |
1570 | This routine serves a 'pinging' function to determine whether the Volume | |
1571 | Location Server is still running. If this call succeeds, then the Volume | |
1572 | Location Server is shown to be capable of responding to RPCs, thus confirming | |
1573 | connectivity and basic operation. | |
1574 | \par | |
1575 | The VLDB is not locked for this operation. | |
1576 | \par Error Codes | |
1577 | ---None. | |
1578 | ||
1579 | \section sec3-7 Section 3.7: Kernel Interface Subset | |
1580 | ||
1581 | \par | |
1582 | The interface described by this document so far applies to user-level clients, | |
1583 | such as the vos utility. However, some volume location operations must be | |
1584 | performed from within the kernel. Specifically, the Cache Manager must find out | |
1585 | where volumes reside and otherwise gather information about them in order to | |
1586 | conduct its business with the File Servers holding them. In order to support | |
1587 | Volume Location Server interconnection for agents operating within the kernel, | |
1588 | the afsvlint.xg Rxgen interface was built. It is a minimal subset of the | |
1589 | user-level vldbint.xg definition. Within afsvlint.xg, there are duplicate | |
1590 | definitions for such constants as MAXNAMELEN, MAXNSERVERS, MAXTYPES, VLF | |
1591 | RWEXISTS, VLF ROEXISTS, VLF BACKEXISTS, VLSF NEWREPSITE, VLSF ROVOL, VLSF | |
1592 | RWVOL, and VLSF BACKVOL. Since the only operations the Cache Manager must | |
1593 | perform are volume location given a specific volume ID or name, and to find out | |
1594 | about unresponsive Volume Location Servers, the following interface routines | |
1595 | are duplicated in afsvlint.xg, along with the struct vldbentry declaration: | |
1596 | \li VL GetEntryByID() | |
1597 | \li VL GetEntryByName() | |
1598 | \li VL Probe() | |
1599 | ||
1600 | \page chap4 Chapter 4: Volume Server Architecture | |
1601 | ||
1602 | \section sec4-1 Section 4.1: Introduction | |
1603 | ||
1604 | \par | |
1605 | The Volume Server allows administrative tasks and probes to be performed on the | |
1606 | set of AFS volumes residing on the machine on which it is running. As described | |
1607 | in Chapter 2, a distributed database holding volume location info, the VLDB, is | |
1608 | used by client applications to locate these volumes. Volume Server functions | |
1609 | are typically invoked either directly from authorized users via the vos utility | |
1610 | or by the AFS backup system. | |
1611 | \par | |
1612 | This chapter briefly discusses various aspects of the Volume Server's | |
1613 | architecture. First, the high-level on-disk representation of volumes is | |
1614 | covered. Then, the transactions used in conjuction with volume operations are | |
1615 | examined. Then, the program implementing the Volume Server, volserver, is | |
1616 | considered. The nature and format of the log file kept by the Volume Server | |
1617 | rounds out the description. | |
1618 | As with all AFS servers, the Volume Server uses the Rx remote procedure call | |
1619 | package for communication with its clients. | |
1620 | ||
1621 | \section sec4-2 Section 4.2: Disk Representation | |
1622 | ||
1623 | \par | |
1624 | For each volume on an AFS partition, there exists a file visible in the unix | |
1625 | name space which describes the contents of that volume. By convention, each of | |
1626 | these files is named by concatenating a prefix string, "V", the numerical | |
1627 | volume ID, and the postfix string ".vol". Thus, file V0536870918.vol describes | |
1628 | the volume whose numerical ID is 0536870918. Internally, each per-volume | |
1629 | descriptor file has such fields as a version number, the numerical volume ID, | |
1630 | and the numerical parent ID (useful for read-only or backup volumes). It also | |
1631 | has a list of related inodes, namely files which are not visible from the unix | |
1632 | name space (i.e., they do not appear as entries in any unix directory object). | |
1633 | The set of important related inodes are: | |
1634 | \li Volume info inode: This field identifies the inode which hosts the on-disk | |
1635 | representation of the volume's header. It is very similar to the information | |
1636 | pointed to by the volume field of the struct volser trans defined in Section | |
1637 | 5.4.1, recording important status information for the volume. | |
1638 | \li Large vnode index inode: This field identifies the inode which holds the | |
1639 | list of vnode identifiers for all directory objects residing within the volume. | |
1640 | These are "large" since they must also hold the Access Control List (ACL) | |
1641 | information for the given AFS directory. | |
1642 | \li Small vnode index inode: This field identifies the inode which holds the | |
1643 | list of vnode identifiers for all non-directory objects hosted by the volume. | |
1644 | \par | |
1645 | All of the actual files and directories residing within an AFS volume, as | |
1646 | identified by the contents of the large and small vnode index inodes, are also | |
1647 | free-floating inodes, not appearing in the conventional unix name space. This | |
1648 | is the reason the vendor-supplied fsck program should not be run on partitions | |
1649 | containing AFS volumes. Since the inodes making up AFS files and directories, | |
1650 | as well as the inodes serving as volume indices for them, are not mapped to any | |
1651 | directory, the standard fsck program would throw away all of these | |
1652 | "unreferenced" inodes. Thus, a special version of fsck is provided that | |
1653 | recognizes partitions containing AFS volumes as well as standard unix | |
1654 | partitions. | |
1655 | ||
1656 | \section sec4-3 Section 4.3: Transactions | |
1657 | ||
1658 | \par | |
1659 | Each individual volume operation is carried out by the Volume Server as a | |
1660 | transaction, but not in the atomic sense of the word. Logically, creating a | |
1661 | Volume Server transaction can be equated with performing an "exclusive open" on | |
1662 | the given volume before beginning the actual work of the desired volume | |
1663 | operation. No other Volume Server (or File Server) operation is allowed on the | |
1664 | opened volume until the transaction is terminated. Thus, transactions in the | |
1665 | context of the Volume Server serve to provide mutual exclusion without any of | |
1666 | the normal atomicity guarantees. Volumes maintain enough internal state to | |
1667 | enable recovery from interrupted or failed operations via use of the salvager | |
1668 | program. Whenever volume inconsistencies are detected, this salvager program is | |
1669 | run, which then attempts to correct the problem. | |
1670 | \par | |
1671 | Volume transactions have timeouts associated with them. This guarantees that | |
1672 | the death of the agent performing a given volume operation cannot result in the | |
1673 | volume being permanently removed from circulation. There are actually two | |
1674 | timeout periods defined for a volume transaction. The first is the warning | |
1675 | time, defined to be 5 minutes. If a transaction lasts for more than this time | |
1676 | period without making progress, the Volume Server prints a warning message to | |
1677 | its log file (see Section 4.5). The second time value associated with a volume | |
1678 | transaction is the hard timeout, defined to occur 10 minutes after any progress | |
1679 | has been made on the given operation. After this period, the transaction will | |
1680 | be unconditionally deleted, and the volume freed for any other operations. | |
1681 | Transactions are reference-counted. Progress will be deemed to have occurred | |
1682 | for a transaction, and its internal timeclock field will be updated, when: | |
1683 | \li 1 The transaction is first created. | |
1684 | \li 2 A reference is made to the transaction, causing the Volume Server to look | |
1685 | it up in its internal tables. | |
1686 | \li 3 The transaction's reference count is decremented. | |
1687 | ||
1688 | \section sec4-4 Section 4.4: The volserver Process | |
1689 | ||
1690 | \par | |
1691 | The volserver user-level program is run on every AFS server machine, and | |
1692 | implements the Volume Server agent. It is responsible for providing the Volume | |
1693 | Server interface as defined by the volint.xg Rxgen file. | |
1694 | \par | |
1695 | The volserver process defines and launches five threads to perform the bulk of | |
1696 | its duties. One thread implements a background daemon whose job it is to | |
1697 | garbage-collect timed-out transaction structures. The other four threads are | |
1698 | RPC interface listeners, primed to accept remote procedure calls and thus | |
1699 | perform the defined set of volume operations. | |
1700 | \par | |
1701 | Certain non-standard configuration settings are made for the RPC subsystem by | |
1702 | the volserver program. For example, it chooses to extend the length of time | |
1703 | that an Rx connection may remain idle from the default 12 seconds to 120 | |
1704 | seconds. The reasoning here is that certain volume operations may take longer | |
1705 | than 12 seconds of processing time on the server, and thus the default setting | |
1706 | for the connection timeout value would incorrectly terminate an RPC when in | |
1707 | fact it was proceeding normally and correctly. | |
1708 | \par | |
1709 | The volserver program takes a single, optional command line argument. If a | |
1710 | positive integer value is provided on the command line, then it shall be used | |
1711 | to set the debugging level within the Volume Server. By default, a value of | |
1712 | zero is used, specifying that no special debugging output will be generated and | |
1713 | fed to the Volume Server log file described below. | |
1714 | ||
1715 | \section sec4-5 Section 4.5: Log File | |
1716 | ||
1717 | \par | |
1718 | The Volume Server keeps a log file, recording the set of events of special | |
1719 | interest it has encountered. The file is named VolserLog, and is stored in the | |
1720 | /usr/afs/logs directory on the local disk of the server machine on which the | |
1721 | Volume Server runs. This is a human-readable file, with every entry | |
1722 | time-stamped. | |
1723 | \par | |
1724 | Whenever the volserver program restarts, it renames the current VolserLog file | |
1725 | to VolserLog.old, and starts up a fresh log. A properly-authorized individual | |
1726 | can easily inspect the log file residing on any given server machine. This is | |
1727 | made possible by the BOS Server AFS agent running on the machine, which allows | |
1728 | the contents of this file to be fetched and displayed on the caller's machine | |
1729 | via the bos getlog command. | |
1730 | \par | |
1731 | An excerpt from a Volume Server log file follows below. The numbers appearing | |
1732 | in square brackets at the beginning of each line have been inserted so that we | |
1733 | may reference the individual lines of the log excerpt in the following | |
1734 | paragraph. | |
1735 | \code | |
1736 | [1] Wed May 8 06:03:00 1991 AttachVolume: Error attaching volume | |
1737 | /vicepd/V1969547815.vol; volume needs salvage | |
1738 | [2] Wed May 8 06:03:01 1991 Volser: ListVolumes: Could not attach volume | |
1739 | 1969547815 | |
1740 | [3] Wed May 8 07:36:13 1991 Volser: Clone: Cloning volume 1969541499 to new | |
1741 | volume 1969541501 | |
1742 | [4] Wed May 8 11:25:05 1991 AttachVolume: Cannot read volume header | |
1743 | /vicepd/V1969547415.vol | |
1744 | [5] Wed May 8 11:25:06 1991 Volser: CreateVolume: volume 1969547415 | |
1745 | (bld.dce.s3.dv.pmax_ul3) created | |
1746 | \endcode | |
1747 | \par | |
1748 | Line [1] indicates that the volume whose numerical ID is 1969547815 could not | |
1749 | be attached on partition /vicepd. This error is probably the result of an | |
1750 | aborted transaction which left the volume in an inconsistent state, or by | |
1751 | actual damage to the volume structure or data. In this case, the Volume Server | |
1752 | recommends that the salvager program be run on this volume to restore its | |
1753 | integrity. Line [2] records the operation which revealed this situation, namely | |
1754 | the invocation of an AFSVolListVolumes() RPC. | |
1755 | \par | |
1756 | Line [4] reveals that the volume header file for a specific volume could not be | |
1757 | read. Line [5], as with line [2] in the above paragraph, indicates why this is | |
1758 | true. Someone had called the AFSVolCreateVolume() interface function, and as a | |
1759 | precaution, the Volume Server first checked to see if such a volume was already | |
1760 | present by attempting to read its header. | |
1761 | \par | |
1762 | Thus verifying that the volume did not previously exist, the Volume Server | |
1763 | allowed the AFSVolCreateVolume() call to continue its processing, creating and | |
1764 | initializing the proper volume file, V1969547415.vol, and the associated header | |
1765 | and index inodes. | |
1766 | ||
1767 | \page chap5 Chapter 5: Volume Server Interface | |
1768 | ||
1769 | \section sec5-1 Section 5.1 Introduction | |
1770 | ||
1771 | \par | |
1772 | This chapter documents the API for the Volume Server facility, as defined by | |
1773 | the volint.xg Rxgen interface file and the volser.h include file. Descriptions | |
1774 | of all the constants, structures, macros, and interface functions available to | |
1775 | the application programmer appear here. | |
1776 | ||
1777 | \section sec5-2 Section 5.2: Constants | |
1778 | ||
1779 | \par | |
1780 | This section covers the basic constant definitions of interest to the Volume | |
1781 | Server application programmer. These definitions appear in the volint.h file, | |
1782 | automatically generated from the volint.xg Rxgen interface file, and in | |
1783 | volser.h. | |
1784 | \par | |
1785 | Each subsection is devoted to describing the constants falling into the | |
1786 | following categories: | |
1787 | \li Configuration and boundary values | |
1788 | \li Interface routine opcodes | |
1789 | \li Transaction Flags | |
1790 | \li Volume Types | |
1791 | \li LWP State | |
1792 | \li States for struct vldbentry | |
1793 | \li Validity Checks | |
1794 | \li Miscellaneous | |
1795 | ||
1796 | \subsection sec5-2-1 Section 5.2.1: Configuration and Boundary Values | |
1797 | ||
1798 | \par | |
1799 | These constants define some basic system configuration values, along with such | |
1800 | things as maximum sizes of important arrays. | |
1801 | ||
1802 | MyPort 5,003 The Rx UDP port on which the Volume Server service may be | |
1803 | found. | |
1804 | \par Name | |
1805 | NameLen | |
1806 | \par Value | |
1807 | 80 | |
1808 | \par Description | |
1809 | Used by the vos utility to define maximum lengths for internal filename | |
1810 | variables. | |
1811 | ||
1812 | \par Name | |
1813 | VLDB MAXSERVERS | |
1814 | \par Value | |
1815 | 10 | |
1816 | \par Description | |
1817 | Maximum number of server agents implementing the AFS Volume Location Database | |
1818 | (VLDB) for the cell. | |
1819 | ||
1820 | \par Name | |
1821 | VOLSERVICE ID | |
1822 | \par Value | |
1823 | 4 | |
1824 | \par Description | |
1825 | The Rx service number on the given UDP port (MyPort) above. | |
1826 | ||
1827 | \par Name | |
1828 | INVALID BID | |
1829 | \par Value | |
1830 | 0 | |
1831 | \par Description | |
1832 | Used as an invalid read-only or backup volume ID. | |
1833 | ||
1834 | \par Name | |
1835 | VOLSER MAXVOLNAME | |
1836 | \par Value | |
1837 | 65 | |
1838 | \par Description | |
1839 | The number of characters in the longest possible volume name, including the | |
1840 | trailing null. Note: this is only used by the vos utility; the Volume Server | |
1841 | uses the "old" value below. | |
1842 | ||
1843 | \par Name | |
1844 | VOLSER OLDMAXVOLNAME | |
1845 | \par Value | |
1846 | 32 | |
1847 | \par Description | |
1848 | The "old" maximum number of characters in an AFS volume name, including the | |
1849 | trailing null. In reality, it is also the current maximum. | |
1850 | ||
1851 | \par Name | |
1852 | VOLSER MAX REPSITES | |
1853 | \par Value | |
1854 | 7 | |
1855 | \par Description | |
1856 | The maximum number of replication sites for a volume. | |
1857 | ||
1858 | \par Name | |
1859 | VNAMESIZE | |
1860 | \par Value | |
1861 | 32 | |
1862 | \par Description | |
1863 | Size in bytes of the name field in struct volintInfo (see Section 5.4.6). | |
1864 | ||
1865 | ||
1866 | \subsection sec5-2-2 Section 5.2.2: Interface Routine Opcodes | |
1867 | ||
1868 | \par | |
1869 | These constants, appearing in the volint.xg Rxgen interface file for the Volume | |
1870 | Server, define the opcodes for the RPC routines. Every Rx call on this | |
1871 | interface contains this opcode, and the dispatcher uses it to select the proper | |
1872 | code at the server site to carry out the call. | |
1873 | ||
1874 | \par Name | |
1875 | VOLCREATEVOLUME | |
1876 | \par Value | |
1877 | 100 | |
1878 | \par Description | |
1879 | Opcode for AFSVolCreateVolume() | |
1880 | ||
1881 | \par Name | |
1882 | VOLDELETEVOLUME | |
1883 | \par Value | |
1884 | 101 | |
1885 | \par Description | |
1886 | Opcode for AFSVolDeleteVolume() | |
1887 | ||
1888 | \par Name | |
1889 | VOLRESTORE | |
1890 | \par Value | |
1891 | 102 | |
1892 | \par Description | |
1893 | Opcode for AFSVolRestoreVolume() | |
1894 | ||
1895 | \par Name | |
1896 | VOLFORWARD | |
1897 | \par Value | |
1898 | 103 | |
1899 | \par Description | |
1900 | Opcode for AFSVolForward() | |
1901 | ||
1902 | \par Name | |
1903 | VOLENDTRANS | |
1904 | \par Value | |
1905 | 104 | |
1906 | \par Description | |
1907 | Opcode for AFSVolEndTrans() | |
1908 | ||
1909 | \par Name | |
1910 | VOLCLONE | |
1911 | \par Value | |
1912 | 105 | |
1913 | \par Description | |
1914 | Opcode for AFSVolClone() . | |
1915 | ||
1916 | \par Name | |
1917 | VOLSETFLAGS | |
1918 | \par Value | |
1919 | 106 | |
1920 | \par Description | |
1921 | Opcode for AFSVolSetFlags() | |
1922 | ||
1923 | \par Name | |
1924 | VOLGETFLAGS | |
1925 | \par Value | |
1926 | 107 | |
1927 | \par Description | |
1928 | Opcode for AFSVolGetFlags() | |
1929 | ||
1930 | \par Name | |
1931 | VOLTRANSCREATE | |
1932 | \par Value | |
1933 | 108 | |
1934 | \par Description | |
1935 | Opcode for AFSVolTransCreate() | |
1936 | ||
1937 | \par Name | |
1938 | VOLDUMP | |
1939 | \par Value | |
1940 | 109 | |
1941 | \par Description | |
1942 | Opcode for AFSVolDump() | |
1943 | ||
1944 | \par Name | |
1945 | VOLGETNTHVOLUME | |
1946 | \par Value | |
1947 | 110 | |
1948 | \par Description | |
1949 | Opcode for AFSVolGetNthVolume() | |
1950 | ||
1951 | \par Name | |
1952 | VOLSETFORWARDING | |
1953 | \par Value | |
1954 | 111 | |
1955 | \par Description | |
1956 | Opcode for AFSVolSetForwarding() | |
1957 | ||
1958 | \par Name | |
1959 | VOLGETNAME | |
1960 | \par Value | |
1961 | 112 | |
1962 | \par Description | |
1963 | Opcode for AFSVolGetName() | |
1964 | ||
1965 | \par Name | |
1966 | VOLGETSTATUS | |
1967 | \par Value | |
1968 | 113 | |
1969 | \par Description | |
1970 | Opcode for AFSVolGetStatus() | |
1971 | ||
1972 | \par Name | |
1973 | VOLSIGRESTORE | |
1974 | \par Value | |
1975 | 114 | |
1976 | \par Description | |
1977 | Opcode for AFSVolSignalRestore() | |
1978 | ||
1979 | \par Name | |
1980 | VOLLISTPARTITIONS | |
1981 | \par Value | |
1982 | 115 | |
1983 | \par Description | |
1984 | Opcode for AFSVolListPartitions() | |
1985 | ||
1986 | \par Name | |
1987 | VOLLISTVOLS | |
1988 | \par Value | |
1989 | 116 | |
1990 | \par Description | |
1991 | Opcode for AFSVolListVolumes() | |
1992 | ||
1993 | \par Name | |
1994 | VOLSETIDSTYPES | |
1995 | \par Value | |
1996 | 117 | |
1997 | \par Description | |
1998 | Opcode for AFSVolSetIdsTypes() | |
1999 | ||
2000 | \par Name | |
2001 | VOLMONITOR | |
2002 | \par Value | |
2003 | 118 | |
2004 | \par Description | |
2005 | Opcode for AFSVolMonitor() | |
2006 | ||
2007 | \par Name | |
2008 | VOLDISKPART | |
2009 | \par Value | |
2010 | 119 | |
2011 | \par Description | |
2012 | Opcode for AFSVolPartitionInfo() | |
2013 | ||
2014 | \par Name | |
2015 | VOLRECLONE | |
2016 | \par Value | |
2017 | 120 | |
2018 | \par Description | |
2019 | Opcode for AFSVolReClone() | |
2020 | ||
2021 | \par Name | |
2022 | VOLLISTONEVOL | |
2023 | \par Value | |
2024 | 121 | |
2025 | \par Description | |
2026 | Opcode for AFSVolListOneVolume() | |
2027 | ||
2028 | \par Name | |
2029 | VOLNUKE | |
2030 | \par Value | |
2031 | 122 | |
2032 | \par Description | |
2033 | Opcode for AFSVolNukeVolume() | |
2034 | ||
2035 | \par Name | |
2036 | VOLSETDATE | |
2037 | \par Value | |
2038 | 123 | |
2039 | \par Description | |
2040 | Opcode for AFSVolSetDate() | |
2041 | ||
2042 | \subsection sec5-2-3 Section 5.2.3: Transaction Flags | |
2043 | ||
2044 | \par | |
2045 | These constants define the various flags the Volume Server uses in assocation | |
2046 | with volume transactions, keeping track of volumes upon which operations are | |
2047 | currently proceeding. There are three sets of flag values, stored in three | |
2048 | different fields within a struct volser trans: general volume state, attachment | |
2049 | modes, and specific transaction states. | |
2050 | ||
2051 | \subsubsection sec5-2-3-1: Section 5.2.3.1 vflags | |
2052 | ||
2053 | \par | |
2054 | These values are used to represent the general state of the associated volume. | |
2055 | They appear in the vflags field within a struct volser trans. | |
2056 | ||
2057 | \par Name | |
2058 | VTDeleteOnSalvage | |
2059 | \par Value | |
2060 | 1 | |
2061 | \par Description | |
2062 | The volume should be deleted on next salvage. | |
2063 | ||
2064 | \par Name | |
2065 | VTOutOfService | |
2066 | \par Value | |
2067 | 2 | |
2068 | \par Description | |
2069 | This volume should never be put online. | |
2070 | ||
2071 | \par Name | |
2072 | VTDeleted | |
2073 | \par Value | |
2074 | 4 | |
2075 | \par Description | |
2076 |