2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 /* ihandle.c - file descriptor cacheing for Inode handles. */
12 /************************************************************************/
14 #include <afsconfig.h>
15 #include <afs/param.h>
19 #include <sys/types.h>
28 #if defined(AFS_SUN5_ENV) || defined(AFS_NBSD_ENV)
29 #include <sys/fcntl.h>
30 #include <sys/resource.h>
35 #include <afs/afsint.h>
37 #include <afs/afssyscalls.h>
40 #include "viceinode.h"
41 #ifdef AFS_PTHREAD_ENV
43 #else /* AFS_PTHREAD_ENV */
44 #include "afs/assert.h"
45 #endif /* AFS_PTHREAD_ENV */
50 #define afs_stat stat64
51 #define afs_fstat fstat64
52 #else /* !O_LARGEFILE */
54 #define afs_fstat fstat
55 #endif /* !O_LARGEFILE */
56 #endif /* AFS_NT40_ENV */
58 #ifdef AFS_PTHREAD_ENV
59 pthread_once_t ih_glock_once = PTHREAD_ONCE_INIT;
60 pthread_mutex_t ih_glock_mutex;
61 #endif /* AFS_PTHREAD_ENV */
63 /* Linked list of available inode handles */
64 IHandle_t *ihAvailHead;
65 IHandle_t *ihAvailTail;
67 /* Linked list of available file descriptor handles */
68 FdHandle_t *fdAvailHead;
69 FdHandle_t *fdAvailTail;
71 /* Linked list of available stream descriptor handles */
72 StreamHandle_t *streamAvailHead;
73 StreamHandle_t *streamAvailTail;
75 /* LRU list for file descriptor handles */
76 FdHandle_t *fdLruHead;
77 FdHandle_t *fdLruTail;
80 int ih_PkgDefaultsSet = 0;
82 /* Most of the servers use fopen/fdopen. Since the FILE structure
83 * only has eight bits for the file descriptor, the cache size
84 * has to be less than 256. The cache can be made larger as long
85 * as you are sure you don't need fopen/fdopen. */
87 /* As noted in ihandle.h, the fileno member of FILE on most platforms
88 * in 2008 is a 16- or 32-bit signed int. -Matt
90 int fdMaxCacheSize = 0;
93 /* Number of in use file descriptors */
96 /* Hash table for inode handles */
97 IHashBucket_t ihashTable[I_HANDLE_HASH_SIZE];
99 void *ih_sync_thread(void *);
101 /* start-time configurable I/O limits */
102 ih_init_params vol_io_params;
104 void ih_PkgDefaults(void)
107 ih_PkgDefaultsSet = 1;
109 /* default to well-known values */
110 vol_io_params.fd_handle_setaside = FD_HANDLE_SETASIDE;
112 /* initial fd cachesize. the only one that will be used if
113 * the application does not call ih_UseLargeCache(). set this
114 * to a value representable in fileno member of the system's
115 * FILE structure (or equivalent). */
116 vol_io_params.fd_initial_cachesize = FD_DEFAULT_CACHESIZE;
118 /* fd cache size that will be used if/when ih_UseLargeCache()
120 vol_io_params.fd_max_cachesize = FD_MAX_CACHESIZE;
123 #ifdef AFS_PTHREAD_ENV
124 /* Initialize the global ihandle mutex */
128 assert(pthread_mutex_init(&ih_glock_mutex, NULL) == 0);
130 #endif /* AFS_PTHREAD_ENV */
132 /* Initialize the file descriptor cache */
139 DLL_INIT_LIST(ihAvailHead, ihAvailTail);
140 DLL_INIT_LIST(fdAvailHead, fdAvailTail);
141 DLL_INIT_LIST(fdLruHead, fdLruTail);
142 for (i = 0; i < I_HANDLE_HASH_SIZE; i++) {
143 DLL_INIT_LIST(ihashTable[i].ihash_head, ihashTable[i].ihash_tail);
145 #if defined(AFS_NT40_ENV)
146 fdMaxCacheSize = vol_io_params.fd_max_cachesize;
147 #elif defined(AFS_SUN5_ENV) || defined(AFS_NBSD_ENV)
150 assert(getrlimit(RLIMIT_NOFILE, &rlim) == 0);
151 rlim.rlim_cur = rlim.rlim_max;
152 assert(setrlimit(RLIMIT_NOFILE, &rlim) == 0);
153 fdMaxCacheSize = rlim.rlim_cur - vol_io_params.fd_handle_setaside;
155 /* XXX this is to avoid using up all system fd netbsd is
156 * somewhat broken and have set maximum fd for a root process
157 * to the same as system fd that is avaible, so if the
158 * fileserver uses all up process fds, all system fd will be
161 * Check for this better
165 fdMaxCacheSize = MIN(fdMaxCacheSize, vol_io_params.fd_max_cachesize);
166 assert(fdMaxCacheSize > 0);
168 #elif defined(AFS_HPUX_ENV)
169 /* Avoid problems with "UFSOpen: igetinode failed" panics on HPUX 11.0 */
173 long fdMax = MAX(sysconf(_SC_OPEN_MAX) - vol_io_params.fd_handle_setaside,
175 fdMaxCacheSize = (int)MIN(fdMax, vol_io_params.fd_max_cachesize);
178 fdCacheSize = MIN(fdMaxCacheSize, vol_io_params.fd_initial_cachesize);
181 #ifdef AFS_PTHREAD_ENV
183 pthread_attr_t tattr;
185 pthread_attr_init(&tattr);
186 pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED);
188 pthread_create(&syncer, &tattr, ih_sync_thread, NULL);
189 #else /* AFS_PTHREAD_ENV */
191 LWP_CreateProcess(ih_sync_thread, 16*1024, LWP_MAX_PRIORITY - 2,
192 NULL, "ih_syncer", &syncer);
193 #endif /* AFS_PTHREAD_ENV */
198 /* Make the file descriptor cache as big as possible. Don't this call
199 * if the program uses fopen or fdopen, if fd_max_cachesize cannot be
200 * represented in the fileno member of the system FILE structure (or
204 ih_UseLargeCache(void)
208 if (!ih_PkgDefaultsSet) {
216 fdCacheSize = fdMaxCacheSize;
221 /* Allocate a chunk of inode handles */
223 iHandleAllocateChunk(void)
228 assert(ihAvailHead == NULL);
229 ihP = (IHandle_t *) malloc(I_HANDLE_MALLOCSIZE * sizeof(IHandle_t));
231 for (i = 0; i < I_HANDLE_MALLOCSIZE; i++) {
232 ihP[i].ih_refcnt = 0;
233 DLL_INSERT_TAIL(&ihP[i], ihAvailHead, ihAvailTail, ih_next, ih_prev);
237 /* Initialize an inode handle */
239 ih_init(int dev, int vid, Inode ino)
241 int ihash = IH_HASH(dev, vid, ino);
244 if (!ih_PkgDefaultsSet) {
253 /* Do we already have a handle for this Inode? */
254 for (ihP = ihashTable[ihash].ihash_head; ihP; ihP = ihP->ih_next) {
255 if (ihP->ih_ino == ino && ihP->ih_vid == vid && ihP->ih_dev == dev) {
262 /* Allocate and initialize a new Inode handle */
263 if (ihAvailHead == NULL) {
264 iHandleAllocateChunk();
267 assert(ihP->ih_refcnt == 0);
268 DLL_DELETE(ihP, ihAvailHead, ihAvailTail, ih_next, ih_prev);
275 DLL_INIT_LIST(ihP->ih_fdhead, ihP->ih_fdtail);
276 DLL_INSERT_TAIL(ihP, ihashTable[ihash].ihash_head,
277 ihashTable[ihash].ihash_tail, ih_next, ih_prev);
282 /* Copy an inode handle */
284 ih_copy(IHandle_t * ihP)
288 assert(ihP->ih_refcnt > 0);
294 /* Allocate a chunk of file descriptor handles */
296 fdHandleAllocateChunk(void)
301 assert(fdAvailHead == NULL);
302 fdP = (FdHandle_t *) malloc(FD_HANDLE_MALLOCSIZE * sizeof(FdHandle_t));
304 for (i = 0; i < FD_HANDLE_MALLOCSIZE; i++) {
305 fdP[i].fd_status = FD_HANDLE_AVAIL;
307 fdP[i].fd_fd = INVALID_FD;
308 DLL_INSERT_TAIL(&fdP[i], fdAvailHead, fdAvailTail, fd_next, fd_prev);
312 /* Allocate a chunk of stream handles */
314 streamHandleAllocateChunk(void)
317 StreamHandle_t *streamP;
319 assert(streamAvailHead == NULL);
320 streamP = (StreamHandle_t *)
321 malloc(STREAM_HANDLE_MALLOCSIZE * sizeof(StreamHandle_t));
322 assert(streamP != NULL);
323 for (i = 0; i < STREAM_HANDLE_MALLOCSIZE; i++) {
324 streamP[i].str_fd = INVALID_FD;
325 DLL_INSERT_TAIL(&streamP[i], streamAvailHead, streamAvailTail,
331 * Get a file descriptor handle given an Inode handle
334 ih_open(IHandle_t * ihP)
340 if (!ihP) /* XXX should log here in the fileserver */
345 /* Do we already have an open file handle for this Inode? */
346 for (fdP = ihP->ih_fdtail; fdP != NULL; fdP = fdP->fd_ihprev) {
347 if (fdP->fd_status != FD_HANDLE_INUSE) {
348 assert(fdP->fd_status == FD_HANDLE_OPEN);
349 fdP->fd_status = FD_HANDLE_INUSE;
350 DLL_DELETE(fdP, fdLruHead, fdLruTail, fd_next, fd_prev);
353 (void)FDH_SEEK(fdP, 0, SEEK_SET);
359 * Try to open the Inode, return NULL on error.
366 if (fd == INVALID_FD && (errno != EMFILE || fdLruHead == NULL) ) {
372 /* fdCacheSize limits the size of the descriptor cache, but
373 * we permit the number of open files to exceed fdCacheSize.
374 * We only recycle open file descriptors when the number
375 * of open files reaches the size of the cache */
376 if ((fdInUseCount > fdCacheSize || fd == INVALID_FD) && fdLruHead != NULL) {
378 assert(fdP->fd_status == FD_HANDLE_OPEN);
379 DLL_DELETE(fdP, fdLruHead, fdLruTail, fd_next, fd_prev);
380 DLL_DELETE(fdP, fdP->fd_ih->ih_fdhead, fdP->fd_ih->ih_fdtail,
381 fd_ihnext, fd_ihprev);
382 closeFd = fdP->fd_fd;
383 if (fd == INVALID_FD) {
384 fdCacheSize--; /* reduce in order to not run into here too often */
385 DLL_INSERT_TAIL(fdP, fdAvailHead, fdAvailTail, fd_next, fd_prev);
386 fdP->fd_status = FD_HANDLE_AVAIL;
388 fdP->fd_fd = INVALID_FD;
394 if (fdAvailHead == NULL) {
395 fdHandleAllocateChunk();
398 assert(fdP->fd_status == FD_HANDLE_AVAIL);
399 DLL_DELETE(fdP, fdAvailHead, fdAvailTail, fd_next, fd_prev);
400 closeFd = INVALID_FD;
403 fdP->fd_status = FD_HANDLE_INUSE;
409 /* Add this handle to the Inode's list of open descriptors */
410 DLL_INSERT_TAIL(fdP, ihP->ih_fdhead, ihP->ih_fdtail, fd_ihnext,
413 if (closeFd != INVALID_FD) {
425 * Return a file descriptor handle to the cache
428 fd_close(FdHandle_t * fdP)
437 assert(fdInUseCount > 0);
438 assert(fdP->fd_status == FD_HANDLE_INUSE);
442 /* Call fd_reallyclose to really close the unused file handles if
443 * the previous attempt to close (ih_reallyclose()) all file handles
444 * failed (this is determined by checking the ihandle for the flag
445 * IH_REALLY_CLOSED) or we have too many open files.
447 if (ihP->ih_flags & IH_REALLY_CLOSED || fdInUseCount > fdCacheSize) {
449 return fd_reallyclose(fdP);
452 /* Put this descriptor back into the cache */
453 fdP->fd_status = FD_HANDLE_OPEN;
454 DLL_INSERT_TAIL(fdP, fdLruHead, fdLruTail, fd_next, fd_prev);
456 /* If this is not the only reference to the Inode then we can decrement
457 * the reference count, otherwise we need to call ih_release.
459 if (ihP->ih_refcnt > 1) {
471 * Actually close the file descriptor handle and return it to
475 fd_reallyclose(FdHandle_t * fdP)
485 assert(fdInUseCount > 0);
486 assert(fdP->fd_status == FD_HANDLE_INUSE);
489 closeFd = fdP->fd_fd;
491 DLL_DELETE(fdP, ihP->ih_fdhead, ihP->ih_fdtail, fd_ihnext, fd_ihprev);
492 DLL_INSERT_TAIL(fdP, fdAvailHead, fdAvailTail, fd_next, fd_prev);
494 fdP->fd_status = FD_HANDLE_AVAIL;
496 fdP->fd_fd = INVALID_FD;
498 /* All the file descriptor handles have been closed; reset
499 * the IH_REALLY_CLOSED flag indicating that ih_reallyclose
500 * has completed its job.
502 if (!ihP->ih_fdhead) {
503 ihP->ih_flags &= ~IH_REALLY_CLOSED;
511 /* If this is not the only reference to the Inode then we can decrement
512 * the reference count, otherwise we need to call ih_release. */
513 if (ihP->ih_refcnt > 1) {
524 /* Enable buffered I/O on a file descriptor */
526 stream_fdopen(FD_t fd)
528 StreamHandle_t *streamP;
531 if (streamAvailHead == NULL) {
532 streamHandleAllocateChunk();
534 streamP = streamAvailHead;
535 DLL_DELETE(streamP, streamAvailHead, streamAvailTail, str_next, str_prev);
537 streamP->str_fd = fd;
538 streamP->str_buflen = 0;
539 streamP->str_bufoff = 0;
540 streamP->str_error = 0;
541 streamP->str_eof = 0;
542 streamP->str_direction = STREAM_DIRECTION_NONE;
546 /* Open a file for buffered I/O */
548 stream_open(const char *filename, const char *mode)
550 FD_t fd = INVALID_FD;
552 if (strcmp(mode, "r") == 0) {
553 fd = OS_OPEN(filename, O_RDONLY, 0);
554 } else if (strcmp(mode, "r+") == 0) {
555 fd = OS_OPEN(filename, O_RDWR, 0);
556 } else if (strcmp(mode, "w") == 0) {
557 fd = OS_OPEN(filename, O_WRONLY | O_TRUNC | O_CREAT, 0);
558 } else if (strcmp(mode, "w+") == 0) {
559 fd = OS_OPEN(filename, O_RDWR | O_TRUNC | O_CREAT, 0);
560 } else if (strcmp(mode, "a") == 0) {
561 fd = OS_OPEN(filename, O_WRONLY | O_APPEND | O_CREAT, 0);
562 } else if (strcmp(mode, "a+") == 0) {
563 fd = OS_OPEN(filename, O_RDWR | O_APPEND | O_CREAT, 0);
565 assert(FALSE); /* not implemented */
568 if (fd == INVALID_FD) {
571 return stream_fdopen(fd);
574 /* fread for buffered I/O handles */
576 stream_read(void *ptr, afs_fsize_t size, afs_fsize_t nitems,
577 StreamHandle_t * streamP)
579 afs_fsize_t nbytes, bytesRead, bytesToRead;
582 /* Need to seek before changing direction */
583 if (streamP->str_direction == STREAM_DIRECTION_NONE) {
584 streamP->str_direction = STREAM_DIRECTION_READ;
585 streamP->str_bufoff = 0;
586 streamP->str_buflen = 0;
588 assert(streamP->str_direction == STREAM_DIRECTION_READ);
592 nbytes = size * nitems;
594 while (nbytes > 0 && !streamP->str_eof) {
595 if (streamP->str_buflen == 0) {
596 streamP->str_bufoff = 0;
597 streamP->str_buflen =
598 OS_READ(streamP->str_fd, streamP->str_buffer,
599 STREAM_HANDLE_BUFSIZE);
600 if (streamP->str_buflen < 0) {
601 streamP->str_error = errno;
602 streamP->str_buflen = 0;
605 } else if (streamP->str_buflen == 0) {
606 streamP->str_eof = 1;
611 bytesToRead = nbytes;
612 if (bytesToRead > streamP->str_buflen) {
613 bytesToRead = streamP->str_buflen;
615 memcpy(p, streamP->str_buffer + streamP->str_bufoff, bytesToRead);
617 streamP->str_bufoff += bytesToRead;
618 streamP->str_buflen -= bytesToRead;
619 bytesRead += bytesToRead;
620 nbytes -= bytesToRead;
623 return (bytesRead / size);
626 /* fwrite for buffered I/O handles */
628 stream_write(void *ptr, afs_fsize_t size, afs_fsize_t nitems,
629 StreamHandle_t * streamP)
633 afs_fsize_t nbytes, bytesWritten, bytesToWrite;
635 /* Need to seek before changing direction */
636 if (streamP->str_direction == STREAM_DIRECTION_NONE) {
637 streamP->str_direction = STREAM_DIRECTION_WRITE;
638 streamP->str_bufoff = 0;
639 streamP->str_buflen = STREAM_HANDLE_BUFSIZE;
641 assert(streamP->str_direction == STREAM_DIRECTION_WRITE);
644 nbytes = size * nitems;
648 if (streamP->str_buflen == 0) {
649 rc = OS_WRITE(streamP->str_fd, streamP->str_buffer,
650 STREAM_HANDLE_BUFSIZE);
652 streamP->str_error = errno;
656 streamP->str_bufoff = 0;
657 streamP->str_buflen = STREAM_HANDLE_BUFSIZE;
660 bytesToWrite = nbytes;
661 if (bytesToWrite > streamP->str_buflen) {
662 bytesToWrite = streamP->str_buflen;
664 memcpy(streamP->str_buffer + streamP->str_bufoff, p, bytesToWrite);
666 streamP->str_bufoff += bytesToWrite;
667 streamP->str_buflen -= bytesToWrite;
668 bytesWritten += bytesToWrite;
669 nbytes -= bytesToWrite;
672 return (bytesWritten / size);
675 /* fseek for buffered I/O handles */
677 stream_seek(StreamHandle_t * streamP, afs_foff_t offset, int whence)
682 if (streamP->str_direction == STREAM_DIRECTION_WRITE
683 && streamP->str_bufoff > 0) {
684 rc = OS_WRITE(streamP->str_fd, streamP->str_buffer,
685 streamP->str_bufoff);
687 streamP->str_error = errno;
691 streamP->str_bufoff = 0;
692 streamP->str_buflen = 0;
693 streamP->str_eof = 0;
694 streamP->str_direction = STREAM_DIRECTION_NONE;
695 if (OS_SEEK(streamP->str_fd, offset, whence) < 0) {
696 streamP->str_error = errno;
702 /* fflush for buffered I/O handles */
704 stream_flush(StreamHandle_t * streamP)
709 if (streamP->str_direction == STREAM_DIRECTION_WRITE
710 && streamP->str_bufoff > 0) {
711 rc = OS_WRITE(streamP->str_fd, streamP->str_buffer,
712 streamP->str_bufoff);
714 streamP->str_error = errno;
717 streamP->str_bufoff = 0;
718 streamP->str_buflen = STREAM_HANDLE_BUFSIZE;
724 /* Free a buffered I/O handle */
726 stream_close(StreamHandle_t * streamP, int reallyClose)
731 assert(streamP != NULL);
732 if (streamP->str_direction == STREAM_DIRECTION_WRITE
733 && streamP->str_bufoff > 0) {
734 rc = OS_WRITE(streamP->str_fd, streamP->str_buffer,
735 streamP->str_bufoff);
741 rc = OS_CLOSE(streamP->str_fd);
746 streamP->str_fd = INVALID_FD;
749 DLL_INSERT_TAIL(streamP, streamAvailHead, streamAvailTail,
755 /* Close all unused file descriptors associated with the inode
756 * handle. Called with IH_LOCK held. May drop and reacquire
757 * IH_LOCK. Sets the IH_REALLY_CLOSED flag in the inode handle
758 * if it fails to close all file handles.
761 ih_fdclose(IHandle_t * ihP)
763 int closeCount, closedAll;
764 FdHandle_t *fdP, *head, *tail, *next;
766 assert(ihP->ih_refcnt > 0);
769 DLL_INIT_LIST(head, tail);
770 ihP->ih_flags &= ~IH_REALLY_CLOSED;
773 * Remove the file descriptors for this Inode from the LRU queue
774 * and the IHandle queue and put them on a temporary queue so we
775 * can drop the lock before we close the files.
777 for (fdP = ihP->ih_fdhead; fdP != NULL; fdP = next) {
778 next = fdP->fd_ihnext;
779 assert(fdP->fd_ih == ihP);
780 assert(fdP->fd_status == FD_HANDLE_OPEN
781 || fdP->fd_status == FD_HANDLE_INUSE);
782 if (fdP->fd_status == FD_HANDLE_OPEN) {
783 DLL_DELETE(fdP, ihP->ih_fdhead, ihP->ih_fdtail, fd_ihnext,
785 DLL_DELETE(fdP, fdLruHead, fdLruTail, fd_next, fd_prev);
786 DLL_INSERT_TAIL(fdP, head, tail, fd_next, fd_prev);
789 ihP->ih_flags |= IH_REALLY_CLOSED;
793 /* If the ihandle reference count is 1, we should have
794 * closed all file descriptors.
796 if (ihP->ih_refcnt == 1 || closedAll) {
798 assert(!ihP->ih_fdhead);
799 assert(!ihP->ih_fdtail);
803 return 0; /* No file descriptors closed */
808 * Close the file descriptors
811 for (fdP = head; fdP != NULL; fdP = fdP->fd_next) {
812 OS_CLOSE(fdP->fd_fd);
813 fdP->fd_status = FD_HANDLE_AVAIL;
814 fdP->fd_fd = INVALID_FD;
820 assert(fdInUseCount >= closeCount);
821 fdInUseCount -= closeCount;
824 * Append the temporary queue to the list of available descriptors
826 if (fdAvailHead == NULL) {
830 fdAvailTail->fd_next = head;
831 head->fd_prev = fdAvailTail;
838 /* Close all cached file descriptors for this inode. */
840 ih_reallyclose(IHandle_t * ihP)
846 ihP->ih_refcnt++; /* must not disappear over unlock */
847 if (ihP->ih_synced) {
860 assert(ihP->ih_refcnt > 0);
865 if (ihP->ih_refcnt > 1) {
875 /* Release an Inode handle. All cached file descriptors for this
876 * inode are closed when the last reference to this handle is released
879 ih_release(IHandle_t * ihP)
887 assert(ihP->ih_refcnt > 0);
889 if (ihP->ih_refcnt > 1) {
895 ihash = IH_HASH(ihP->ih_dev, ihP->ih_vid, ihP->ih_ino);
896 DLL_DELETE(ihP, ihashTable[ihash].ihash_head,
897 ihashTable[ihash].ihash_tail, ih_next, ih_prev);
903 DLL_INSERT_TAIL(ihP, ihAvailHead, ihAvailTail, ih_next, ih_prev);
909 /* Sync an inode to disk if its handle isn't NULL */
911 ih_condsync(IHandle_t * ihP)
923 code = FDH_SYNC(fdP);
935 for (ihash = 0; ihash < I_HANDLE_HASH_SIZE; ihash++) {
936 IHandle_t *ihP, *ihPnext;
938 ihP = ihashTable[ihash].ihash_head;
940 ihP->ih_refcnt++; /* must not disappear over unlock */
941 for (; ihP; ihP = ihPnext) {
943 if (ihP->ih_synced) {
958 /* when decrementing the refcount, the ihandle might disappear
959 and we might not even be able to proceed to the next one.
960 Hence the gymnastics putting a hold on the next one already */
961 ihPnext = ihP->ih_next;
962 if (ihPnext) ihPnext->ih_refcnt++;
964 if (ihP->ih_refcnt > 1) {
978 ih_sync_thread(void *dummy) {
981 #ifdef AFS_PTHREAD_ENV
983 #else /* AFS_PTHREAD_ENV */
985 #endif /* AFS_PTHREAD_ENV */
993 /*************************************************************************
994 * OS specific support routines.
995 *************************************************************************/
996 #ifndef AFS_NAMEI_ENV
998 ih_icreate(IHandle_t * ih, int dev, char *part, Inode nI, int p1, int p2,
1002 #ifdef AFS_3DISPARES
1003 /* See viceinode.h */
1004 if (p2 == INODESPECIAL) {
1010 ino = ICREATE(dev, part, nI, p1, p2, p3, p4);
1013 #endif /* AFS_NAMEI_ENV */
1016 #ifndef AFS_NT40_ENV
1020 struct afs_stat status;
1021 if (afs_fstat(fd, &status) < 0)
1023 return status.st_size;