From: Benjamin Kaduk Date: Sun, 15 May 2016 18:51:56 +0000 (-0500) Subject: viced: make -vhashsize usable for non-DAFS X-Git-Tag: openafs-stable-1_8_0pre1~76 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=683acaed17da90455aab0cbb3d1539c51415b137 viced: make -vhashsize usable for non-DAFS The ability to set the size of the volume hash table was added at the same time that DAFS was introduced, and got caught up in the same preprocessor conditional. However, -vhashsize can be useful for the traditional fileserver as well (even though we recommend DAFS over the traditional fileserver), so let it be used in that case. Update the man pages accordingly and fix some grammar while here. Noted by Mark Vitale. Change-Id: Ic3282c9d661d60cf36f9ffb197e723a3f71da167 Reviewed-on: https://gerrit.openafs.org/12287 Reviewed-by: Mark Vitale Tested-by: BuildBot Reviewed-by: Benjamin Kaduk --- diff --git a/doc/man-pages/pod8/dafileserver.pod.in b/doc/man-pages/pod8/dafileserver.pod.in index fe30f6d..8fceb7f 100644 --- a/doc/man-pages/pod8/dafileserver.pod.in +++ b/doc/man-pages/pod8/dafileserver.pod.in @@ -55,14 +55,6 @@ prior to save and following a restore. The default is C. -=item B<-vhashsize > - -The log(2) number of of volume hash buckets. Default is 8 (i.e., by -default, there are 2^8 = 256 volume hash buckets). The minimum that can -be specified is 6 (64 hash buckets). In OpenAFS 1.5.77 and earlier, the -maximum that can be specified is 14 (16384 buckets). After 1.5.77, the -maximum that can be specified is 28 (268435456 buckets). - =item B<-vlrudisable> This option completely disables the VLRU mechanism, which means volumes will diff --git a/doc/man-pages/pod8/fragments/fileserver-options.pod b/doc/man-pages/pod8/fragments/fileserver-options.pod index a73965c..f771823 100644 --- a/doc/man-pages/pod8/fragments/fileserver-options.pod +++ b/doc/man-pages/pod8/fragments/fileserver-options.pod @@ -455,6 +455,14 @@ Note that this option is intended for debugging and testing purposes. Changing the location of the log file from the command line may result in undesirable interactions with tools such as B. +=item B<-vhashsize > + +The log(2) of the number of volume hash buckets. Default is 8 (i.e., by +default, there are 2^8 = 256 volume hash buckets). The minimum that can +be specified is 6 (64 hash buckets). In OpenAFS 1.5.77 and earlier, the +maximum that can be specified is 14 (16384 buckets). After 1.5.77, the +maximum that can be specified is 28 (268435456 buckets). + =item B<-config> > Set the location of the configuration directory used to configure this diff --git a/doc/man-pages/pod8/fragments/fileserver-synopsis.pod b/doc/man-pages/pod8/fragments/fileserver-synopsis.pod index 98d346b..c949d6e 100644 --- a/doc/man-pages/pod8/fragments/fileserver-synopsis.pod +++ b/doc/man-pages/pod8/fragments/fileserver-synopsis.pod @@ -46,6 +46,7 @@ B S<<< [B<-vattachpar> >] >>> S<<< [B<-m> >] >>> S<<< [B<-lock>] >>> + S<<< [B<-vhashsize> >] >>> S<<< [B<-offline-timeout> >] >>> S<<< [B<-offline-shutdown-timeout> >] >>> S<<< [B<-sync> >] >>> diff --git a/src/viced/viced.c b/src/viced/viced.c index 2dbac80..165ed55 100644 --- a/src/viced/viced.c +++ b/src/viced/viced.c @@ -1023,6 +1023,9 @@ ParseArgs(int argc, char *argv[]) cmd_AddParmAtOffset(opts, OPT_vhandle_initial_cachesize, "-vhandle-initial-cachesize", CMD_SINGLE, CMD_OPTIONAL, "# fds reserved for cache IO"); + cmd_AddParmAtOffset(opts, OPT_vhashsize, "-vhashsize", + CMD_SINGLE, CMD_OPTIONAL, + "log(2) of # of volume hash buckets"); #ifdef AFS_DEMAND_ATTACH_FS /* dafs options */ @@ -1034,9 +1037,6 @@ ParseArgs(int argc, char *argv[]) "disable state restore during startup"); cmd_AddParmAtOffset(opts, OPT_fs_state_verify, "-fs-state-verify", CMD_SINGLE, CMD_OPTIONAL, "none|save|restore|both"); - cmd_AddParmAtOffset(opts, OPT_vhashsize, "-vhashsize", - CMD_SINGLE, CMD_OPTIONAL, - "log(2) of # of volume hash buckets"); cmd_AddParmAtOffset(opts, OPT_vlrudisable, "-vlrudisable", CMD_FLAG, CMD_OPTIONAL, "disable VLRU functionality"); cmd_AddParmAtOffset(opts, OPT_vlruthresh, "-vlruthresh", @@ -1251,6 +1251,13 @@ ParseArgs(int argc, char *argv[]) return -1; } } + if (cmd_OptionAsInt(opts, OPT_vhashsize, &optval) == 0) { + if (VSetVolHashSize(optval)) { + fprintf(stderr, "specified -vhashsize (%d) is invalid or out " + "of range\n", optval); + return -1; + } + } #ifdef AFS_DEMAND_ATTACH_FS if (cmd_OptionPresent(opts, OPT_fs_state_dont_save)) @@ -1272,13 +1279,6 @@ ParseArgs(int argc, char *argv[]) return -1; } } - if (cmd_OptionAsInt(opts, OPT_vhashsize, &optval) == 0) { - if (VSetVolHashSize(optval)) { - fprintf(stderr, "specified -vhashsize (%d) is invalid or out " - "of range\n", optval); - return -1; - } - } if (cmd_OptionPresent(opts, OPT_vlrudisable)) VLRU_SetOptions(VLRU_SET_ENABLED, 0); if (cmd_OptionAsInt(opts, OPT_vlruthresh, &optval) == 0) diff --git a/src/vol/volume.h b/src/vol/volume.h index c0b74a6..bdbf084 100644 --- a/src/vol/volume.h +++ b/src/vol/volume.h @@ -859,6 +859,8 @@ extern int VLockFileLock(struct VLockFile *lf, afs_uint32 offset, int locktype, int nonblock); extern void VLockFileUnlock(struct VLockFile *lf, afs_uint32 offset); +extern int VSetVolHashSize(int logsize); + #ifdef AFS_DEMAND_ATTACH_FS extern Volume *VPreAttachVolumeByName(Error * ec, char *partition, char *name); extern Volume *VPreAttachVolumeByName_r(Error * ec, char *partition, char *name); @@ -878,7 +880,6 @@ extern int VDisconnectSALV_r(void); extern void VPrintExtendedCacheStats(int flags); extern void VPrintExtendedCacheStats_r(int flags); extern void VLRU_SetOptions(int option, afs_uint32 val); -extern int VSetVolHashSize(int logsize); extern int VRequestSalvage_r(Error * ec, Volume * vp, int reason, int flags); extern int VUpdateSalvagePriority_r(Volume * vp); extern int VRegisterVolOp_r(Volume * vp, FSSYNC_VolOp_info * vopinfo);