From 91dbd0b99e4d3fb6fe6a870cbf7297b5a362f05f Mon Sep 17 00:00:00 2001 From: wangdi Date: Wed, 22 Feb 2012 10:44:35 -0800 Subject: [PATCH] LU-1081 fid: define special FID for BFL The sequence of LUSTRE_BFL_FID is in conflict with FID_SEQ_OST_MDT1, so reserve a new sequence for this FID. Also it defines a new FID sequence(FID_SEQ_SPECIAL) for later special purpose. Move some special dot_lustre oid to lustre_idl.h, so avoid oid conflict in future. Signed-off-by: Wang Di Change-Id: I556b31c706cc04c610c909f83e59f0cb9a821535 Reviewed-on: http://review.whamcloud.com/2180 Reviewed-by: Andreas Dilger Tested-by: Hudson Tested-by: Maloo --- lustre/fid/fid_lib.c | 8 ++++---- lustre/include/lustre/lustre_idl.h | 13 +++++++++++++ lustre/ptlrpc/wiretest.c | 9 +++++++++ lustre/utils/wirecheck.c | 5 +++++ lustre/utils/wiretest.c | 7 +++++++ 5 files changed, 38 insertions(+), 4 deletions(-) diff --git a/lustre/fid/fid_lib.c b/lustre/fid/fid_lib.c index d818b2c..148b372 100644 --- a/lustre/fid/fid_lib.c +++ b/lustre/fid/fid_lib.c @@ -86,19 +86,19 @@ const struct lu_seq_range LUSTRE_SEQ_ZERO_RANGE = { EXPORT_SYMBOL(LUSTRE_SEQ_ZERO_RANGE); /* Lustre Big Fs Lock fid. */ -const struct lu_fid LUSTRE_BFL_FID = { .f_seq = 0x0000000000000003, - .f_oid = 0x0000000000000001, +const struct lu_fid LUSTRE_BFL_FID = { .f_seq = FID_SEQ_SPECIAL, + .f_oid = FID_OID_SPECIAL_BFL, .f_ver = 0x0000000000000000 }; EXPORT_SYMBOL(LUSTRE_BFL_FID); /** Special fid for ".lustre" directory */ const struct lu_fid LU_DOT_LUSTRE_FID = { .f_seq = FID_SEQ_DOT_LUSTRE, - .f_oid = 0x0000000000000001, + .f_oid = FID_OID_DOT_LUSTRE, .f_ver = 0x0000000000000000 }; EXPORT_SYMBOL(LU_DOT_LUSTRE_FID); /** Special fid for "fid" special object in .lustre */ const struct lu_fid LU_OBF_FID = { .f_seq = FID_SEQ_DOT_LUSTRE, - .f_oid = 0x0000000000000002, + .f_oid = FID_OID_DOT_LUSTRE_OBF, .f_ver = 0x0000000000000000 }; EXPORT_SYMBOL(LU_OBF_FID); diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index 99bbc2f..cee5f58 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -421,6 +421,8 @@ enum fid_seq { FID_SEQ_START = 0x200000000ULL, FID_SEQ_LOCAL_FILE = 0x200000001ULL, FID_SEQ_DOT_LUSTRE = 0x200000002ULL, + /* XXX 0x200000003ULL is reserved for FID_SEQ_LLOG_OBJ */ + FID_SEQ_SPECIAL = 0x200000004ULL, FID_SEQ_NORMAL = 0x200000400ULL, FID_SEQ_LOV_DEFAULT= 0xffffffffffffffffULL }; @@ -432,6 +434,17 @@ enum fid_seq { #define IDIF_MAX_OID (1ULL << IDIF_OID_MAX_BITS) #define IDIF_OID_MASK ((1ULL << IDIF_OID_MAX_BITS) - 1) +/** OID for FID_SEQ_SPECIAL */ +enum special_oid { + /* Big Filesystem Lock to serialize rename operations */ + FID_OID_SPECIAL_BFL = 1UL, +}; + +/** OID for FID_SEQ_DOT_LUSTRE */ +enum dot_lustre_oid { + FID_OID_DOT_LUSTRE = 1UL, + FID_OID_DOT_LUSTRE_OBF = 2UL, +}; static inline int fid_seq_is_mdt0(obd_seq seq) { diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index 7208df9..6a6e7d9 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -494,11 +494,20 @@ void lustre_assert_wire_constants(void) (long long)FID_SEQ_LOCAL_FILE); LASSERTF(FID_SEQ_DOT_LUSTRE == 0x0000000200000002ULL, "found 0x%.16llxULL\n", (long long)FID_SEQ_DOT_LUSTRE); + LASSERTF(FID_SEQ_SPECIAL == 0x0000000200000004ULL, "found 0x%.16llxULL\n", + (long long)FID_SEQ_SPECIAL); LASSERTF(FID_SEQ_NORMAL == 0x0000000200000400ULL, "found 0x%.16llxULL\n", (long long)FID_SEQ_NORMAL); LASSERTF(FID_SEQ_LOV_DEFAULT == 0xffffffffffffffffULL, "found 0x%.16llxULL\n", (long long)FID_SEQ_LOV_DEFAULT); + LASSERTF(FID_OID_SPECIAL_BFL == 0x00000001UL, "found 0x%.8xUL\n", + (unsigned)FID_OID_SPECIAL_BFL); + LASSERTF(FID_OID_DOT_LUSTRE == 0x00000001UL, "found 0x%.8xUL\n", + (unsigned)FID_OID_DOT_LUSTRE); + LASSERTF(FID_OID_DOT_LUSTRE_OBF == 0x00000002UL, "found 0x%.8xUL\n", + (unsigned)FID_OID_DOT_LUSTRE_OBF); + /* Checks for struct lu_dirent */ LASSERTF((int)sizeof(struct lu_dirent) == 32, "found %lld\n", (long long)(int)sizeof(struct lu_dirent)); diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index d888439..9733c6f 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -222,8 +222,13 @@ check_ost_id(void) CHECK_VALUE_64X(FID_SEQ_START); CHECK_VALUE_64X(FID_SEQ_LOCAL_FILE); CHECK_VALUE_64X(FID_SEQ_DOT_LUSTRE); + CHECK_VALUE_64X(FID_SEQ_SPECIAL); CHECK_VALUE_64X(FID_SEQ_NORMAL); CHECK_VALUE_64X(FID_SEQ_LOV_DEFAULT); + + CHECK_VALUE(FID_OID_SPECIAL_BFL); + CHECK_VALUE(FID_OID_DOT_LUSTRE); + CHECK_VALUE(FID_OID_DOT_LUSTRE_OBF); } static void diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index eceaf35..a961311 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -505,6 +505,13 @@ void lustre_assert_wire_constants(void) LASSERTF(FID_SEQ_LOV_DEFAULT == 0xffffffffffffffffULL, "found 0x%.16llxULL\n", (long long)FID_SEQ_LOV_DEFAULT); + LASSERTF(FID_OID_SPECIAL_BFL == 0x00000001UL, "found 0x%.8xUL\n", + (unsigned)FID_OID_SPECIAL_BFL); + LASSERTF(FID_OID_DOT_LUSTRE == 0x00000001UL, "found 0x%.8xUL\n", + (unsigned)FID_OID_DOT_LUSTRE); + LASSERTF(FID_OID_DOT_LUSTRE_OBF == 0x00000002UL, "found 0x%.8xUL\n", + (unsigned)FID_OID_DOT_LUSTRE_OBF); + /* Checks for struct lu_dirent */ LASSERTF((int)sizeof(struct lu_dirent) == 32, "found %lld\n", (long long)(int)sizeof(struct lu_dirent)); -- 1.8.3.1