staging: lustre: obd: reserve connection flag OBD_CONNECT_FLAGS2
authorFan Yong <fan.yong@intel.com>
Wed, 23 Nov 2016 23:01:20 +0000 (18:01 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Nov 2016 20:50:38 +0000 (21:50 +0100)
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 upstream client earlier for reserving
the slot to avoid potential conflict with others.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7543
Reviewed-on: http://review.whamcloud.com/17647
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Patrick Farrell <paf@cray.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
drivers/staging/lustre/lustre/ptlrpc/pack_generic.c
drivers/staging/lustre/lustre/ptlrpc/wiretest.c

index 3a633ebf22bbddedb2e0cf5efcb661d352b45b5d..b9f333b803ae0da2c38fef10a12a7024b248d744 100644 (file)
@@ -1194,6 +1194,7 @@ 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
@@ -1249,7 +1250,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 */
index 85b505edf340d1f1fdd8ed26780fd44d6b4db839..2f2e8fcb18d3fe34210b7354f28fde8eb5ead57a 100644 (file)
@@ -106,6 +106,7 @@ static const char * const obd_connect_names[] = {
        "lock_ahead",
        "bulk_mbits",
        "compact_obdo",
+       "second_flags",
        NULL
 };
 
index 2c9debbc691e5b57b5c4f4c70bc44dd73e740813..17ec3b69a34f5df14f056b4b9237c34936b8f884 100644 (file)
@@ -1566,7 +1566,8 @@ void lustre_swab_connect(struct obd_connect_data *ocd)
                __swab16s(&ocd->ocd_maxmodrpcs);
        CLASSERT(offsetof(typeof(*ocd), padding0));
        CLASSERT(offsetof(typeof(*ocd), padding1) != 0);
-       CLASSERT(offsetof(typeof(*ocd), padding2) != 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);
index 04e94710f9d161eb5b78a5ab9c2f0be3b03fcae5..f50f487ab450b0c628ed2d3952ecf21281208704 100644 (file)
@@ -935,10 +935,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",
@@ -1111,6 +1111,8 @@ void lustre_assert_wire_constants(void)
                 OBD_CONNECT_LOCK_AHEAD);
        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",