S<<< [B<-files> <I<files in cache>>] >>>
S<<< [B<-files_per_subdir> <I<log(2) of files per dir>> ] >>>
[B<-help>] S<<< [B<-logfile> <I<Place to keep the CM log>>] >>>
+ S<<< [B<-inumcalc>] <I<method>> >>>
[B<-mem_alloc_sleep>] [B<-memcache>]
S<<< [B<-mountdir> <I<mount location>>] >>> [B<-nomount>]
[B<-nosettime>]
This option is obsolete and no longer has any effect.
+=item B<-inumcalc> <I<method>>
+
+Specifies the method used by the Cache Manager to generate inode numbers for
+files, directories, and symlinks in the AFS filesystem. Valid methods are
+C<compat> and C<md5>. The default method is C<compat>.
+
+When the C<compat> method is in effect, the Cache Manager generates inode
+numbers for a given inode by multiplying the AFS volume number by 65536, adding
+the result to the AFS vnode number, and finally truncating the result to a
+signed 32 bit integer.
+
+When the C<md5> method is in effect, the Cache Manager generates inode numbers
+for a given inode by calculating the MD5 digest of a combination of the cell
+number, volume number, and vnode number. The result is truncated to a signed 32
+bit integer. The C<md5> method is computationally more expensive but greatly
+reduces the chance for inode number collisions, especially when volumes from
+multiple cells are mounted within the AFS filesystem.
+
=item B<-mem_alloc_sleep>
This option is obsolete and no longer has any effect.
#endif
/* From afs_util.c */
-extern afs_int32 afs_new_inum;
+extern afs_int32 afs_md5inum;
/* From afs_analyze.c */
extern afs_int32 hm_retry_RO;
#endif
#endif
.procname = "md5inum",
- .data = &afs_new_inum,
+ .data = &afs_md5inum,
.maxlen = sizeof(afs_int32),
.mode = 0644,
.proc_handler = &proc_dointvec
static int afscall_set_rxpck_received = 0;
+/* From afs_util.c */
+extern afs_int32 afs_md5inum;
+
/* This is code which needs to be called once when the first daemon enters
* the client. A non-zero return means an error and AFS should not start.
*/
afs_osi_Free(seedbuf, parm3);
}
#endif
+ } else if (parm == AFSOP_SET_INUMCALC) {
+ switch (parm2) {
+ case AFS_INUMCALC_COMPAT:
+ afs_md5inum = 0;
+ code = 0;
+ break;
+ case AFS_INUMCALC_MD5:
+ afs_md5inum = 1;
+ code = 0;
+ break;
+ default:
+ code = EINVAL;
+ }
} else {
code = EINVAL;
}
#include <sys/fp_io.h>
#endif
-afs_int32 afs_new_inum = 0;
+afs_int32 afs_md5inum = 0;
#ifndef afs_cv2string
char *
char digest[16];
struct md5 ct;
- if (afs_new_inum) {
+ if (afs_md5inum) {
int offset;
MD5_Init(&ct);
MD5_Update(&ct, &cell, 4);
* -rxpck Value for rx_extraPackets.
* -splitcache RW/RO ratio for cache.
* -rxmaxfrags Max number of UDP fragments per rx packet.
+ * -inumcalc inode number calculation method; 0=compat, 1=MD5 digest
*---------------------------------------------------------------------------*/
#include <afsconfig.h>
static int enable_backuptree = 0; /* enable backup tree support */
static int enable_nomount = 0; /* do not mount */
static int enable_splitcache = 0;
+static char *inumcalc = NULL; /* inode number calculation method */
static int afsd_dynamic_vcaches = 0; /* Enable dynamic-vcache support */
int afsd_verbose = 0; /*Are we being chatty? */
int afsd_debug = 0; /*Are we printing debugging info? */
OPT_rxmaxmtu,
OPT_dynrootsparse,
OPT_rxmaxfrags,
+ OPT_inumcalc,
};
#ifdef MACOS_EVENT_HANDLING
}
cmd_OptionAsInt(as, OPT_rxmaxfrags, &rxmaxfrags);
+ if (cmd_OptionPresent(as, OPT_inumcalc)) {
+ cmd_OptionAsString(as, OPT_inumcalc, &inumcalc);
+ }
/* parse cacheinfo file if this is a diskcache */
if (ParseCacheInfoFile()) {
printf("%s: Error seting rxmaxmtu\n", rn);
}
+ if (inumcalc != NULL) {
+ if (strcmp(inumcalc, "compat") == 0) {
+ if (afsd_verbose) {
+ printf("%s: Setting original inode number calculation method in kernel.\n",
+ rn);
+ }
+ code = afsd_syscall(AFSOP_SET_INUMCALC, AFS_INUMCALC_COMPAT);
+ if (code) {
+ printf("%s: Error setting inode calculation method: code=%d.\n",
+ rn, code);
+ }
+ } else if (strcmp(inumcalc, "md5") == 0) {
+ if (afsd_verbose) {
+ printf("%s: Setting md5 digest inode number calculation in kernel.\n",
+ rn);
+ }
+ code = afsd_syscall(AFSOP_SET_INUMCALC, AFS_INUMCALC_MD5);
+ if (code) {
+ printf("%s: Error setting inode calculation method: code=%d.\n",
+ rn, code);
+ }
+ } else {
+ printf("%s: Unknown value for -inumcalc: %s."
+ "Using default inode calculation method.\n", rn, inumcalc);
+ }
+ }
+
if (enable_dynroot) {
if (afsd_verbose)
printf("%s: Enabling dynroot support in kernel%s.\n", rn,
CMD_OPTIONAL,
"Set the maximum number of UDP fragments Rx should "
"send/receive per Rx packet");
+ cmd_AddParmAtOffset(ts, OPT_inumcalc, "-inumcalc", CMD_SINGLE, CMD_OPTIONAL,
+ "Set inode number calculation method");
}
int
case AFSOP_BUCKETPCT:
case AFSOP_GO:
case AFSOP_SET_RMTSYS_FLAG:
+ case AFSOP_SET_INUMCALC:
params[0] = CAST_SYSCALL_PARAM((va_arg(ap, int)));
break;
case AFSOP_SET_THISCELL:
#define AFSOP_SET_RXMAXFRAGS 43 /* set rxi_nSendFrags, rxi_nRecvFrags */
#define AFSOP_SET_RMTSYS_FLAG 44 /* set flag if rmtsys is enabled */
#define AFSOP_SEED_ENTROPY 45 /* Give the kernel hcrypto entropy */
+#define AFSOP_SET_INUMCALC 46 /* set inode number calculation method */
/* The range 20-30 is reserved for AFS system offsets in the afs_syscall */
#define AFSCALL_PIOCTL 20
afs_int32 dynamic_vcaches;
};
+/* Supported values for AFSOP_SET_INUMCALC. */
+enum {
+ AFS_INUMCALC_COMPAT = 0,
+ AFS_INUMCALC_MD5 = 1
+};
+
+
/*
* Note that the AFS_*ALLOCSIZ values should be multiples of sizeof(void*) to
* accomodate pointer alignment.