From: Eric Mei Date: Mon, 6 Dec 2010 22:49:54 +0000 (-0700) Subject: b=20563 fix fid_flatten(). X-Git-Tag: 2.0.59.0~42 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=b8e3234d406923a43bdc51e70b0a72c80b0987d3;p=fs%2Flustre-release.git b=20563 fix fid_flatten(). r=andreas.dilger r=di.wang --- diff --git a/lustre/include/lustre_fid.h b/lustre/include/lustre_fid.h index df3aa90..1c48f89 100644 --- a/lustre/include/lustre_fid.h +++ b/lustre/include/lustre_fid.h @@ -315,15 +315,16 @@ fid_build_pdo_res_name(const struct lu_fid *f, /** - * Flatten 128-bit FID values into a 64-bit value for - * use as an inode number. For non-IGIF FIDs this - * starts just over 2^32, and continues without conflict - * until 2^64, at which point we wrap the high 32 bits - * of the SEQ into the range where there may not be many - * OID values in use, to minimize the risk of conflict. + * Flatten 128-bit FID values into a 64-bit value for use as an inode number. + * For non-IGIF FIDs this starts just over 2^32, and continues without + * conflict until 2^64, at which point we wrap the high 24 bits of the SEQ + * into the range where there may not be many OID values in use, to minimize + * the risk of conflict. * - * The time between re-used inode numbers is very long - - * 2^32 SEQ numbers, or about 2^32 client mounts. */ + * Suppose LUSTRE_SEQ_MAX_WIDTH less than (1 << 24) which is currently true, + * the time between re-used inode numbers is very long - 2^40 SEQ numbers, + * or about 2^40 client mounts, if clients create less than 2^24 files/mount. + */ static inline __u64 fid_flatten(const struct lu_fid *fid) { __u64 ino; @@ -336,7 +337,7 @@ static inline __u64 fid_flatten(const struct lu_fid *fid) seq = fid_seq(fid); - ino = (seq << 24) + ((seq >> (64-8)) & 0xffffff0000ULL) + fid_oid(fid); + ino = (seq << 24) + ((seq >> 24) & 0xffffff0000ULL) + fid_oid(fid); RETURN(ino ? ino : fid_oid(fid)); }