From 83189aef3b23f18cb8c1deae34994a00f8582039 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. Test-Parameters: trivial Signed-off-by: Bobi Jam Change-Id: I21029c6c3e8a7e690ecc8d489bbb95aec3ab1fa8 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51108 Reviewed-by: Sebastien Buisson Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Tested-by: Maloo Tested-by: jenkins --- lustre/include/uapi/linux/lustre/lustre_idl.h | 4 +++- lustre/obdclass/lprocfs_status.c | 2 ++ lustre/ptlrpc/pack_generic.c | 6 ++++-- lustre/ptlrpc/wiretest.c | 12 ++++++++---- lustre/utils/wirecheck.c | 4 +++- lustre/utils/wiretest.c | 12 ++++++++---- 6 files changed, 28 insertions(+), 12 deletions(-) diff --git a/lustre/include/uapi/linux/lustre/lustre_idl.h b/lustre/include/uapi/linux/lustre/lustre_idl.h index e2e18b9..9064639 100644 --- a/lustre/include/uapi/linux/lustre/lustre_idl.h +++ b/lustre/include/uapi/linux/lustre/lustre_idl.h @@ -848,6 +848,8 @@ struct ptlrpc_body_v2 { #define OBD_CONNECT2_ENCRYPT_FID2PATH 0x40000000ULL /* fid2path enc file */ /* For MDS+OSS rolling upgrade interop with 2.16+older, ignored after 2.20.53 */ #define OBD_CONNECT2_REPLAY_CREATE 0x80000000ULL /* replay OST_CREATE */ +#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 @@ -987,7 +989,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 d552488..fa55f70 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -652,6 +652,8 @@ static const char *const obd_connect_names[] = { "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 40fe614..8e37ca4 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -1842,9 +1842,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 58e0610..da714f0 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -1213,10 +1213,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", @@ -1447,6 +1447,10 @@ void lustre_assert_wire_constants(void) OBD_CONNECT2_ENCRYPT_FID2PATH); LASSERTF(OBD_CONNECT2_REPLAY_CREATE == 0x80000000ULL, "found 0x%.16llxULL\n", OBD_CONNECT2_REPLAY_CREATE); + 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); diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index cb26884..dcdfd0f 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -577,7 +577,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); @@ -683,6 +683,8 @@ check_obd_connect_data(void) CHECK_DEFINE_64X(OBD_CONNECT2_DMV_IMP_INHERIT); CHECK_DEFINE_64X(OBD_CONNECT2_ENCRYPT_FID2PATH); CHECK_DEFINE_64X(OBD_CONNECT2_REPLAY_CREATE); + 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 7dfedcc..0fea530 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -1239,10 +1239,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", @@ -1472,6 +1472,10 @@ void lustre_assert_wire_constants(void) OBD_CONNECT2_ENCRYPT_FID2PATH); LASSERTF(OBD_CONNECT2_REPLAY_CREATE == 0x80000000ULL, "found 0x%.16llxULL\n", OBD_CONNECT2_REPLAY_CREATE); + 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); -- 1.8.3.1