]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
afs: Use cell for md5 inode numbers
authorAndrew Deason <adeason@sinenomine.net>
Wed, 22 Jun 2011 19:39:39 +0000 (14:39 -0500)
committerDerrick Brashear <shadow@dementix.org>
Wed, 25 Apr 2012 10:38:49 +0000 (03:38 -0700)
When calculating the inode number for a file with md5 inodes, include
the cell number in the calculation, in order to reduce collisions
between cells.

Reviewed-on: http://gerrit.openafs.org/4902
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 42943aead4db2bdf9b8ec01c3917eb1c9ac9eb76)

Change-Id: I5cf88ecd30a5813697dbf3b86964d53bb1f3915a
Reviewed-on: http://gerrit.openafs.org/7277
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
src/afs/LINUX/osi_vnodeops.c
src/afs/LINUX24/osi_vnodeops.c
src/afs/VNOPS/afs_vnop_attrs.c
src/afs/afs_prototypes.h
src/afs/afs_util.c

index e8fc96a9b4b6f4c9bf5bd610224c38a20f7d06b0..f1d43bb7d5742237ca7e324695aad6b8c18adcb4 100644 (file)
@@ -272,7 +272,8 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir)
            goto out;
         }
 
-       ino = afs_calc_inum (avc->f.fid.Fid.Volume, ntohl(de->fid.vnode));
+       ino = afs_calc_inum(avc->f.fid.Cell, avc->f.fid.Fid.Volume,
+                           ntohl(de->fid.vnode));
        len = strlen(de->name);
 
        /* filldir returns -EINVAL when the buffer is full. */
index 841f453a5201562f31ef66dbd054a834937b979c..372bc806bbd8d1f449d0fcec677afea912f2b36b 100644 (file)
@@ -303,7 +303,8 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir)
        if (!de)
            break;
 
-       ino = afs_calc_inum (avc->f.fid.Fid.Volume, ntohl(de->fid.vnode));
+       ino = afs_calc_inum(avc->f.fid.Cell, avc->f.fid.Fid.Volume,
+                           ntohl(de->fid.vnode));
 
        if (de->name)
            len = strlen(de->name);
index b3931e546a373c165b55ecca89720b49a81dff75..d01aff2f2d772347914fd736ba1142e46af11cf7 100644 (file)
@@ -104,8 +104,9 @@ afs_CopyOutAttrs(struct vcache *avc, struct vattr *attrs)
        /* The mount point's vnode. */
        if (tvp) {
            attrs->va_nodeid =
-             afs_calc_inum (tvp->mtpoint.Fid.Volume,
-                             tvp->mtpoint.Fid.Vnode);
+             afs_calc_inum(tvp->mtpoint.Cell,
+                           tvp->mtpoint.Fid.Volume,
+                           tvp->mtpoint.Fid.Vnode);
            if (FidCmp(&afs_rootFid, &avc->f.fid) && !attrs->va_nodeid)
                attrs->va_nodeid = 2;
            afs_PutVolume(tvp, READ_LOCK);
@@ -113,8 +114,9 @@ afs_CopyOutAttrs(struct vcache *avc, struct vattr *attrs)
            attrs->va_nodeid = 2;
     } else
        attrs->va_nodeid = 
-             afs_calc_inum (avc->f.fid.Fid.Volume,
-                             avc->f.fid.Fid.Vnode);
+             afs_calc_inum(avc->f.fid.Cell,
+                           avc->f.fid.Fid.Volume,
+                           avc->f.fid.Fid.Vnode);
     attrs->va_nodeid &= 0x7fffffff;    /* Saber C hates negative inode #s! */
     attrs->va_nlink = fakedir ? 100 : avc->f.m.LinkCount;
     attrs->va_size = fakedir ? 4096 : avc->f.m.Length;
index 6e8a87bfda1ef24e96931484c3b17d2900118423..11a6a8c9d181f9122ea127be4efa19de33cc8137 100644 (file)
@@ -968,7 +968,8 @@ extern void afs_MarkUserExpired(afs_int32 pag);
 
 /* afs_util.c */
 extern afs_int32 afs_strtoi_r(const char *str, char **endptr, afs_uint32 *ret);
-extern afs_int32 afs_calc_inum (afs_int32 volume, afs_int32 vnode);
+extern afs_int32 afs_calc_inum(afs_int32 cell, afs_int32 volume,
+                               afs_int32 vnode);
 #ifndef afs_cv2string
 extern char *afs_cv2string(char *ttp, afs_uint32 aval);
 #endif
index daf86ff4c25d6cc2daeab19b4d3799a1e0e6643e..f50bbf1f771d0fdb291a87ac9b1d948e23443505 100644 (file)
@@ -370,7 +370,7 @@ afs_data_pointer_to_int32(const void *p)
 #ifdef AFS_LINUX20_ENV
 
 afs_int32
-afs_calc_inum(afs_int32 volume, afs_int32 vnode)
+afs_calc_inum(afs_int32 cell, afs_int32 volume, afs_int32 vnode)
 {
     afs_int32 ino = 0, vno = vnode;
     char digest[16];
@@ -379,6 +379,7 @@ afs_calc_inum(afs_int32 volume, afs_int32 vnode)
     if (afs_new_inum) {
        int offset;
        AFS_MD5_Init(&ct);
+       AFS_MD5_Update(&ct, &cell, 4);
        AFS_MD5_Update(&ct, &volume, 4);
        AFS_MD5_Update(&ct, &vnode, 4);
        AFS_MD5_Final(digest, &ct);
@@ -407,7 +408,7 @@ afs_calc_inum(afs_int32 volume, afs_int32 vnode)
 #else
 
 afs_int32
-afs_calc_inum (afs_int32 volume, afs_int32 vnode)
+afs_calc_inum(afs_int32 cell, afs_int32 volume, afs_int32 vnode)
 {
     return (volume << 16) + vnode;
 }