On Fri, Apr 24, 2009 at 10:28:18PM +0530, Krishna Kumar2 wrote: > Hi Bruce, > > "J. Bruce Fields" <bfields@xxxxxxxxxxxx> wrote on 04/24/2009 09:53:21 PM: > > > > { > > > __u32 a = auth[0], b = auth[1], c = auth[2], d = auth[3]; > > > hash = jhash_3words(a, b, jhash_2words(c, d, 0), 0xfeedbeef) & > > > FHPARM_HASH_MASK; > > > ... > > > /* > > > * Matching check uses something like: > > > * if (fh->p_auth1 == a && fh->p_auth2 == b && fh->p_auth3 == c > && > > > fh->p_auth4 == d) > > > */ > > > } > > > > > > Is what you had in mind? I am testing some more with this, so far I get > > > different values for different files and filesystems. > > > > > > I am not sure if there is an easier way to do a hash and get the unique > > > file > > > associated with the filehandle, this part of the code is very > complicated. > > > > Why not just do a hash on the entire filehandle, however long it may be? > > I am not sure how many numbers to hash on, usually the first 4 numbers are > the > ino, inode generation, parent inode, parent inode generation, etc, and is a > unique match. Or filesystems can have their own encode handlers but store > similar stuff in these indices. I guess a memcmp could also be done if I > know > the length of the auth being used. Why not use the whole thing?: fh1->fh_size == fh2->fh_size && memcmp(fh1->fh_base, fh2->fh_base, fh1->fh_size) == 0 --b. > > > (Cc'ing Greg since he says he had some patches which did something > > similar, and perhaps he could offer a suggestion.) > > OK, will wait for response from Greg. > > thanks, > > - KK > -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html