[PATCH 08/28] lustre: ec: add necessary structure member for EC file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Bobi Jam <bobijam@xxxxxxxxxxxxx>

Added basic structure members for erasure-coding layout.

WC-bug-id: https://jira.whamcloud.com/browse/LU-12186
Lustre-commit: 4c4790088995fa690 ("LU-12186 ec: add necessary structure member for EC file")
Signed-off-by: Bobi Jam <bobijam@xxxxxxxxxxxxx>
Reviewed-on: https://review.whamcloud.com/38319
Reviewed-by: James Simmons <jsimmons@xxxxxxxxxxxxx>
Reviewed-by: Bobi Jam <bobijam@xxxxxxxxxxx>
Reviewed-by: Oleg Drokin <green@xxxxxxxxxxxxx>
Signed-off-by: James Simmons <jsimmons@xxxxxxxxxxxxx>
---
 fs/lustre/ptlrpc/pack_generic.c         |  4 ++++
 fs/lustre/ptlrpc/wiretest.c             | 24 ++++++++++++++++++++----
 include/uapi/linux/lustre/lustre_user.h | 20 +++++++++++++++++---
 3 files changed, 41 insertions(+), 7 deletions(-)

diff --git a/fs/lustre/ptlrpc/pack_generic.c b/fs/lustre/ptlrpc/pack_generic.c
index f075188e..9acea24 100644
--- a/fs/lustre/ptlrpc/pack_generic.c
+++ b/fs/lustre/ptlrpc/pack_generic.c
@@ -2129,8 +2129,10 @@ void lustre_swab_lov_comp_md_v1(struct lov_comp_md_v1 *lum)
 	__swab16s(&lum->lcm_flags);
 	__swab16s(&lum->lcm_entry_count);
 	__swab16s(&lum->lcm_mirror_count);
+	/* no need to swab lcm_ec_count */
 	BUILD_BUG_ON(offsetof(typeof(*lum), lcm_padding1) == 0);
 	BUILD_BUG_ON(offsetof(typeof(*lum), lcm_padding2) == 0);
+	BUILD_BUG_ON(offsetof(typeof(*lum), lcm_padding3) == 0);
 
 	for (i = 0; i < ent_count; i++) {
 		struct lov_user_md_v1 *v1;
@@ -2153,6 +2155,8 @@ void lustre_swab_lov_comp_md_v1(struct lov_comp_md_v1 *lum)
 		__swab32s(&ent->lcme_offset);
 		__swab32s(&ent->lcme_size);
 		__swab32s(&ent->lcme_layout_gen);
+		/* no need to swab lcme_dstripe_count */
+		/* no need to swab lcme_cstripe_count */
 		BUILD_BUG_ON(offsetof(typeof(*ent), lcme_padding_1) == 0);
 
 		v1 = (struct lov_user_md_v1 *)((char *)lum + off);
diff --git a/fs/lustre/ptlrpc/wiretest.c b/fs/lustre/ptlrpc/wiretest.c
index 687a54d..81e0485 100644
--- a/fs/lustre/ptlrpc/wiretest.c
+++ b/fs/lustre/ptlrpc/wiretest.c
@@ -1654,9 +1654,17 @@ void lustre_assert_wire_constants(void)
 		 (long long)(int)offsetof(struct lov_comp_md_entry_v1, lcme_timestamp));
 	LASSERTF((int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_timestamp) == 8, "found %lld\n",
 		 (long long)(int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_timestamp));
