From 0c65a5b787e4a0e85d93857d327f6795d827e395 Mon Sep 17 00:00:00 2001 From: Bobi Jam Date: Wed, 24 May 2023 08:25:05 +0800 Subject: [PATCH] LU-16837 csdc: reserve connect bits for compressed layout Add connect data bit for compressed layout (OBD_CONNECT2_COMPRESS) and another connect data bit to be used (OBD_CONNECT2_LARGE_NID). Also reserve obd_connect_data::ocd_compr_type which is a bitmask of supported compression type to be negotiated between client and MDS. Lustre-change: https://review.whamcloud.com/51108 Lustre-commit: 83189aef3b23f18cb8c1deae34994a00f8582039 Test-Parameters: trivial Signed-off-by: Bobi Jam Change-Id: I21029c6c3e8a7e690ecc8d489bbb95aec3ab1fa8 Reviewed-by: Sebastien Buisson Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/51409 Tested-by: jenkins Tested-by: Maloo --- lustre/include/uapi/linux/lustre/lustre_idl.h | 4 +++- lustre/obdclass/lprocfs_status.c | 3 +++ lustre/ptlrpc/pack_generic.c | 6 ++++-- lustre/ptlrpc/wiretest.c | 13 +++++++++---- lustre/utils/wirecheck.c | 4 +++- lustre/utils/wiretest.c | 13 +++++++++---- 6 files changed, 31 insertions(+), 12 deletions(-) diff --git a/lustre/include/uapi/linux/lustre/lustre_idl.h b/lustre/include/uapi/linux/lustre/lustre_idl.h index 2ab3b7e..6f1e0b7 100644 --- a/lustre/include/uapi/linux/lustre/lustre_idl.h +++ b/lustre/include/uapi/linux/lustre/lustre_idl.h @@ -868,6 +868,8 @@ struct ptlrpc_body_v2 { #define OBD_CONNECT2_ATOMIC_OPEN_LOCK 0x4000000ULL /* lock on first open */ #define OBD_CONNECT2_ENCRYPT_NAME 0x8000000ULL /* name encrypt */ #define OBD_CONNECT2_ENCRYPT_FID2PATH 0x40000000ULL /* fid2path enc file */ +#define OBD_CONNECT2_LARGE_NID 0x100000000ULL /* understands large/IPv6 NIDs */ +#define OBD_CONNECT2_COMPRESS 0x200000000ULL /* compressed file */ /* XXX README XXX README XXX README XXX README XXX README XXX README XXX * Please DO NOT add OBD_CONNECT flags before first ensuring that this value * is not in use by some other branch/patch. Email adilger@whamcloud.com @@ -1002,7 +1004,7 @@ struct obd_connect_data { __u16 padding0; /* READ BELOW! also fix lustre_swab_connect */ __u32 padding1; /* READ BELOW! also fix lustre_swab_connect */ __u64 ocd_connect_flags2;/* OBD_CONNECT2_* per above */ - __u64 padding3; /* READ BELOW! also fix lustre_swab_connect */ + __u64 ocd_compr_type; /* bitmask of supported compression types */ __u64 padding4; /* READ BELOW! also fix lustre_swab_connect */ __u64 padding5; /* READ BELOW! also fix lustre_swab_connect */ __u64 padding6; /* READ BELOW! also fix lustre_swab_connect */ diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 4981419..2411469 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -652,6 +652,9 @@ static const char *const obd_connect_names[] = { "mkdir_replay", /* 0x10000000 */ "dmv_imp_inherit", /* 0x20000000 */ "encryption_fid2path", /* 0x40000000 */ + "replay_create", /* 0x80000000 */ + "large_nid", /* 0x100000000 */ + "compressed_file", /* 0x200000000 */ NULL }; diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index c5f66e4..2ffd4df 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -1781,9 +1781,11 @@ void lustre_swab_connect(struct obd_connect_data *ocd) __swab16s(&ocd->ocd_maxmodrpcs); BUILD_BUG_ON(offsetof(typeof(*ocd), padding0) == 0); BUILD_BUG_ON(offsetof(typeof(*ocd), padding1) == 0); - if (ocd->ocd_connect_flags & OBD_CONNECT_FLAGS2) + if (ocd->ocd_connect_flags & OBD_CONNECT_FLAGS2) { __swab64s(&ocd->ocd_connect_flags2); - BUILD_BUG_ON(offsetof(typeof(*ocd), padding3) == 0); + if (ocd->ocd_connect_flags2 & OBD_CONNECT2_COMPRESS) + __swab64s(&ocd->ocd_compr_type); + } BUILD_BUG_ON(offsetof(typeof(*ocd), padding4) == 0); BUILD_BUG_ON(offsetof(typeof(*ocd), padding5) == 0); BUILD_BUG_ON(offsetof(typeof(*ocd), padding6) == 0); diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index 46262e7..2cc96e4 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -1169,10 +1169,10 @@ void lustre_assert_wire_constants(void) (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", - (long long)(int)sizeof(((struct obd_connect_data *)0)->padding3)); + LASSERTF((int)offsetof(struct obd_connect_data, ocd_compr_type) == 88, "found %lld\n", + (long long)(int)offsetof(struct obd_connect_data, ocd_compr_type)); + LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_compr_type) == 8, "found %lld\n", + (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_compr_type)); LASSERTF((int)offsetof(struct obd_connect_data, padding4) == 96, "found %lld\n", (long long)(int)offsetof(struct obd_connect_data, padding4)); LASSERTF((int)sizeof(((struct obd_connect_data *)0)->padding4) == 8, "found %lld\n", @@ -1397,6 +1397,11 @@ void lustre_assert_wire_constants(void) OBD_CONNECT2_ENCRYPT_NAME); LASSERTF(OBD_CONNECT2_ENCRYPT_FID2PATH == 0x40000000ULL, "found 0x%.16llxULL\n", OBD_CONNECT2_ENCRYPT_FID2PATH); + LASSERTF(OBD_CONNECT2_LARGE_NID == 0x100000000ULL, "found 0x%.16llxULL\n", + OBD_CONNECT2_LARGE_NID); + LASSERTF(OBD_CONNECT2_COMPRESS == 0x200000000ULL, "found 0x%.16llxULL\n", + OBD_CONNECT2_COMPRESS); + 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 58f9f84..482e2b7 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -549,7 +549,7 @@ check_obd_connect_data(void) CHECK_MEMBER(obd_connect_data, padding0); CHECK_MEMBER(obd_connect_data, padding1); CHECK_MEMBER(obd_connect_data, ocd_connect_flags2); - CHECK_MEMBER(obd_connect_data, padding3); + CHECK_MEMBER(obd_connect_data, ocd_compr_type); CHECK_MEMBER(obd_connect_data, padding4); CHECK_MEMBER(obd_connect_data, padding5); CHECK_MEMBER(obd_connect_data, padding6); @@ -651,6 +651,8 @@ check_obd_connect_data(void) CHECK_DEFINE_64X(OBD_CONNECT2_ATOMIC_OPEN_LOCK); CHECK_DEFINE_64X(OBD_CONNECT2_ENCRYPT_NAME); CHECK_DEFINE_64X(OBD_CONNECT2_ENCRYPT_FID2PATH); + CHECK_DEFINE_64X(OBD_CONNECT2_LARGE_NID); + CHECK_DEFINE_64X(OBD_CONNECT2_COMPRESS); BLANK_LINE(); CHECK_VALUE_X(OBD_CKSUM_CRC32); diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index 866c986..10bb43b 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -1206,10 +1206,10 @@ void lustre_assert_wire_constants(void) (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", - (long long)(int)sizeof(((struct obd_connect_data *)0)->padding3)); + LASSERTF((int)offsetof(struct obd_connect_data, ocd_compr_type) == 88, "found %lld\n", + (long long)(int)offsetof(struct obd_connect_data, ocd_compr_type)); + LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_compr_type) == 8, "found %lld\n", + (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_compr_type)); LASSERTF((int)offsetof(struct obd_connect_data, padding4) == 96, "found %lld\n", (long long)(int)offsetof(struct obd_connect_data, padding4)); LASSERTF((int)sizeof(((struct obd_connect_data *)0)->padding4) == 8, "found %lld\n", @@ -1434,6 +1434,11 @@ void lustre_assert_wire_constants(void) OBD_CONNECT2_ENCRYPT_NAME); LASSERTF(OBD_CONNECT2_ENCRYPT_FID2PATH == 0x40000000ULL, "found 0x%.16llxULL\n", OBD_CONNECT2_ENCRYPT_FID2PATH); + LASSERTF(OBD_CONNECT2_LARGE_NID == 0x100000000ULL, "found 0x%.16llxULL\n", + OBD_CONNECT2_LARGE_NID); + LASSERTF(OBD_CONNECT2_COMPRESS == 0x200000000ULL, "found 0x%.16llxULL\n", + OBD_CONNECT2_COMPRESS); + 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