From a5dc6abb06215856dde2d572f7d4c24dddebb718 Mon Sep 17 00:00:00 2001 From: Fan Yong Date: Tue, 20 Oct 2015 06:33:23 +0800 Subject: [PATCH] LU-7543 obd: reserve connection flag OBD_CONNECT_FLAGS2 This is a feature for the client and server to use obd_connect_flags2 to communicate future feature flags. The client should set this flag whenever any flags in that field are requested, and the server should mask unsupported features from this field (assuming it understands OBD_CONNECT_FLAGS2). When checking if an OBD_CONNECT2_xxxx feature is supported, the client/server needs to firstly check if OBD_CONNECT_FLAGS2 is supported, since this field is also beyond the end of the old obd_connect_data. Land the connection flags to master earlier for reserving the slot to avoid potential conflict with others. Signed-off-by: Fan Yong Change-Id: I466a4f858326d79f8c732116915b078902aa0736 Reviewed-on: http://review.whamcloud.com/17647 Tested-by: Jenkins Reviewed-by: Andreas Dilger Reviewed-by: Patrick Farrell Tested-by: Maloo --- lustre/include/lustre/lustre_idl.h | 3 ++- lustre/obdclass/lprocfs_status.c | 1 + lustre/ptlrpc/pack_generic.c | 5 +++-- lustre/ptlrpc/wiretest.c | 10 ++++++---- lustre/utils/wirecheck.c | 3 ++- lustre/utils/wiretest.c | 10 ++++++---- 6 files changed, 20 insertions(+), 12 deletions(-) diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index c08719b..cebe691 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -1266,6 +1266,7 @@ extern void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb); /** bulk matchbits is sent within ptlrpc_body */ #define OBD_CONNECT_BULK_MBITS 0x2000000000000000ULL #define OBD_CONNECT_OBDOPACK 0x4000000000000000ULL /* compact OUT obdo */ +#define OBD_CONNECT_FLAGS2 0x8000000000000000ULL /* second flags word */ /* XXX README XXX: * Please DO NOT add flag values here before first ensuring that this same * flag value is not in use on some other branch. Please clear any such @@ -1370,7 +1371,7 @@ struct obd_connect_data { __u16 ocd_maxmodrpcs; /* Maximum modify RPCs in parallel */ __u16 padding0; /* added 2.1.0. also fix lustre_swab_connect */ __u32 padding1; /* added 2.1.0. also fix lustre_swab_connect */ - __u64 padding2; /* added 2.1.0. also fix lustre_swab_connect */ + __u64 ocd_connect_flags2; __u64 padding3; /* added 2.1.0. also fix lustre_swab_connect */ __u64 padding4; /* added 2.1.0. also fix lustre_swab_connect */ __u64 padding5; /* added 2.1.0. also fix lustre_swab_connect */ diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 956abe2..917bd6b4 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -656,6 +656,7 @@ static const char *obd_connect_names[] = { "lock_ahead", "bulk_mbits", "compact_obdo", + "second_flags", NULL }; diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index 02aafad..18c1865 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -1677,8 +1677,9 @@ void lustre_swab_connect(struct obd_connect_data *ocd) if (ocd->ocd_connect_flags & OBD_CONNECT_MULTIMODRPCS) __swab16s(&ocd->ocd_maxmodrpcs); CLASSERT(offsetof(typeof(*ocd), padding0) != 0); - CLASSERT(offsetof(typeof(*ocd), padding1) != 0); - CLASSERT(offsetof(typeof(*ocd), padding2) != 0); + CLASSERT(offsetof(typeof(*ocd), padding1) != 0); + if (ocd->ocd_connect_flags & OBD_CONNECT_FLAGS2) + __swab64s(&ocd->ocd_connect_flags2); CLASSERT(offsetof(typeof(*ocd), padding3) != 0); CLASSERT(offsetof(typeof(*ocd), padding4) != 0); CLASSERT(offsetof(typeof(*ocd), padding5) != 0); diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index f64bcf7..f048a4c 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -1016,10 +1016,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct obd_connect_data, padding1)); LASSERTF((int)sizeof(((struct obd_connect_data *)0)->padding1) == 4, "found %lld\n", (long long)(int)sizeof(((struct obd_connect_data *)0)->padding1)); - LASSERTF((int)offsetof(struct obd_connect_data, padding2) == 80, "found %lld\n", - (long long)(int)offsetof(struct obd_connect_data, padding2)); - LASSERTF((int)sizeof(((struct obd_connect_data *)0)->padding2) == 8, "found %lld\n", - (long long)(int)sizeof(((struct obd_connect_data *)0)->padding2)); + LASSERTF((int)offsetof(struct obd_connect_data, ocd_connect_flags2) == 80, "found %lld\n", + (long long)(int)offsetof(struct obd_connect_data, ocd_connect_flags2)); + LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_connect_flags2) == 8, "found %lld\n", + (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_connect_flags2)); LASSERTF((int)offsetof(struct obd_connect_data, padding3) == 88, "found %lld\n", (long long)(int)offsetof(struct obd_connect_data, padding3)); LASSERTF((int)sizeof(((struct obd_connect_data *)0)->padding3) == 8, "found %lld\n", @@ -1194,6 +1194,8 @@ void lustre_assert_wire_constants(void) OBD_CONNECT_BULK_MBITS); LASSERTF(OBD_CONNECT_OBDOPACK == 0x4000000000000000ULL, "found 0x%.16llxULL\n", OBD_CONNECT_OBDOPACK); + LASSERTF(OBD_CONNECT_FLAGS2 == 0x8000000000000000ULL, "found 0x%.16llxULL\n", + OBD_CONNECT_FLAGS2); LASSERTF(OBD_CKSUM_CRC32 == 0x00000001UL, "found 0x%.8xUL\n", (unsigned)OBD_CKSUM_CRC32); LASSERTF(OBD_CKSUM_ADLER == 0x00000002UL, "found 0x%.8xUL\n", diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index eaec094..cd0890d 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -455,7 +455,7 @@ check_obd_connect_data(void) CHECK_MEMBER(obd_connect_data, ocd_maxmodrpcs); CHECK_MEMBER(obd_connect_data, padding0); CHECK_MEMBER(obd_connect_data, padding1); - CHECK_MEMBER(obd_connect_data, padding2); + CHECK_MEMBER(obd_connect_data, ocd_connect_flags2); CHECK_MEMBER(obd_connect_data, padding3); CHECK_MEMBER(obd_connect_data, padding4); CHECK_MEMBER(obd_connect_data, padding5); @@ -531,6 +531,7 @@ check_obd_connect_data(void) CHECK_DEFINE_64X(OBD_CONNECT_LOCK_AHEAD); CHECK_DEFINE_64X(OBD_CONNECT_BULK_MBITS); CHECK_DEFINE_64X(OBD_CONNECT_OBDOPACK); + CHECK_DEFINE_64X(OBD_CONNECT_FLAGS2); CHECK_VALUE_X(OBD_CKSUM_CRC32); CHECK_VALUE_X(OBD_CKSUM_ADLER); diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index 00771ee..2481225b 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -1027,10 +1027,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct obd_connect_data, padding1)); LASSERTF((int)sizeof(((struct obd_connect_data *)0)->padding1) == 4, "found %lld\n", (long long)(int)sizeof(((struct obd_connect_data *)0)->padding1)); - LASSERTF((int)offsetof(struct obd_connect_data, padding2) == 80, "found %lld\n", - (long long)(int)offsetof(struct obd_connect_data, padding2)); - LASSERTF((int)sizeof(((struct obd_connect_data *)0)->padding2) == 8, "found %lld\n", - (long long)(int)sizeof(((struct obd_connect_data *)0)->padding2)); + LASSERTF((int)offsetof(struct obd_connect_data, ocd_connect_flags2) == 80, "found %lld\n", + (long long)(int)offsetof(struct obd_connect_data, ocd_connect_flags2)); + LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_connect_flags2) == 8, "found %lld\n", + (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_connect_flags2)); LASSERTF((int)offsetof(struct obd_connect_data, padding3) == 88, "found %lld\n", (long long)(int)offsetof(struct obd_connect_data, padding3)); LASSERTF((int)sizeof(((struct obd_connect_data *)0)->padding3) == 8, "found %lld\n", @@ -1205,6 +1205,8 @@ void lustre_assert_wire_constants(void) OBD_CONNECT_BULK_MBITS); LASSERTF(OBD_CONNECT_OBDOPACK == 0x4000000000000000ULL, "found 0x%.16llxULL\n", OBD_CONNECT_OBDOPACK); + LASSERTF(OBD_CONNECT_FLAGS2 == 0x8000000000000000ULL, "found 0x%.16llxULL\n", + OBD_CONNECT_FLAGS2); LASSERTF(OBD_CKSUM_CRC32 == 0x00000001UL, "found 0x%.8xUL\n", (unsigned)OBD_CKSUM_CRC32); LASSERTF(OBD_CKSUM_ADLER == 0x00000002UL, "found 0x%.8xUL\n", -- 1.8.3.1