-	LASSERTF((int)offsetof(struct lov_comp_md_entry_v1, lcme_padding_1) == 44, "found %lld\n",
+	LASSERTF((int)offsetof(struct lov_comp_md_entry_v1, lcme_dstripe_count) == 44, "found %lld\n",
+		 (long long)(int)offsetof(struct lov_comp_md_entry_v1, lcme_dstripe_count));
+	LASSERTF((int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_dstripe_count) == 1, "found %lld\n",
+		 (long long)(int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_dstripe_count));
+	LASSERTF((int)offsetof(struct lov_comp_md_entry_v1, lcme_cstripe_count) == 45, "found %lld\n",
+		 (long long)(int)offsetof(struct lov_comp_md_entry_v1, lcme_cstripe_count));
+	LASSERTF((int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_cstripe_count) == 1, "found %lld\n",
+		 (long long)(int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_cstripe_count));
+	LASSERTF((int)offsetof(struct lov_comp_md_entry_v1, lcme_padding_1) == 46, "found %lld\n",
 		 (long long)(int)offsetof(struct lov_comp_md_entry_v1, lcme_padding_1));
-	LASSERTF((int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_padding_1) == 4, "found %lld\n",
+	LASSERTF((int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_padding_1) == 2, "found %lld\n",
 		 (long long)(int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_padding_1));
 	BUILD_BUG_ON(LCME_FL_STALE != 0x00000001);
 	BUILD_BUG_ON(LCME_FL_PREF_RD != 0x00000002);
@@ -1695,9 +1703,17 @@ void lustre_assert_wire_constants(void)
 		 (long long)(int)offsetof(struct lov_comp_md_v1, lcm_mirror_count));
 	LASSERTF((int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_mirror_count) == 2, "found %lld\n",
 		 (long long)(int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_mirror_count));
-	LASSERTF((int)offsetof(struct lov_comp_md_v1, lcm_padding1) == 18, "found %lld\n",
+	LASSERTF((int)offsetof(struct lov_comp_md_v1, lcm_ec_count) == 18, "found %lld\n",
+		 (long long)(int)offsetof(struct lov_comp_md_v1, lcm_ec_count));
+	LASSERTF((int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_ec_count) == 1, "found %lld\n",
+		 (long long)(int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_ec_count));
+	LASSERTF((int)offsetof(struct lov_comp_md_v1, lcm_padding3) == 19, "found %lld\n",
+		 (long long)(int)offsetof(struct lov_comp_md_v1, lcm_padding3));
+	LASSERTF((int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_padding3) == 1, "found %lld\n",
+		 (long long)(int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_padding3));
+	LASSERTF((int)offsetof(struct lov_comp_md_v1, lcm_padding1) == 20, "found %lld\n",
 		 (long long)(int)offsetof(struct lov_comp_md_v1, lcm_padding1));
-	LASSERTF((int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_padding1) == 6, "found %lld\n",
+	LASSERTF((int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_padding1) == 4, "found %lld\n",
 		 (long long)(int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_padding1));
 	LASSERTF((int)offsetof(struct lov_comp_md_v1, lcm_padding2) == 24, "found %lld\n",
 		 (long long)(int)offsetof(struct lov_comp_md_v1, lcm_padding2));
diff --git a/include/uapi/linux/lustre/lustre_user.h b/include/uapi/linux/lustre/lustre_user.h
index fa01c28..ee789f2 100644
--- a/include/uapi/linux/lustre/lustre_user.h
+++ b/include/uapi/linux/lustre/lustre_user.h
@@ -564,6 +564,7 @@ enum lov_comp_md_entry_flags {
 	LCME_FL_INIT		= 0x00000010,	/* instantiated */
 	LCME_FL_NOSYNC		= 0x00000020,	/* FLR: no sync for the mirror */
 	LCME_FL_EXTENSION	= 0x00000040,	/* extension comp, never init */
+	LCME_FL_PARITY		= 0x00000080,	/* EC: a parity code component */
 	LCME_FL_NEG		= 0x80000000,	/* used to indicate a negative
 						 * flag, won't be stored on disk
 						 */
@@ -596,14 +597,24 @@ enum lcme_id {
 struct lov_comp_md_entry_v1 {
 	__u32			lcme_id;	/* unique id of component */
 	__u32			lcme_flags;	/* LCME_FL_XXX */
-	struct lu_extent	lcme_extent;	/* file extent for component */
+	/* file extent for component. If it's an EC code component, its flags
+	 * contains LCME_FL_PARITY, and its extent covers the same extent of
+	 * its corresponding data component.
+	 */
+	struct lu_extent	lcme_extent;
 	__u32			lcme_offset;	/* offset of component blob,
 						 * start from lov_comp_md_v1
 						 */
 	__u32			lcme_size;	/* size of component blob */
 	__u32			lcme_layout_gen;
 	__u64			lcme_timestamp;	/* snapshot time if applicable*/
-	__u32			lcme_padding_1;
+	__u8			lcme_dstripe_count;	/* data stripe count,
+							 * k value in EC
+							 */
+	__u8			lcme_cstripe_count;	/* code stripe count,
+							 * p value in EC
+							 */
+	__u16			lcme_padding_1;
 } __attribute__((packed));
 
 #define SEQ_ID_MAX		0x0000FFFF
@@ -645,7 +656,10 @@ struct lov_comp_md_v1 {
 	 * so that non-flr files will have value 0 meaning 1 mirror.
 	 */
 	__u16	lcm_mirror_count;
-	__u16	lcm_padding1[3];
+	/* code components count, non-EC file contains 0 ec_count */
+	__u8	lcm_ec_count;
+	__u8	lcm_padding3[1];
+	__u16	lcm_padding1[2];
 	__u64	lcm_padding2;
 	struct lov_comp_md_entry_v1 lcm_entries[0];
 } __attribute__((packed));
-- 
1.8.3.1




[Index of Archives]     [linux Cryptography]     [Asterisk App Development]     [PJ SIP]     [Gnu Gatekeeper]     [IETF Sipping]     [Info Cyrus]     [ALSA User]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite News]     [Deep Creek Hot Springs]     [Yosemite Campsites]     [ISDN Cause Codes]

  Powered by Linux