]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/doc/papers/fsinterface/fsinterface.ms
Add liblutok a lightweight C++ API for lua.
[FreeBSD/FreeBSD.git] / share / doc / papers / fsinterface / fsinterface.ms
1 .\" Copyright (c) 1986 The Regents of the University of California.
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. Neither the name of the University nor the names of its contributors
13 .\"    may be used to endorse or promote products derived from this software
14 .\"    without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .\"     @(#)fsinterface.ms      1.4 (Berkeley) 4/16/91
29 .\" $FreeBSD$
30 .\"
31 .nr UX 0
32 .de UX
33 .ie \\n(UX \s-1UNIX\s0\\$1
34 .el \{\
35 \s-1UNIX\s0\\$1\(dg
36 .FS
37 \(dg \s-1UNIX\s0 is a registered trademark of AT&T.
38 .FE
39 .nr UX 1
40 .\}
41 ..
42 .TL
43 Toward a Compatible Filesystem Interface
44 .AU
45 Michael J. Karels
46 Marshall Kirk McKusick
47 .AI
48 Computer Systems Research Group
49 Computer Science Division
50 Department of Electrical Engineering and Computer Science
51 University of California, Berkeley
52 Berkeley, California  94720
53 .AB
54 .LP
55 As network or remote filesystems have been implemented for
56 .UX ,
57 several stylized interfaces between the filesystem implementation
58 and the rest of the kernel have been developed.
59 .FS
60 This is an update of a paper originally presented
61 at the September 1986 conference of the European
62 .UX
63 Users' Group.
64 Last modified April 16, 1991.
65 .FE
66 Notable among these are Sun Microsystems' Virtual Filesystem interface (VFS)
67 using vnodes, Digital Equipment's Generic File System (GFS) architecture,
68 and AT&T's File System Switch (FSS).
69 Each design attempts to isolate filesystem-dependent details
70 below a generic interface and to provide a framework within which
71 new filesystems may be incorporated.
72 However, each of these interfaces is different from
73 and incompatible with the others.
74 Each of them addresses somewhat different design goals.
75 Each was based on a different starting version of
76 .UX ,
77 targetted a different set of filesystems with varying characteristics,
78 and uses a different set of primitive operations provided by the filesystem.
79 The current study compares the various filesystem interfaces.
80 Criteria for comparison include generality, completeness, robustness,
81 efficiency and esthetics.
82 Several of the underlying design issues are examined in detail.
83 As a result of this comparison, a proposal for a new filesystem interface
84 is advanced that includes the best features of the existing implementations.
85 The proposal adopts the calling convention for name lookup introduced
86 in 4.3BSD, but is otherwise closely related to Sun's VFS.
87 A prototype implementation is now being developed at Berkeley.
88 This proposal and the rationale underlying its development
89 have been presented to major software vendors
90 as an early step toward convergence on a compatible filesystem interface.
91 .AE
92 .NH
93 Introduction
94 .PP
95 As network communications and workstation environments
96 became common elements in
97 .UX
98 systems, several vendors of
99 .UX
100 systems have designed and built network file systems
101 that allow client process on one
102 .UX
103 machine to access files on a server machine.
104 Examples include Sun's Network File System, NFS [Sandberg85],
105 AT&T's recently-announced Remote File Sharing, RFS [Rifkin86],
106 the LOCUS distributed filesystem [Walker85],
107 and Masscomp's extended filesystem [Cole85].
108 Other remote filesystems have been implemented in research or university groups
109 for internal use, notably the network filesystem in the Eighth Edition
110 .UX
111 system [Weinberger84] and two different filesystems used at Carnegie-Mellon
112 University [Satyanarayanan85].
113 Numerous other remote file access methods have been devised for use
114 within individual
115 .UX
116 processes,
117 many of them by modifications to the C I/O library
118 similar to those in the Newcastle Connection [Brownbridge82].
119 .PP
120 Multiple network filesystems may frequently
121 be found in use within a single organization.
122 These circumstances make it highly desirable to be able to transport filesystem
123 implementations from one system to another.
124 Such portability is considerably enhanced by the use of a stylized interface
125 with carefully-defined entry points to separate the filesystem from the rest
126 of the operating system.
127 This interface should be similar to the interface between device drivers
128 and the kernel.
129 Although varying somewhat among the common versions of
130 .UX ,
131 the device driver interfaces are sufficiently similar that device drivers
132 may be moved from one system to another without major problems.
133 A clean, well-defined interface to the filesystem also allows a single
134 system to support multiple local filesystem types.
135 .PP
136 For reasons such as these, several filesystem interfaces have been used
137 when integrating new filesystems into the system.
138 The best-known of these are Sun Microsystems' Virtual File System interface,
139 VFS [Kleiman86], and AT&T's File System Switch, FSS.
140 Another interface, known as the Generic File System, GFS,
141 has been implemented for the ULTRIX\(dd
142 .FS
143 \(dd ULTRIX is a trademark of Digital Equipment Corp.
144 .FE
145 system by Digital [Rodriguez86].
146 There are numerous differences among these designs.
147 The differences may be understood from the varying philosophies
148 and design goals of the groups involved, from the systems under which
149 the implementations were done, and from the filesystems originally targetted
150 by the designs.
151 These differences are summarized in the following sections
152 within the limitations of the published specifications.
153 .NH
154 Design goals
155 .PP
156 There are several design goals which, in varying degrees,
157 have driven the various designs.
158 Each attempts to divide the filesystem into a filesystem-type-independent
159 layer and individual filesystem implementations.
160 The division between these layers occurs at somewhat different places
161 in these systems, reflecting different views of the diversity and types
162 of the filesystems that may be accommodated.
163 Compatibility with existing local filesystems has varying importance;
164 at the user-process level, each attempts to be completely transparent
165 except for a few filesystem-related system management programs.
166 The AT&T interface also makes a major effort to retain familiar internal
167 system interfaces, and even to retain object-file-level binary compatibility
168 with operating system modules such as device drivers.
169 Both Sun and DEC were willing to change internal data structures and interfaces
170 so that other operating system modules might require recompilation
171 or source-code modification.
172 .PP
173 AT&T's interface both allows and requires filesystems to support the full
174 and exact semantics of their previous filesystem,
175 including interruptions of system calls on slow operations.
176 System calls that deal with remote files are encapsulated
177 with their environment and sent to a server where execution continues.
178 The system call may be aborted by either client or server, returning
179 control to the client.
180 Most system calls that descend into the file-system dependent layer
181 of a filesystem other than the standard local filesystem do not return
182 to the higher-level kernel calling routines.
183 Instead, the filesystem-dependent code completes the requested
184 operation and then executes a non-local goto (\fIlongjmp\fP) to exit the
185 system call.
186 These efforts to avoid modification of main-line kernel code
187 indicate a far greater emphasis on internal compatibility than on modularity,
188 clean design, or efficiency.
189 .PP
190 In contrast, the Sun VFS interface makes major modifications to the internal
191 interfaces in the kernel, with a very clear separation
192 of filesystem-independent and -dependent data structures and operations.
193 The semantics of the filesystem are largely retained for local operations,
194 although this is achieved at some expense where it does not fit the internal
195 structuring well.
196 The filesystem implementations are not required to support the same
197 semantics as local
198 .UX
199 filesystems.
200 Several historical features of
201 .UX
202 filesystem behavior are difficult to achieve using the VFS interface,
203 including the atomicity of file and link creation and the use of open files
204 whose names have been removed.
205 .PP
206 A major design objective of Sun's network filesystem,
207 statelessness,
208 permeates the VFS interface.
209 No locking may be done in the filesystem-independent layer,
210 and locking in the filesystem-dependent layer may occur only during
211 a single call into that layer.
212 .PP
213 A final design goal of most implementors is performance.
214 For remote filesystems,
215 this goal tends to be in conflict with the goals of complete semantic
216 consistency, compatibility and modularity.
217 Sun has chosen performance over modularity in some areas,
218 but has emphasized clean separation of the layers within the filesystem
219 at the expense of performance.
220 Although the performance of RFS is yet to be seen,
221 AT&T seems to have considered compatibility far more important than modularity
222 or performance.
223 .NH
224 Differences among filesystem interfaces
225 .PP
226 The existing filesystem interfaces may be characterized
227 in several ways.
228 Each system is centered around a few data structures or objects,
229 along with a set of primitives for performing operations upon these objects.
230 In the original
231 .UX
232 filesystem [Ritchie74],
233 the basic object used by the filesystem is the inode, or index node.
234 The inode contains all of the information about a file except its name:
235 its type, identification, ownership, permissions, timestamps and location.
236 Inodes are identified by the filesystem device number and the index within
237 the filesystem.
238 The major entry points to the filesystem are \fInamei\fP,
239 which translates a filesystem pathname into the underlying inode,
240 and \fIiget\fP, which locates an inode by number and installs it in the in-core
241 inode table.
242 \fINamei\fP performs name translation by iterative lookup
243 of each component name in its directory to find its inumber,
244 then using \fIiget\fP to return the actual inode.
245 If the last component has been reached, this inode is returned;
246 otherwise, the inode describes the next directory to be searched.
247 The inode returned may be used in various ways by the caller;
248 it may be examined, the file may be read or written,
249 types and access may be checked, and fields may be modified.
250 Modified inodes are automatically written back to the filesystem
251 on disk when the last reference is released with \fIiput\fP.
252 Although the details are considerably different,
253 the same general scheme is used in the faster filesystem in 4.2BSD
254 .UX
255 [Mckusick85].
256 .PP
257 Both the AT&T interface and, to a lesser extent, the DEC interface
258 attempt to preserve the inode-oriented interface.
259 Each modify the inode to allow different varieties of the structure
260 for different filesystem types by separating the filesystem-dependent
261 parts of the inode into a separate structure or one arm of a union.
262 Both interfaces allow operations
263 equivalent to the \fInamei\fP and \fIiget\fP operations
264 of the old filesystem to be performed in the filesystem-independent
265 layer, with entry points to the individual filesystem implementations to support
266 the type-specific parts of these operations.  Implicit in this interface
267 is that files may be conveniently be named by and located using a single
268 index within a filesystem.
269 The GFS provides specific entry points to the filesystems
270 to change most file properties rather than allowing arbitrary changes
271 to be made to the generic part of the inode.
272 .PP
273 In contrast, the Sun VFS interface replaces the inode as the primary object
274 with the vnode.
275 The vnode contains no filesystem-dependent fields except the pointer
276 to the set of operations implemented by the filesystem.
277 Properties of a vnode that might be transient, such as the ownership,
278 permissions, size and timestamps, are maintained by the lower layer.
279 These properties may be presented in a generic format upon request;
280 callers are expected not to hold this information for any length of time,
281 as they may not be up-to-date later on.
282 The vnode operations do not include a corollary for \fIiget\fP;
283 the only external interface for obtaining vnodes for specific files
284 is the name lookup operation.
285 (Separate procedures are provided outside of this interface
286 that obtain a ``file handle'' for a vnode which may be given
287 to a client by a server, such that the vnode may be retrieved
288 upon later presentation of the file handle.)
289 .NH
290 Name translation issues
291 .PP
292 Each of the systems described include a mechanism for performing
293 pathname-to-internal-representation translation.
294 The style of the name translation function is very different in all
295 three systems.
296 As described above, the AT&T and DEC systems retain the \fInamei\fP function.
297 The two are quite different, however, as the ULTRIX interface uses
298 the \fInamei\fP calling convention introduced in 4.3BSD.
299 The parameters and context for the name lookup operation
300 are collected in a \fInameidata\fP structure which is passed to \fInamei\fP
301 for operation.
302 Intent to create or delete the named file is declared in advance,
303 so that the final directory scan in \fInamei\fP may retain information
304 such as the offset in the directory at which the modification will be made.
305 Filesystems that use such mechanisms to avoid redundant work
306 must therefore lock the directory to be modified so that it may not
307 be modified by another process before completion.
308 In the System V filesystem, as in previous versions of
309 .UX ,
310 this information is stored in the per-process \fIuser\fP structure
311 by \fInamei\fP for use by a low-level routine called after performing
312 the actual creation or deletion of the file itself.
313 In 4.3BSD and in the GFS interface, these side effects of \fInamei\fP
314 are stored in the \fInameidata\fP structure given as argument to \fInamei\fP,
315 which is also presented to the routine implementing file creation or deletion.
316 .PP
317 The ULTRIX \fInamei\fP routine is responsible for the generic
318 parts of the name translation process, such as copying the name into
319 an internal buffer, validating it, interpolating
320 the contents of symbolic links, and indirecting at mount points.
321 As in 4.3BSD, the name is copied into the buffer in a single call,
322 according to the location of the name.
323 After determining the type of the filesystem at the start of translation
324 (the current directory or root directory), it calls the filesystem's
325 \fInamei\fP entry with the same structure it received from its caller.
326 The filesystem-specific routine translates the name, component by component,
327 as long as no mount points are reached.
328 It may return after any number of components have been processed.
329 \fINamei\fP performs any processing at mount points, then calls
330 the correct translation routine for the next filesystem.
331 Network filesystems may pass the remaining pathname to a server for translation,
332 or they may look up the pathname components one at a time.
333 The former strategy would be more efficient,
334 but the latter scheme allows mount points within a remote filesystem
335 without server knowledge of all client mounts.
336 .PP
337 The AT&T \fInamei\fP interface is presumably the same as that in previous
338 .UX
339 systems, accepting the name of a routine to fetch pathname characters
340 and an operation (one of: lookup, lookup for creation, or lookup for deletion).
341 It translates, component by component, as before.
342 If it detects that a mount point crosses to a remote filesystem,
343 it passes the remainder of the pathname to the remote server.
344 A pathname-oriented request other than open may be completed
345 within the \fInamei\fP call,
346 avoiding return to the (unmodified) system call handler
347 that called \fInamei\fP.
348 .PP
349 In contrast to the first two systems, Sun's VFS interface has replaced
350 \fInamei\fP with \fIlookupname\fP.
351 This routine simply calls a new pathname-handling module to allocate
352 a pathname buffer and copy in the pathname (copying a character per call),
353 then calls \fIlookuppn\fP.
354 \fILookuppn\fP performs the iteration over the directories leading
355 to the destination file; it copies each pathname component to a local buffer,
356 then calls the filesystem \fIlookup\fP entry to locate the vnode
357 for that file in the current directory.
358 Per-filesystem \fIlookup\fP routines may translate only one component
359 per call.
360 For creation and deletion of new files, the lookup operation is unmodified;
361 the lookup of the final component only serves to check for the existence
362 of the file.
363 The subsequent creation or deletion call, if any, must repeat the final
364 name translation and associated directory scan.
365 For new file creation in particular, this is rather inefficient,
366 as file creation requires two complete scans of the directory.
367 .PP
368 Several of the important performance improvements in 4.3BSD
369 were related to the name translation process [McKusick85][Leffler84].
370 The following changes were made:
371 .IP 1. 4
372 A system-wide cache of recent translations is maintained.
373 The cache is separate from the inode cache, so that multiple names
374 for a file may be present in the cache.
375 The cache does not hold ``hard'' references to the inodes,
376 so that the normal reference pattern is not disturbed.
377 .IP 2.
378 A per-process cache is kept of the directory and offset
379 at which the last successful name lookup was done.
380 This allows sequential lookups of all the entries in a directory to be done
381 in linear time.
382 .IP 3.
383 The entire pathname is copied into a kernel buffer in a single operation,
384 rather than using two subroutine calls per character.
385 .IP 4.
386 A pool of pathname buffers are held by \fInamei\fP, avoiding allocation
387 overhead.
388 .LP
389 All of these performance improvements from 4.3BSD are well worth using
390 within a more generalized filesystem framework.
391 The generalization of the structure may otherwise make an already-expensive
392 function even more costly.
393 Most of these improvements are present in the GFS system, as it derives
394 from the beta-test version of 4.3BSD.
395 The Sun system uses a name-translation cache generally like that in 4.3BSD.
396 The name cache is a filesystem-independent facility provided for the use
397 of the filesystem-specific lookup routines.
398 The Sun cache, like that first used at Berkeley but unlike that in 4.3,
399 holds a ``hard'' reference to the vnode (increments the reference count).
400 The ``soft'' reference scheme in 4.3BSD cannot be used with the current
401 NFS implementation, as NFS allocates vnodes dynamically and frees them
402 when the reference count returns to zero rather than caching them.
403 As a result, fewer names may be held in the cache
404 than (local filesystem) vnodes, and the cache distorts the normal reference
405 patterns otherwise seen by the LRU cache.
406 As the name cache references overflow the local filesystem inode table,
407 the name cache must be purged to make room in the inode table.
408 Also, to determine whether a vnode is in use (for example,
409 before mounting upon it), the cache must be flushed to free any
410 cache reference.
411 These problems should be corrected
412 by the use of the soft cache reference scheme.
413 .PP
414 A final observation on the efficiency of name translation in the current
415 Sun VFS architecture is that the number of subroutine calls used
416 by a multi-component name lookup is dramatically larger
417 than in the other systems.
418 The name lookup scheme in GFS suffers from this problem much less,
419 at no expense in violation of layering.
420 .PP
421 A final problem to be considered is synchronization and consistency.
422 As the filesystem operations are more stylized and broken into separate
423 entry points for parts of operations, it is more difficult to guarantee
424 consistency throughout an operation and/or to synchronize with other
425 processes using the same filesystem objects.
426 The Sun interface suffers most severely from this,
427 as it forbids the filesystems from locking objects across calls
428 to the filesystem.
429 It is possible that a file may be created between the time that a lookup
430 is performed and a subsequent creation is requested.
431 Perhaps more strangely, after a lookup fails to find the target
432 of a creation attempt, the actual creation might find that the target
433 now exists and is a symbolic link.
434 The call will either fail unexpectedly, as the target is of the wrong type,
435 or the generic creation routine will have to note the error
436 and restart the operation from the lookup.
437 This problem will always exist in a stateless filesystem,
438 but the VFS interface forces all filesystems to share the problem.
439 This restriction against locking between calls also
440 forces duplication of work during file creation and deletion.
441 This is considered unacceptable.
442 .NH
443 Support facilities and other interactions
444 .PP
445 Several support facilities are used by the current
446 .UX
447 filesystem and require generalization for use by other filesystem types.
448 For filesystem implementations to be portable,
449 it is desirable that these modified support facilities
450 should also have a uniform interface and 
451 behave in a consistent manner in target systems.
452 A prominent example is the filesystem buffer cache.
453 The buffer cache in a standard (System V or 4.3BSD)
454 .UX
455 system contains physical disk blocks with no reference to the files containing
456 them.
457 This works well for the local filesystem, but has obvious problems
458 for remote filesystems.
459 Sun has modified the buffer cache routines to describe buffers by vnode
460 rather than by device.
461 For remote files, the vnode used is that of the file, and the block
462 numbers are virtual data blocks.
463 For local filesystems, a vnode for the block device is used for cache reference,
464 and the block numbers are filesystem physical blocks.
465 Use of per-file cache description does not easily accommodate
466 caching of indirect blocks, inode blocks, superblocks or cylinder group blocks.
467 However, the vnode describing the block device for the cache
468 is one created internally,
469 rather than the vnode for the device looked up when mounting,
470 and it is located by searching a private list of vnodes
471 rather than by holding it in the mount structure.
472 Although the Sun modification makes it possible to use the buffer
473 cache for data blocks of remote files, a better generalization
474 of the buffer cache is needed.
475 .PP
476 The RFS filesystem used by AT&T does not currently cache data blocks
477 on client systems, thus the buffer cache is probably unmodified.
478 The form of the buffer cache in ULTRIX is unknown to us.
479 .PP
480 Another subsystem that has a large interaction with the filesystem
481 is the virtual memory system.
482 The virtual memory system must read data from the filesystem
483 to satisfy fill-on-demand page faults.
484 For efficiency, this read call is arranged to place the data directly
485 into the physical pages assigned to the process (a ``raw'' read) to avoid
486 copying the data.
487 Although the read operation normally bypasses the filesystem buffer cache,
488 consistency must be maintained by checking the buffer cache and copying
489 or flushing modified data not yet stored on disk.
490 The 4.2BSD virtual memory system, like that of Sun and ULTRIX,
491 maintains its own cache of reusable text pages.
492 This creates additional complications.
493 As the virtual memory systems are redesigned, these problems should be
494 resolved by reading through the buffer cache, then mapping the cached
495 data into the user address space.
496 If the buffer cache or the process pages are changed while the other reference
497 remains, the data would have to be copied (``copy-on-write'').
498 .PP
499 In the meantime, the current virtual memory systems must be used
500 with the new filesystem framework.
501 Both the Sun and AT&T filesystem interfaces
502 provide entry points to the filesystem for optimization of the virtual
503 memory system by performing logical-to-physical block number translation
504 when setting up a fill-on-demand image for a process.
505 The VFS provides a vnode operation analogous to the \fIbmap\fP function of the
506 .UX
507 filesystem.
508 Given a vnode and logical block number, it returns a vnode and block number
509 which may be read to obtain the data.
510 If the filesystem is local, it returns the private vnode for the block device
511 and the physical block number.
512 As the \fIbmap\fP operations are all performed at one time, during process
513 startup, any indirect blocks for the file will remain in the cache
514 after they are once read.
515 In addition, the interface provides a \fIstrategy\fP entry that may be used
516 for ``raw'' reads from a filesystem device,
517 used to read data blocks into an address space without copying.
518 This entry uses a buffer header (\fIbuf\fP structure)
519 to describe the I/O operation
520 instead of a \fIuio\fP structure.
521 The buffer-style interface is the same as that used by disk drivers internally.
522 This difference allows the current \fIuio\fP primitives to be avoided,
523 as they copy all data to/from the current user process address space.
524 Instead, for local filesystems these operations could be done internally
525 with the standard raw disk read routines,
526 which use a \fIuio\fP interface.
527 When loading from a remote filesystems,
528 the data will be received in a network buffer.
529 If network buffers are suitably aligned,
530 the data may be mapped into the process address space by a page swap
531 without copying.
532 In either case, it should be possible to use the standard filesystem
533 read entry from the virtual memory system.
534 .PP
535 Other issues that must be considered in devising a portable
536 filesystem implementation include kernel memory allocation,
537 the implicit use of user-structure global context,
538 which may create problems with reentrancy,
539 the style of the system call interface,
540 and the conventions for synchronization
541 (sleep/wakeup, handling of interrupted system calls, semaphores).
542 .NH
543 The Berkeley Proposal
544 .PP
545 The Sun VFS interface has been most widely used of the three described here.
546 It is also the most general of the three, in that filesystem-specific
547 data and operations are best separated from the generic layer.
548 Although it has several disadvantages which were described above,
549 most of them may be corrected with minor changes to the interface
550 (and, in a few areas, philosophical changes).
551 The DEC GFS has other advantages, in particular the use of the 4.3BSD
552 \fInamei\fP interface and optimizations.
553 It allows single or multiple components of a pathname
554 to be translated in a single call to the specific filesystem
555 and thus accommodates filesystems with either preference.
556 The FSS is least well understood, as there is little public information
557 about the interface.
558 However, the design goals are the least consistent with those of the Berkeley
559 research groups.
560 Accordingly, a new filesystem interface has been devised to avoid
561 some of the problems in the other systems.
562 The proposed interface derives directly from Sun's VFS,
563 but, like GFS, uses a 4.3BSD-style name lookup interface.
564 Additional context information has been moved from the \fIuser\fP structure
565 to the \fInameidata\fP structure so that name translation may be independent
566 of the global context of a user process.
567 This is especially desired in any system where kernel-mode servers
568 operate as light-weight or interrupt-level processes,
569 or where a server may store or cache context for several clients.
570 This calling interface has the additional advantage
571 that the call parameters need not all be pushed onto the stack for each call
572 through the filesystem interface,
573 and they may be accessed using short offsets from a base pointer
574 (unlike global variables in the \fIuser\fP structure).
575 .PP
576 The proposed filesystem interface is described very tersely here.
577 For the most part, data structures and procedures are analogous
578 to those used by VFS, and only the changes will be treated here.
579 See [Kleiman86] for complete descriptions of the vfs and vnode operations
580 in Sun's interface.
581 .PP
582 The central data structure for name translation is the \fInameidata\fP
583 structure.
584 The same structure is used to pass parameters to \fInamei\fP,
585 to pass these same parameters to filesystem-specific lookup routines,
586 to communicate completion status from the lookup routines back to \fInamei\fP,
587 and to return completion status to the calling routine.
588 For creation or deletion requests, the parameters to the filesystem operation
589 to complete the request are also passed in this same structure.
590 The form of the \fInameidata\fP structure is:
591 .br
592 .ne 2i
593 .ID
594 .nf
595 .ta .5i +\w'caddr_t\0\0\0'u +\w'struct\0\0'u +\w'vnode *nc_prevdir;\0\0\0\0\0'u
596 /*
597  * Encapsulation of namei parameters.
598  * One of these is located in the u. area to
599  * minimize space allocated on the kernel stack
600  * and to retain per-process context.
601  */
602 struct nameidata {
603                 /* arguments to namei and related context: */
604         caddr_t ni_dirp;                /* pathname pointer */
605         enum    uio_seg ni_seg;         /* location of pathname */
606         short   ni_nameiop;             /* see below */
607         struct  vnode *ni_cdir;         /* current directory */
608         struct  vnode *ni_rdir;         /* root directory, if not normal root */
609         struct  ucred *ni_cred;         /* credentials */
610
611                 /* shared between namei, lookup routines and commit routines: */
612         caddr_t ni_pnbuf;               /* pathname buffer */
613         char    *ni_ptr;                /* current location in pathname */
614         int     ni_pathlen;             /* remaining chars in path */
615         short   ni_more;                /* more left to translate in pathname */
616         short   ni_loopcnt;             /* count of symlinks encountered */
617
618                 /* results: */
619         struct  vnode *ni_vp;           /* vnode of result */
620         struct  vnode *ni_dvp;          /* vnode of intermediate directory */
621
622 /* BEGIN UFS SPECIFIC */
623         struct diroffcache {            /* last successful directory search */
624                 struct  vnode *nc_prevdir;      /* terminal directory */
625                 long    nc_id;                  /* directory's unique id */
626                 off_t   nc_prevoffset;          /* where last entry found */
627         } ni_nc;
628 /* END UFS SPECIFIC */
629 };
630 .DE
631 .DS
632 .ta \w'#define\0\0'u +\w'WANTPARENT\0\0'u +\w'0x40\0\0\0\0\0\0\0'u
633 /*
634  * namei operations and modifiers
635  */
636 #define LOOKUP  0       /* perform name lookup only */
637 #define CREATE  1       /* setup for file creation */
638 #define DELETE  2       /* setup for file deletion */
639 #define WANTPARENT      0x10    /* return parent directory vnode also */
640 #define NOCACHE 0x20    /* name must not be left in cache */
641 #define FOLLOW  0x40    /* follow symbolic links */
642 #define NOFOLLOW        0x0     /* don't follow symbolic links (pseudo) */
643 .DE
644 As in current systems other than Sun's VFS, \fInamei\fP is called
645 with an operation request, one of LOOKUP, CREATE or DELETE.
646 For a LOOKUP, the operation is exactly like the lookup in VFS.
647 CREATE and DELETE allow the filesystem to ensure consistency
648 by locking the parent inode (private to the filesystem),
649 and (for the local filesystem) to avoid duplicate directory scans
650 by storing the new directory entry and its offset in the directory
651 in the \fIndirinfo\fP structure.
652 This is intended to be opaque to the filesystem-independent levels.
653 Not all lookups for creation or deletion are actually followed
654 by the intended operation; permission may be denied, the filesystem
655 may be read-only, etc.
656 Therefore, an entry point to the filesystem is provided
657 to abort a creation or deletion operation
658 and allow release of any locked internal data.
659 After a \fInamei\fP with a CREATE or DELETE flag, the pathname pointer
660 is set to point to the last filename component.
661 Filesystems that choose to implement creation or deletion entirely
662 within the subsequent call to a create or delete entry
663 are thus free to do so.
664 .PP
665 The \fInameidata\fP is used to store context used during name translation.
666 The current and root directories for the translation are stored here.
667 For the local filesystem, the per-process directory offset cache
668 is also kept here.
669 A file server could leave the directory offset cache empty,
670 could use a single cache for all clients,
671 or could hold caches for several recent clients.
672 .PP
673 Several other data structures are used in the filesystem operations.
674 One is the \fIucred\fP structure which describes a client's credentials
675 to the filesystem.
676 This is modified slightly from the Sun structure;
677 the ``accounting'' group ID has been merged into the groups array.
678 The actual number of groups in the array is given explicitly
679 to avoid use of a reserved group ID as a terminator.
680 Also, typedefs introduced in 4.3BSD for user and group ID's have been used.
681 The \fIucred\fP structure is thus:
682 .DS
683 .ta .5i +\w'caddr_t\0\0\0'u +\w'struct\0\0'u +\w'vnode *nc_prevdir;\0\0\0\0\0'u
684 /*
685  * Credentials.
686  */
687 struct ucred {
688         u_short cr_ref;                 /* reference count */
689         uid_t   cr_uid;                 /* effective user id */
690         short   cr_ngroups;             /* number of groups */
691         gid_t   cr_groups[NGROUPS];     /* groups */
692         /*
693          * The following either should not be here,
694          * or should be treated as opaque.
695          */
696         uid_t   cr_ruid;                /* real user id */
697         gid_t   cr_svgid;               /* saved set-group id */
698 };
699 .DE
700 .PP
701 A final structure used by the filesystem interface is the \fIuio\fP
702 structure mentioned earlier.
703 This structure describes the source or destination of an I/O
704 operation, with provision for scatter/gather I/O.
705 It is used in the read and write entries to the filesystem.
706 The \fIuio\fP structure presented here is modified from the one
707 used in 4.2BSD to specify the location of each vector of the operation
708 (user or kernel space)
709 and to allow an alternate function to be used to implement the data movement.
710 The alternate function might perform page remapping rather than a copy,
711 for example.
712 .DS
713 .ta .5i +\w'caddr_t\0\0\0'u +\w'struct\0\0'u +\w'vnode *nc_prevdir;\0\0\0\0\0'u
714 /*
715  * Description of an I/O operation which potentially
716  * involves scatter-gather, with individual sections
717  * described by iovec, below.  uio_resid is initially
718  * set to the total size of the operation, and is
719  * decremented as the operation proceeds.  uio_offset
720  * is incremented by the amount of each operation.
721  * uio_iov is incremented and uio_iovcnt is decremented
722  * after each vector is processed.
723  */
724 struct uio {
725         struct  iovec *uio_iov;
726         int     uio_iovcnt;
727         off_t   uio_offset;
728         int     uio_resid;
729         enum    uio_rw uio_rw;
730 };
731
732 enum    uio_rw { UIO_READ, UIO_WRITE };
733 .DE
734 .DS
735 .ta .5i +\w'caddr_t\0\0\0'u +\w'vnode *nc_prevdir;\0\0\0\0\0'u
736 /*
737  * Description of a contiguous section of an I/O operation.
738  * If iov_op is non-null, it is called to implement the copy
739  * operation, possibly by remapping, with the call
740  *      (*iov_op)(from, to, count);
741  * where from and to are caddr_t and count is int.
742  * Otherwise, the copy is done in the normal way,
743  * treating base as a user or kernel virtual address
744  * according to iov_segflg.
745  */
746 struct iovec {
747         caddr_t iov_base;
748         int     iov_len;
749         enum    uio_seg iov_segflg;
750         int     (*iov_op)();
751 };
752 .DE
753 .DS
754 .ta .5i +\w'UIO_USERSPACE\0\0\0\0\0'u
755 /*
756  * Segment flag values.
757  */
758 enum    uio_seg {
759         UIO_USERSPACE,          /* from user data space */
760         UIO_SYSSPACE,           /* from system space */
761 };
762 .DE
763 .NH
764 File and filesystem operations
765 .PP
766 With the introduction of the data structures used by the filesystem
767 operations, the complete list of filesystem entry points may be listed.
768 As noted, they derive mostly from the Sun VFS interface.
769 Lines marked with \fB+\fP are additions to the Sun definitions;
770 lines marked with \fB!\fP are modified from VFS.
771 .PP
772 The structure describing the externally-visible features of a mounted
773 filesystem, \fIvfs\fP, is:
774 .DS
775 .ta .5i +\w'struct vfsops\0\0\0'u +\w'*vfs_vnodecovered;\0\0\0\0\0'u
776 /*
777  * Structure per mounted file system.
778  * Each mounted file system has an array of
779  * operations and an instance record.
780  * The file systems are put on a doubly linked list.
781  */
782 struct vfs {
783         struct vfs      *vfs_next;              /* next vfs in vfs list */
784 \fB+\fP struct vfs      *vfs_prev;              /* prev vfs in vfs list */
785         struct vfsops   *vfs_op;                /* operations on vfs */
786         struct vnode    *vfs_vnodecovered;      /* vnode we mounted on */
787         int     vfs_flag;               /* flags */
788 \fB!\fP int     vfs_fsize;              /* fundamental block size */
789 \fB+\fP int     vfs_bsize;              /* optimal transfer size */
790 \fB!\fP uid_t   vfs_exroot;             /* exported fs uid 0 mapping */
791         short   vfs_exflags;            /* exported fs flags */
792         caddr_t vfs_data;               /* private data */
793 };
794 .DE
795 .DS
796 .ta \w'\fB+\fP 'u +\w'#define\0\0'u +\w'VFS_EXPORTED\0\0'u +\w'0x40\0\0\0\0\0'u
797         /*
798          * vfs flags.
799          * VFS_MLOCK lock the vfs so that name lookup cannot proceed past the vfs.
800          * This keeps the subtree stable during mounts and unmounts.
801          */
802         #define VFS_RDONLY      0x01            /* read only vfs */
803 \fB+\fP #define VFS_NOEXEC      0x02            /* can't exec from filesystem */
804         #define VFS_MLOCK       0x04            /* lock vfs so that subtree is stable */
805         #define VFS_MWAIT       0x08            /* someone is waiting for lock */
806         #define VFS_NOSUID      0x10            /* don't honor setuid bits on vfs */
807         #define VFS_EXPORTED    0x20            /* file system is exported (NFS) */
808
809         /*
810          * exported vfs flags.
811          */
812         #define EX_RDONLY       0x01            /* exported read only */
813 .DE
814 .LP
815 The operations supported by the filesystem-specific layer
816 on an individual filesystem are:
817 .DS
818 .ta .5i +\w'struct vfsops\0\0\0'u +\w'*vfs_vnodecovered;\0\0\0\0\0'u
819 /*
820  * Operations supported on virtual file system.
821  */
822 struct vfsops {
823 \fB!\fP int     (*vfs_mount)(           /* vfs, path, data, datalen */ );
824 \fB!\fP int     (*vfs_unmount)(         /* vfs, forcibly */ );
825 \fB+\fP int     (*vfs_mountroot)();
826         int     (*vfs_root)(            /* vfs, vpp */ );
827 \fB!\fP int     (*vfs_statfs)(          /* vfs, vp, sbp */ );
828 \fB!\fP int     (*vfs_sync)(            /* vfs, waitfor */ );
829 \fB+\fP int     (*vfs_fhtovp)(          /* vfs, fhp, vpp */ );
830 \fB+\fP int     (*vfs_vptofh)(          /* vp, fhp */ );
831 };
832 .DE
833 .LP
834 The \fIvfs_statfs\fP entry returns a structure of the form:
835 .DS
836 .ta .5i +\w'struct vfsops\0\0\0'u +\w'*vfs_vnodecovered;\0\0\0\0\0'u
837 /*
838  * file system statistics
839  */
840 struct statfs {
841 \fB!\fP short   f_type;                 /* type of filesystem */
842 \fB+\fP short   f_flags;                /* copy of vfs (mount) flags */
843 \fB!\fP long    f_fsize;                /* fundamental file system block size */
844 \fB+\fP long    f_bsize;                /* optimal transfer block size */
845         long    f_blocks;               /* total data blocks in file system */
846         long    f_bfree;                /* free blocks in fs */
847         long    f_bavail;               /* free blocks avail to non-superuser */
848         long    f_files;                /* total file nodes in file system */
849         long    f_ffree;                /* free file nodes in fs */
850         fsid_t  f_fsid;                 /* file system id */
851 \fB+\fP char    *f_mntonname;           /* directory on which mounted */
852 \fB+\fP char    *f_mntfromname;         /* mounted filesystem */
853         long    f_spare[7];             /* spare for later */
854 };
855
856 typedef long fsid_t[2];                 /* file system id type */
857 .DE
858 .LP
859 The modifications to Sun's interface at this level are minor.
860 Additional arguments are present for the \fIvfs_mount\fP and \fIvfs_umount\fP
861 entries.
862 \fIvfs_statfs\fP accepts a vnode as well as filesystem identifier,
863 as the information may not be uniform throughout a filesystem.
864 For example,
865 if a client may mount a file tree that spans multiple physical
866 filesystems on a server, different sections may have different amounts
867 of free space.
868 (NFS does not allow remotely-mounted file trees to span physical filesystems
869 on the server.)
870 The final additions are the entries that support file handles.
871 \fIvfs_vptofh\fP is provided for the use of file servers,
872 which need to obtain an opaque
873 file handle to represent the current vnode for transmission to clients.
874 This file handle may later be used to relocate the vnode using \fIvfs_fhtovp\fP
875 without requiring the vnode to remain in memory.
876 .PP
877 Finally, the external form of a filesystem object, the \fIvnode\fP, is:
878 .DS
879 .ta .5i +\w'struct vnodeops\0\0'u +\w'*v_vfsmountedhere;\0\0\0'u
880 /*
881  * vnode types. VNON means no type.
882  */
883 enum vtype      { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK };
884
885 struct vnode {
886         u_short v_flag;                 /* vnode flags (see below) */
887         u_short v_count;                /* reference count */
888         u_short v_shlockc;              /* count of shared locks */
889         u_short v_exlockc;              /* count of exclusive locks */
890         struct vfs      *v_vfsmountedhere;      /* ptr to vfs mounted here */
891         struct vfs      *v_vfsp;                /* ptr to vfs we are in */
892         struct vnodeops *v_op;                  /* vnode operations */
893 \fB+\fP struct text     *v_text;                /* text/mapped region */
894         enum vtype      v_type;                 /* vnode type */
895         caddr_t v_data;                 /* private data for fs */
896 };
897 .DE
898 .DS
899 .ta \w'#define\0\0'u +\w'NOFOLLOW\0\0'u +\w'0x40\0\0\0\0\0\0\0'u
900 /*
901  * vnode flags.
902  */
903 #define VROOT   0x01    /* root of its file system */
904 #define VTEXT   0x02    /* vnode is a pure text prototype */
905 #define VEXLOCK 0x10    /* exclusive lock */
906 #define VSHLOCK 0x20    /* shared lock */
907 #define VLWAIT  0x40    /* proc is waiting on shared or excl. lock */
908 .DE
909 .LP
910 The operations supported by the filesystems on individual \fIvnode\fP\^s
911 are:
912 .DS
913 .ta .5i +\w'int\0\0\0\0\0'u  +\w'(*vn_getattr)(\0\0\0\0\0'u
914 /*
915  * Operations on vnodes.
916  */
917 struct vnodeops {
918 \fB!\fP int     (*vn_lookup)(           /* ndp */ );
919 \fB!\fP int     (*vn_create)(           /* ndp, vap, fflags */ );
920 \fB+\fP int     (*vn_mknod)(            /* ndp, vap, fflags */ );
921 \fB!\fP int     (*vn_open)(             /* vp, fflags, cred */ );
922         int     (*vn_close)(            /* vp, fflags, cred */ );
923         int     (*vn_access)(           /* vp, fflags, cred */ );
924         int     (*vn_getattr)(          /* vp, vap, cred */ );
925         int     (*vn_setattr)(          /* vp, vap, cred */ );
926
927 \fB+\fP int     (*vn_read)(             /* vp, uiop, offp, ioflag, cred */ );
928 \fB+\fP int     (*vn_write)(            /* vp, uiop, offp, ioflag, cred */ );
929 \fB!\fP int     (*vn_ioctl)(            /* vp, com, data, fflag, cred */ );
930         int     (*vn_select)(           /* vp, which, cred */ );
931 \fB+\fP int     (*vn_mmap)(             /* vp, ..., cred */ );
932         int     (*vn_fsync)(            /* vp, cred */ );
933 \fB+\fP int     (*vn_seek)(             /* vp, offp, off, whence */ );
934
935 \fB!\fP int     (*vn_remove)(           /* ndp */ );
936 \fB!\fP int     (*vn_link)(             /* vp, ndp */ );
937 \fB!\fP int     (*vn_rename)(           /* src ndp, target ndp */ );
938 \fB!\fP int     (*vn_mkdir)(            /* ndp, vap */ );
939 \fB!\fP int     (*vn_rmdir)(            /* ndp */ );
940 \fB!\fP int     (*vn_symlink)(          /* ndp, vap, nm */ );
941         int     (*vn_readdir)(          /* vp, uiop, offp, ioflag, cred */ );
942         int     (*vn_readlink)(         /* vp, uiop, ioflag, cred */ );
943
944 \fB+\fP int     (*vn_abortop)(          /* ndp */ );
945 \fB+\fP int     (*vn_lock)(             /* vp */ );
946 \fB+\fP int     (*vn_unlock)(           /* vp */ );
947 \fB!\fP int     (*vn_inactive)(         /* vp */ );
948 };
949 .DE
950 .DS
951 .ta \w'#define\0\0'u +\w'NOFOLLOW\0\0'u +\w'0x40\0\0\0\0\0'u
952 /*
953  * flags for ioflag
954  */
955 #define IO_UNIT 0x01            /* do io as atomic unit for VOP_RDWR */
956 #define IO_APPEND       0x02            /* append write for VOP_RDWR */
957 #define IO_SYNC 0x04            /* sync io for VOP_RDWR */
958 .DE
959 .LP
960 The argument types listed in the comments following each operation are:
961 .sp
962 .IP ndp 10
963 A pointer to a \fInameidata\fP structure.
964 .IP vap
965 A pointer to a \fIvattr\fP structure (vnode attributes; see below).
966 .IP fflags
967 File open flags, possibly including O_APPEND, O_CREAT, O_TRUNC and O_EXCL.
968 .IP vp
969 A pointer to a \fIvnode\fP previously obtained with \fIvn_lookup\fP.
970 .IP cred
971 A pointer to a \fIucred\fP credentials structure.
972 .IP uiop
973 A pointer to a \fIuio\fP structure.
974 .IP ioflag
975 Any of the IO flags defined above.
976 .IP com
977 An \fIioctl\fP command, with type \fIunsigned long\fP.
978 .IP data
979 A pointer to a character buffer used to pass data to or from an \fIioctl\fP.
980 .IP which
981 One of FREAD, FWRITE or 0 (select for exceptional conditions).
982 .IP off
983 A file offset of type \fIoff_t\fP.
984 .IP offp
985 A pointer to file offset of type \fIoff_t\fP.
986 .IP whence
987 One of L_SET, L_INCR, or L_XTND.
988 .IP fhp
989 A pointer to a file handle buffer.
990 .sp
991 .PP
992 Several changes have been made to Sun's set of vnode operations.
993 Most obviously, the \fIvn_lookup\fP receives a \fInameidata\fP structure
994 containing its arguments and context as described.
995 The same structure is also passed to one of the creation or deletion
996 entries if the lookup operation is for CREATE or DELETE to complete
997 an operation, or to the \fIvn_abortop\fP entry if no operation
998 is undertaken.
999 For filesystems that perform no locking between lookup for creation
1000 or deletion and the call to implement that action,
1001 the final pathname component may be left untranslated by the lookup
1002 routine.
1003 In any case, the pathname pointer points at the final name component,
1004 and the \fInameidata\fP contains a reference to the vnode of the parent
1005 directory.
1006 The interface is thus flexible enough to accommodate filesystems
1007 that are fully stateful or fully stateless, while avoiding redundant
1008 operations whenever possible.
1009 One operation remains problematical, the \fIvn_rename\fP call.
1010 It is tempting to look up the source of the rename for deletion
1011 and the target for creation.
1012 However, filesystems that lock directories during such lookups must avoid
1013 deadlock if the two paths cross.
1014 For that reason, the source is translated for LOOKUP only,
1015 with the WANTPARENT flag set;
1016 the target is then translated with an operation of CREATE.
1017 .PP
1018 In addition to the changes concerned with the \fInameidata\fP interface,
1019 several other changes were made in the vnode operations.
1020 The \fIvn_rdrw\fP entry was split into \fIvn_read\fP and \fIvn_write\fP;
1021 frequently, the read/write entry amounts to a routine that checks
1022 the direction flag, then calls either a read routine or a write routine.
1023 The two entries may be identical for any given filesystem;
1024 the direction flag is contained in the \fIuio\fP given as an argument.
1025 .PP
1026 All of the read and write operations use a \fIuio\fP to describe
1027 the file offset and buffer locations.
1028 All of these fields must be updated before return.
1029 In particular, the \fIvn_readdir\fP entry uses this
1030 to return a new file offset token for its current location.
1031 .PP
1032 Several new operations have been added.
1033 The first, \fIvn_seek\fP, is a concession to record-oriented files
1034 such as directories.
1035 It allows the filesystem to verify that a seek leaves a file at a sensible
1036 offset, or to return a new offset token relative to an earlier one.
1037 For most filesystems and files, this operation amounts to performing
1038 simple arithmetic.
1039 Another new entry point is \fIvn_mmap\fP, for use in mapping device memory
1040 into a user process address space.
1041 Its semantics are not yet decided.
1042 The final additions are the \fIvn_lock\fP and \fIvn_unlock\fP entries.
1043 These are used to request that the underlying file be locked against
1044 changes for short periods of time if the filesystem implementation allows it.
1045 They are used to maintain consistency
1046 during internal operations such as \fIexec\fP,
1047 and may not be used to construct atomic operations from other filesystem
1048 operations.
1049 .PP
1050 The attributes of a vnode are not stored in the vnode,
1051 as they might change with time and may need to be read from a remote
1052 source.
1053 Attributes have the form:
1054 .DS
1055 .ta .5i +\w'struct vnodeops\0\0'u +\w'*v_vfsmountedhere;\0\0\0'u
1056 /*
1057  * Vnode attributes.  A field value of -1
1058  * represents a field whose value is unavailable
1059  * (getattr) or which is not to be changed (setattr).
1060  */
1061 struct vattr {
1062         enum vtype      va_type;        /* vnode type (for create) */
1063         u_short va_mode;        /* files access mode and type */
1064 \fB!\fP uid_t   va_uid;         /* owner user id */
1065 \fB!\fP gid_t   va_gid;         /* owner group id */
1066         long    va_fsid;        /* file system id (dev for now) */
1067 \fB!\fP long    va_fileid;      /* file id */
1068         short   va_nlink;       /* number of references to file */
1069         u_long  va_size;        /* file size in bytes (quad?) */
1070 \fB+\fP u_long  va_size1;       /* reserved if not quad */
1071         long    va_blocksize;   /* blocksize preferred for i/o */
1072         struct timeval  va_atime;       /* time of last access */
1073         struct timeval  va_mtime;       /* time of last modification */
1074         struct timeval  va_ctime;       /* time file changed */
1075         dev_t   va_rdev;        /* device the file represents */
1076         u_long  va_bytes;       /* bytes of disk space held by file */
1077 \fB+\fP u_long  va_bytes1;      /* reserved if va_bytes not a quad */
1078 };
1079 .DE
1080 .NH
1081 Conclusions
1082 .PP
1083 The Sun VFS filesystem interface is the most widely used generic
1084 filesystem interface.
1085 Of the interfaces examined, it creates the cleanest separation
1086 between the filesystem-independent and -dependent layers and data structures.
1087 It has several flaws, but it is felt that certain changes in the interface
1088 can ameliorate most of them.
1089 The interface proposed here includes those changes.
1090 The proposed interface is now being implemented by the Computer Systems
1091 Research Group at Berkeley.
1092 If the design succeeds in improving the flexibility and performance
1093 of the filesystem layering, it will be advanced as a model interface.
1094 .NH
1095 Acknowledgements
1096 .PP
1097 The filesystem interface described here is derived from Sun's VFS interface.
1098 It also includes features similar to those of DEC's GFS interface.
1099 We are indebted to members of the Sun and DEC system groups
1100 for long discussions of the issues involved.
1101 .br
1102 .ne 2i
1103 .NH
1104 References
1105
1106 .IP Brownbridge82 \w'Satyanarayanan85\0\0'u
1107 Brownbridge, D.R., L.F. Marshall, B. Randell,
1108 ``The Newcastle Connection, or UNIXes of the World Unite!,''
1109 \fISoftware\- Practice and Experience\fP, Vol. 12, pp. 1147-1162, 1982.
1110
1111 .IP Cole85
1112 Cole, C.T., P.B. Flinn, A.B. Atlas,
1113 ``An Implementation of an Extended File System for UNIX,''
1114 \fIUsenix Conference Proceedings\fP,
1115 pp. 131-150, June, 1985.
1116
1117 .IP Kleiman86
1118 ``Vnodes: An Architecture for Multiple File System Types in Sun UNIX,''
1119 \fIUsenix Conference Proceedings\fP,
1120 pp. 238-247, June, 1986.
1121
1122 .IP Leffler84
1123 Leffler, S., M.K. McKusick, M. Karels,
1124 ``Measuring and Improving the Performance of 4.2BSD,''
1125 \fIUsenix Conference Proceedings\fP, pp. 237-252, June, 1984.
1126
1127 .IP McKusick84
1128 McKusick, M.K., W.N. Joy, S.J. Leffler, R.S. Fabry,
1129 ``A Fast File System for UNIX,'' \fITransactions on Computer Systems\fP,
1130 Vol. 2, pp. 181-197,
1131 ACM, August, 1984.
1132
1133 .IP McKusick85
1134 McKusick, M.K., M. Karels, S. Leffler,
1135 ``Performance Improvements and Functional Enhancements in 4.3BSD,''
1136 \fIUsenix Conference Proceedings\fP, pp. 519-531, June, 1985.
1137
1138 .IP Rifkin86
1139 Rifkin, A.P., M.P. Forbes, R.L. Hamilton, M. Sabrio, S. Shah, and K. Yueh,
1140 ``RFS Architectural Overview,'' \fIUsenix Conference Proceedings\fP,
1141 pp. 248-259, June, 1986.
1142
1143 .IP Ritchie74
1144 Ritchie, D.M. and K. Thompson, ``The Unix Time-Sharing System,''
1145 \fICommunications of the ACM\fP, Vol. 17, pp. 365-375, July, 1974.
1146
1147 .IP Rodriguez86
1148 Rodriguez, R., M. Koehler, R. Hyde,
1149 ``The Generic File System,'' \fIUsenix Conference Proceedings\fP,
1150 pp. 260-269, June, 1986.
1151
1152 .IP Sandberg85
1153 Sandberg, R., D. Goldberg, S. Kleiman, D. Walsh, B. Lyon,
1154 ``Design and Implementation of the Sun Network Filesystem,''
1155 \fIUsenix Conference Proceedings\fP,
1156 pp. 119-130, June, 1985.
1157
1158 .IP Satyanarayanan85
1159 Satyanarayanan, M., \fIet al.\fP,
1160 ``The ITC Distributed File System: Principles and Design,''
1161 \fIProc. 10th Symposium on Operating Systems Principles\fP, pp. 35-50,
1162 ACM, December, 1985.
1163
1164 .IP Walker85
1165 Walker, B.J. and S.H. Kiser, ``The LOCUS Distributed Filesystem,''
1166 \fIThe LOCUS Distributed System Architecture\fP,
1167 G.J. Popek and B.J. Walker, ed., The MIT Press, Cambridge, MA, 1985.
1168
1169 .IP Weinberger84
1170 Weinberger, P.J., ``The Version 8 Network File System,''
1171 \fIUsenix Conference presentation\fP,
1172 June, 1984.