Here's my take on the lockf stuff switching to fcntl locking... Only bothered to emulate F_LOCK & F_ULOCK because, well, that's all namei_ops uses. I've tested it on sunx86_510, it seems to be doing it's thing.

BTW, it's really interesting to peek at the OpenAFS fileserver with some of the dtrace tools. It's *very* fdsync happy, and seems to spend a lot of time/resources syncing buffers to disk -- I wonder if we could seriously increase performance here and let the OS write- cache actually be one...

-rob

*** openafs-1.4.1/src/vol/namei_ops.c   Tue Nov  1 11:45:44 2005
--- openafs-1.4.1rb/src/vol/namei_ops.c Tue Sep 12 11:50:32 2006
***************
*** 149,154 ****
--- 149,183 ----
      int ogm_mode;
  } namei_ogm_t;

+ #if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV) || defined (AFS_HPUX_ENV)
+ #include <fcntl.h>
+ #define lockf(a,b,c) fcntl_lockf_emulator(a,b,c)
+ int fcntl_lockf_emulator ( int fd, int function, off_t size ) {
+
+     struct flock fl;
+     int op;
+
+     fl.l_start = 0;
+     fl.l_len = size;
+     fl.l_pid = 0;
+     fl.l_whence = SEEK_SET;
+
+     if ( function == F_LOCK ) {
+       op = F_SETLK;
+       fl.l_type = F_WRLCK;
+     } else if ( function == F_ULOCK ) {
+       op = F_SETLK;
+       fl.l_type = F_UNLCK;
+     } else {
+       /* eek */
+       return -1;
+     }
+
+     return fcntl( fd, op, &fl );
+
+ }
+ #endif
+


_______________________________________________
OpenAFS-devel mailing list
[email protected]
https://lists.openafs.org/mailman/listinfo/openafs-devel

Reply via email to