From: Johann Lombardi Date: Wed, 13 Jul 2011 23:05:32 +0000 (+0200) Subject: LU-1132 protocol: reserve connect flags for new features X-Git-Tag: 2.1.58~21 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=37b6ad662657a6986d8d17d172a2756d52c86cf8 LU-1132 protocol: reserve connect flags for new features This patch reserves connect flags for several outstanding features: * OBD_CONNECT_GRANT_PARAM for grant additional parameters to consume grant more intelligently on the client side. * OBD_CONNECT_JOBSTATS to pass a job id in ptlrpc_body. * OBD_CONNECT_EINPROGRESS for clients that can deal with EINPROGRESS on write. This patch also reserves fields for the per-file data_version patch from LU-827. Change-Id: Icb55435bca443b4c2106e7eec9b368f94d1be08c Signed-off-by: Johann Lombardi Reviewed-on: http://review.whamcloud.com/1090 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index bcef3b3..3237431 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -1105,6 +1105,14 @@ extern void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb); * directory hash */ #define OBD_CONNECT_MAXBYTES 0x8000000000ULL /* max stripe size */ #define OBD_CONNECT_IMP_RECOV 0x10000000000ULL /* imp recovery support */ +#define OBD_CONNECT_JOBSTATS 0x20000000000ULL /* jobid in ptlrpc_body */ +#define OBD_CONNECT_GRANT_PARAM 0x40000000000ULL /* additional grant parameters + * are passed at connect time + * to have finer grant space + * allocation */ +#define OBD_CONNECT_EINPROGRESS 0x80000000000ULL /* client can handle the + * -EINPROGRESS error for write + * RPC properly */ #define OCD_HAS_FLAG(ocd, flg) \ (!!((ocd)->ocd_connect_flags & OBD_CONNECT_##flg)) @@ -1171,8 +1179,10 @@ struct obd_connect_data_v1 { __u32 ocd_index; /* LOV index to connect to */ __u32 ocd_brw_size; /* Maximum BRW size in bytes */ __u64 ocd_ibits_known; /* inode bits this client understands */ - __u32 ocd_nllu; /* non-local-lustre-user */ - __u32 ocd_nllg; /* non-local-lustre-group */ + __u8 ocd_blocksize; /* log2 of the backend filesystem blocksize */ + __u8 ocd_inodespace; /* log2 of the per-inode space consumption */ + __u16 ocd_grant_extent; /* per-extent grant overhead, in 1K blocks */ + __u32 ocd_unused; /* also fix lustre_swab_connect */ __u64 ocd_transno; /* first transno from client to be replayed */ __u32 ocd_group; /* MDS group on OST */ __u32 ocd_cksum_types; /* supported checksum algorithms */ @@ -1188,8 +1198,10 @@ struct obd_connect_data { __u32 ocd_index; /* LOV index to connect to */ __u32 ocd_brw_size; /* Maximum BRW size in bytes */ __u64 ocd_ibits_known; /* inode bits this client understands */ - __u32 ocd_nllu; /* non-local-lustre-user */ - __u32 ocd_nllg; /* non-local-lustre-group */ + __u8 ocd_blocksize; /* log2 of the backend filesystem blocksize */ + __u8 ocd_inodespace; /* log2 of the per-inode space consumption */ + __u16 ocd_grant_extent; /* per-extent grant overhead, in 1K blocks */ + __u32 ocd_unused; /* also fix lustre_swab_connect */ __u64 ocd_transno; /* first transno from client to be replayed */ __u32 ocd_group; /* MDS group on OST */ __u32 ocd_cksum_types; /* supported checksum algorithms */ @@ -1413,6 +1425,8 @@ struct lov_mds_md_v3 { /* LOV EA mds/wire data (little-endian) */ #define OBD_MD_FLRMTRSETFACL (0x0004000000000000ULL) /* lfs rsetfacl case */ #define OBD_MD_FLRMTRGETFACL (0x0008000000000000ULL) /* lfs rgetfacl case */ +#define OBD_MD_FLDATAVERSION (0x0010000000000000ULL) /* iversion sum */ + #define OBD_MD_FLGETATTR (OBD_MD_FLID | OBD_MD_FLATIME | OBD_MD_FLMTIME | \ OBD_MD_FLCTIME | OBD_MD_FLSIZE | OBD_MD_FLBLKSZ | \ OBD_MD_FLMODE | OBD_MD_FLTYPE | OBD_MD_FLUID | \ @@ -2714,12 +2728,17 @@ struct obdo { __u64 o_ioepoch; /* epoch in ost writes */ __u32 o_stripe_idx; /* holds stripe idx */ __u32 o_parent_ver; - struct lustre_handle o_handle; /* brw: lock handle to prolong locks */ - struct llog_cookie o_lcookie; /* destroy: unlink cookie from MDS */ - + struct lustre_handle o_handle; /* brw: lock handle to prolong + * locks */ + struct llog_cookie o_lcookie; /* destroy: unlink cookie from + * MDS */ __u32 o_uid_h; __u32 o_gid_h; - __u64 o_padding_3; + + __u64 o_data_version; /* getattr: sum of iversion for + * each stripe. + * brw: grant space consumed on + * the client for the write */ __u64 o_padding_4; __u64 o_padding_5; __u64 o_padding_6; @@ -2731,6 +2750,7 @@ struct obdo { #define o_undirty o_mode #define o_dropped o_misc #define o_cksum o_nlink +#define o_grant_used o_data_version static inline void lustre_set_wire_obdo(struct obdo *wobdo, struct obdo *lobdo) { diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index d85954b..0e3202e 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -811,6 +811,8 @@ static const char *obd_connect_names[] = { "64bithash", "object_max_bytes", "imp_recov", + "jobstats", + "grant_param", NULL }; diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index 6c7ef8a..2ca0aef 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -1568,8 +1568,10 @@ void lustre_swab_connect(struct obd_connect_data *ocd) __swab64s(&ocd->ocd_ibits_known); __swab32s(&ocd->ocd_index); __swab32s(&ocd->ocd_brw_size); - __swab32s(&ocd->ocd_nllu); - __swab32s(&ocd->ocd_nllg); + /* ocd_blocksize and ocd_inodespace don't need to be swabbed because + * they are 8-byte values */ + __swab16s(&ocd->ocd_grant_extent); + __swab32s(&ocd->ocd_unused); __swab64s(&ocd->ocd_transno); __swab32s(&ocd->ocd_group); __swab32s(&ocd->ocd_cksum_types); @@ -1626,7 +1628,7 @@ void lustre_swab_obdo (struct obdo *o) /* o_lcookie is swabbed elsewhere */ __swab32s (&o->o_uid_h); __swab32s (&o->o_gid_h); - CLASSERT(offsetof(typeof(*o), o_padding_3) != 0); + __swab64s (&o->o_data_version); CLASSERT(offsetof(typeof(*o), o_padding_4) != 0); CLASSERT(offsetof(typeof(*o), o_padding_5) != 0); CLASSERT(offsetof(typeof(*o), o_padding_6) != 0); diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index 2b29304..eb318ae 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -805,15 +805,23 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct obd_connect_data, ocd_ibits_known)); LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_ibits_known) == 8, "found %lld\n", (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_ibits_known)); - LASSERTF((int)offsetof(struct obd_connect_data, ocd_nllu) == 32, "found %lld\n", - (long long)(int)offsetof(struct obd_connect_data, ocd_nllu)); - LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_nllu) == 4, "found %lld\n", - (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_nllu)); - LASSERTF((int)offsetof(struct obd_connect_data, ocd_nllg) == 36, "found %lld\n", - (long long)(int)offsetof(struct obd_connect_data, ocd_nllg)); - LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_nllg) == 4, "found %lld\n", - (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_nllg)); - LASSERTF((int)offsetof(struct obd_connect_data, ocd_transno) == 40, "found %lld\n", + LASSERTF((int)offsetof(struct obd_connect_data, ocd_blocksize) == 32, " found %lld\n", + (long long)(int)offsetof(struct obd_connect_data, ocd_blocksize)); + LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_blocksize) == 1, " found %lld\n", + (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_blocksize)); + LASSERTF((int)offsetof(struct obd_connect_data, ocd_inodespace) == 33, " found %lld\n", + (long long)(int)offsetof(struct obd_connect_data, ocd_inodespace)); + LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_inodespace) == 1, " found %lld\n", + (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_inodespace)); + LASSERTF((int)offsetof(struct obd_connect_data, ocd_grant_extent) == 34, " found %lld\n", + (long long)(int)offsetof(struct obd_connect_data, ocd_grant_extent)); + LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_grant_extent) == 2, " found %lld\n", + (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_grant_extent)); + LASSERTF((int)offsetof(struct obd_connect_data, ocd_unused) == 36, " found %lld\n", + (long long)(int)offsetof(struct obd_connect_data, ocd_unused)); + LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_unused) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_unused)); + LASSERTF((int)offsetof(struct obd_connect_data, ocd_transno) == 40, " found %lld\n", (long long)(int)offsetof(struct obd_connect_data, ocd_transno)); LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_transno) == 8, "found %lld\n", (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_transno)); @@ -978,6 +986,12 @@ void lustre_assert_wire_constants(void) OBD_CONNECT_MAXBYTES); LASSERTF(OBD_CONNECT_IMP_RECOV == 0x10000000000ULL, "found 0x%.16llxULL\n", OBD_CONNECT_IMP_RECOV); + LASSERTF(OBD_CONNECT_JOBSTATS == 0x20000000000ULL, "found 0x%.16llxULL\n", + OBD_CONNECT_JOBSTATS); + LASSERTF(OBD_CONNECT_GRANT_PARAM == 0x40000000000ULL, "found 0x%.16llxULL\n", + OBD_CONNECT_GRANT_PARAM); + LASSERTF(OBD_CONNECT_EINPROGRESS == 0x80000000000ULL, "found 0x%.16llxULL\n", + OBD_CONNECT_EINPROGRESS); LASSERTF(OBD_CKSUM_CRC32 == 0x00000001UL, "found 0x%.8xUL\n", (unsigned)OBD_CKSUM_CRC32); LASSERTF(OBD_CKSUM_ADLER == 0x00000002UL, "found 0x%.8xUL\n", @@ -1088,10 +1102,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct obdo, o_gid_h)); LASSERTF((int)sizeof(((struct obdo *)0)->o_gid_h) == 4, "found %lld\n", (long long)(int)sizeof(((struct obdo *)0)->o_gid_h)); - LASSERTF((int)offsetof(struct obdo, o_padding_3) == 176, " found %lld\n", - (long long)(int)offsetof(struct obdo, o_padding_3)); - LASSERTF((int)sizeof(((struct obdo *)0)->o_padding_3) == 8, " found %lld\n", - (long long)(int)sizeof(((struct obdo *)0)->o_padding_3)); + LASSERTF((int)offsetof(struct obdo, o_data_version) == 176, " found %lld\n", + (long long)(int)offsetof(struct obdo, o_data_version)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_data_version) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_data_version)); LASSERTF((int)offsetof(struct obdo, o_padding_4) == 184, "found %lld\n", (long long)(int)offsetof(struct obdo, o_padding_4)); LASSERTF((int)sizeof(((struct obdo *)0)->o_padding_4) == 8, "found %lld\n", @@ -1198,6 +1212,8 @@ void lustre_assert_wire_constants(void) OBD_MD_FLRMTRSETFACL); LASSERTF(OBD_MD_FLRMTRGETFACL == (0x0008000000000000ULL), "found 0x%.16llxULL\n", OBD_MD_FLRMTRGETFACL); + LASSERTF(OBD_MD_FLDATAVERSION == (0x0010000000000000ULL), "found 0x%.16llxULL\n", + OBD_MD_FLDATAVERSION); CLASSERT(OBD_FL_INLINEDATA == 0x00000001); CLASSERT(OBD_FL_OBDMDEXISTS == 0x00000002); CLASSERT(OBD_FL_DELORPHAN == 0x00000004); diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index fea3106..72b511f 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -378,8 +378,10 @@ check_obd_connect_data(void) CHECK_MEMBER(obd_connect_data, ocd_index); CHECK_MEMBER(obd_connect_data, ocd_brw_size); CHECK_MEMBER(obd_connect_data, ocd_ibits_known); - CHECK_MEMBER(obd_connect_data, ocd_nllu); - CHECK_MEMBER(obd_connect_data, ocd_nllg); + CHECK_MEMBER(obd_connect_data, ocd_blocksize); + CHECK_MEMBER(obd_connect_data, ocd_inodespace); + CHECK_MEMBER(obd_connect_data, ocd_grant_extent); + CHECK_MEMBER(obd_connect_data, ocd_unused); CHECK_MEMBER(obd_connect_data, ocd_transno); CHECK_MEMBER(obd_connect_data, ocd_group); CHECK_MEMBER(obd_connect_data, ocd_cksum_types); @@ -443,6 +445,9 @@ check_obd_connect_data(void) CHECK_DEFINE_64X(OBD_CONNECT_64BITHASH); CHECK_DEFINE_64X(OBD_CONNECT_MAXBYTES); CHECK_DEFINE_64X(OBD_CONNECT_IMP_RECOV); + CHECK_DEFINE_64X(OBD_CONNECT_JOBSTATS); + CHECK_DEFINE_64X(OBD_CONNECT_GRANT_PARAM); + CHECK_DEFINE_64X(OBD_CONNECT_EINPROGRESS); CHECK_VALUE_X(OBD_CKSUM_CRC32); CHECK_VALUE_X(OBD_CKSUM_ADLER); @@ -479,7 +484,7 @@ check_obdo(void) CHECK_MEMBER(obdo, o_lcookie); CHECK_MEMBER(obdo, o_uid_h); CHECK_MEMBER(obdo, o_gid_h); - CHECK_MEMBER(obdo, o_padding_3); + CHECK_MEMBER(obdo, o_data_version); CHECK_MEMBER(obdo, o_padding_4); CHECK_MEMBER(obdo, o_padding_5); CHECK_MEMBER(obdo, o_padding_6); @@ -531,6 +536,7 @@ check_obdo(void) CHECK_DEFINE_64X(OBD_MD_FLRMTLGETFACL); CHECK_DEFINE_64X(OBD_MD_FLRMTRSETFACL); CHECK_DEFINE_64X(OBD_MD_FLRMTRGETFACL); + CHECK_DEFINE_64X(OBD_MD_FLDATAVERSION); CHECK_CVALUE_X(OBD_FL_INLINEDATA); CHECK_CVALUE_X(OBD_FL_OBDMDEXISTS); diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index 7f138d0..a6ac6ad 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -811,15 +811,25 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct obd_connect_data, ocd_ibits_known)); LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_ibits_known) == 8, "found %lld\n", (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_ibits_known)); - LASSERTF((int)offsetof(struct obd_connect_data, ocd_nllu) == 32, "found %lld\n", - (long long)(int)offsetof(struct obd_connect_data, ocd_nllu)); - LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_nllu) == 4, "found %lld\n", - (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_nllu)); - LASSERTF((int)offsetof(struct obd_connect_data, ocd_nllg) == 36, "found %lld\n", - (long long)(int)offsetof(struct obd_connect_data, ocd_nllg)); - LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_nllg) == 4, "found %lld\n", - (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_nllg)); - LASSERTF((int)offsetof(struct obd_connect_data, ocd_transno) == 40, "found %lld\n", + LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_ibits_known) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_ibits_known)); + LASSERTF((int)offsetof(struct obd_connect_data, ocd_blocksize) == 32, " found %lld\n", + (long long)(int)offsetof(struct obd_connect_data, ocd_blocksize)); + LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_blocksize) == 1, " found %lld\n", + (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_blocksize)); + LASSERTF((int)offsetof(struct obd_connect_data, ocd_inodespace) == 33, " found %lld\n", + (long long)(int)offsetof(struct obd_connect_data, ocd_inodespace)); + LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_inodespace) == 1, " found %lld\n", + (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_inodespace)); + LASSERTF((int)offsetof(struct obd_connect_data, ocd_grant_extent) == 34, " found %lld\n", + (long long)(int)offsetof(struct obd_connect_data, ocd_grant_extent)); + LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_grant_extent) == 2, " found %lld\n", + (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_grant_extent)); + LASSERTF((int)offsetof(struct obd_connect_data, ocd_unused) == 36, " found %lld\n", + (long long)(int)offsetof(struct obd_connect_data, ocd_unused)); + LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_unused) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_unused)); + LASSERTF((int)offsetof(struct obd_connect_data, ocd_transno) == 40, " found %lld\n", (long long)(int)offsetof(struct obd_connect_data, ocd_transno)); LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_transno) == 8, "found %lld\n", (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_transno)); @@ -984,6 +994,12 @@ void lustre_assert_wire_constants(void) OBD_CONNECT_MAXBYTES); LASSERTF(OBD_CONNECT_IMP_RECOV == 0x10000000000ULL, "found 0x%.16llxULL\n", OBD_CONNECT_IMP_RECOV); + LASSERTF(OBD_CONNECT_JOBSTATS == 0x20000000000ULL, "found 0x%.16llxULL\n", + OBD_CONNECT_JOBSTATS); + LASSERTF(OBD_CONNECT_GRANT_PARAM == 0x40000000000ULL, "found 0x%.16llxULL\n", + OBD_CONNECT_GRANT_PARAM); + LASSERTF(OBD_CONNECT_EINPROGRESS == 0x80000000000ULL, "found 0x%.16llxULL\n", + OBD_CONNECT_EINPROGRESS); LASSERTF(OBD_CKSUM_CRC32 == 0x00000001UL, "found 0x%.8xUL\n", (unsigned)OBD_CKSUM_CRC32); LASSERTF(OBD_CKSUM_ADLER == 0x00000002UL, "found 0x%.8xUL\n", @@ -1094,10 +1110,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct obdo, o_gid_h)); LASSERTF((int)sizeof(((struct obdo *)0)->o_gid_h) == 4, "found %lld\n", (long long)(int)sizeof(((struct obdo *)0)->o_gid_h)); - LASSERTF((int)offsetof(struct obdo, o_padding_3) == 176, " found %lld\n", - (long long)(int)offsetof(struct obdo, o_padding_3)); - LASSERTF((int)sizeof(((struct obdo *)0)->o_padding_3) == 8, " found %lld\n", - (long long)(int)sizeof(((struct obdo *)0)->o_padding_3)); + LASSERTF((int)offsetof(struct obdo, o_data_version) == 176, " found %lld\n", + (long long)(int)offsetof(struct obdo, o_data_version)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_data_version) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_data_version)); LASSERTF((int)offsetof(struct obdo, o_padding_4) == 184, "found %lld\n", (long long)(int)offsetof(struct obdo, o_padding_4)); LASSERTF((int)sizeof(((struct obdo *)0)->o_padding_4) == 8, "found %lld\n", @@ -1204,6 +1220,8 @@ void lustre_assert_wire_constants(void) OBD_MD_FLRMTRSETFACL); LASSERTF(OBD_MD_FLRMTRGETFACL == (0x0008000000000000ULL), "found 0x%.16llxULL\n", OBD_MD_FLRMTRGETFACL); + LASSERTF(OBD_MD_FLDATAVERSION == (0x0010000000000000ULL), "found 0x%.16llxULL\n", + OBD_MD_FLDATAVERSION); CLASSERT(OBD_FL_INLINEDATA == 0x00000001); CLASSERT(OBD_FL_OBDMDEXISTS == 0x00000002); CLASSERT(OBD_FL_DELORPHAN == 0x00000004);