X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Finclude%2Flustre_fid.h;h=f31c4b5d27416882c6dfa4d7acd311b44b52dc66;hp=9311d4043c58167295c26143f2301cbf1084a50a;hb=910f68d04916fece5b54137bf78535f5306289f8;hpb=f95393b0d0a59cf3dc2f29cffc35dcc4cc9d7728 diff --git a/lustre/include/lustre_fid.h b/lustre/include/lustre_fid.h index 9311d40..f31c4b5 100644 --- a/lustre/include/lustre_fid.h +++ b/lustre/include/lustre_fid.h @@ -369,8 +369,16 @@ static inline __u32 fid_flatten32(const struct lu_fid *fid) seq = fid_seq(fid) - FID_SEQ_START; - ino = ((seq & 0xfffffULL) << 12) + ((seq >> 8) & 0xfffff000) + - (seq >> (64 - (40-8)) & 0xffffff00) + fid_oid(fid); + /* + map the high bits of the OID into higher bits of the inode number so that + inodes generated at about the same time have a reduced chance of collisions. + This will give a period of 1024 clients and 128 k = 128M inodes without collisions. + */ + + ino = ((seq & 0x000fffffULL) << 12) + ((seq >> 8) & 0xfffff000) + + (seq >> (64 - (40-8)) & 0xffffff00) + + (fid_oid(fid) & 0xff000fff) + ((fid_oid(fid) & 0x00fff000) << 16); + RETURN(ino ? ino : fid_oid(fid)); }