From: Patrick Farrell Date: Wed, 9 Aug 2023 16:16:25 +0000 (-0400) Subject: LU-13805 obd: Reserve unaligned DIO connect flag X-Git-Tag: 2.15.58~72 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=4c96cbf89dba5e4bf8ddf98a18b72142c22a4289;p=fs%2Flustre-release.git LU-13805 obd: Reserve unaligned DIO connect flag Unaligned DIO generally requires only client changes, but an assert must be removed from ZFS servers for it to work correctly. This means we need a connect flag to recognize whether or not a server running ZFS can safely use unaligned DIO. All OSTs will present this flag - to keep things simple - but if the flag is not present, we'll still do unaligned DIO to ldiskfs OSTs. Actual implementation will be in another patch, this one just creates the flag itself. Test-Parameters: trivial Signed-off-by: Patrick Farrell Change-Id: I8b149cc54f4fb11e64182c65f2fbb01f8a3d3868 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51075 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Sebastien Buisson Reviewed-by: Qian Yingjin Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/lustre_export.h b/lustre/include/lustre_export.h index de28a47..de7efa7 100644 --- a/lustre/include/lustre_export.h +++ b/lustre/include/lustre_export.h @@ -524,6 +524,11 @@ static inline bool imp_connect_replay_create(struct obd_import *imp) #define imp_connect_replay_create(exp) true #endif +static inline bool exp_connect_unaligned_dio(struct obd_export *exp) +{ + return (exp_connect_flags2(exp) & OBD_CONNECT2_UNALIGNED_DIO); +} + enum { /* archive_ids in array format */ KKUC_CT_DATA_ARRAY_MAGIC = 0x092013cea, diff --git a/lustre/include/uapi/linux/lustre/lustre_idl.h b/lustre/include/uapi/linux/lustre/lustre_idl.h index f69b0e3..6a61cae 100644 --- a/lustre/include/uapi/linux/lustre/lustre_idl.h +++ b/lustre/include/uapi/linux/lustre/lustre_idl.h @@ -851,6 +851,9 @@ struct ptlrpc_body_v2 { #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 */ +/* only ZFS servers require a change to support unaligned DIO, so this flag is + * ignored for ldiskfs servers */ +#define OBD_CONNECT2_UNALIGNED_DIO 0x400000000ULL /* unaligned DIO */ /* 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 diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 48151b9..33f61c2 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -654,6 +654,7 @@ static const char *const obd_connect_names[] = { "replay_create", /* 0x80000000 */ "large_nid", /* 0x100000000 */ "compressed_file", /* 0x200000000 */ + "unaligned_dio", /* 0x400000000 */ NULL }; diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index 7676db9..efdbbc2 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -1454,6 +1454,8 @@ void lustre_assert_wire_constants(void) OBD_CONNECT2_LARGE_NID); LASSERTF(OBD_CONNECT2_COMPRESS == 0x200000000ULL, "found 0x%.16llxULL\n", OBD_CONNECT2_COMPRESS); + LASSERTF(OBD_CONNECT2_UNALIGNED_DIO == 0x400000000ULL, "found 0x%.16llxULL\n", + OBD_CONNECT2_UNALIGNED_DIO); 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 39306a5..077b145 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -685,6 +685,7 @@ check_obd_connect_data(void) CHECK_DEFINE_64X(OBD_CONNECT2_REPLAY_CREATE); CHECK_DEFINE_64X(OBD_CONNECT2_LARGE_NID); CHECK_DEFINE_64X(OBD_CONNECT2_COMPRESS); + CHECK_DEFINE_64X(OBD_CONNECT2_UNALIGNED_DIO); BLANK_LINE(); CHECK_VALUE_X(OBD_CKSUM_CRC32); diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index 99be9fb..85d9bfe 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -1478,6 +1478,8 @@ void lustre_assert_wire_constants(void) OBD_CONNECT2_LARGE_NID); LASSERTF(OBD_CONNECT2_COMPRESS == 0x200000000ULL, "found 0x%.16llxULL\n", OBD_CONNECT2_COMPRESS); + LASSERTF(OBD_CONNECT2_UNALIGNED_DIO == 0x400000000ULL, "found 0x%.16llxULL\n", + OBD_CONNECT2_UNALIGNED_DIO); LASSERTF(OBD_CKSUM_CRC32 == 0x00000001UL, "found 0x%.8xUL\n", (unsigned)OBD_CKSUM_CRC32);