All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Simmons <jsimmons@infradead.org>
To: lustre-devel@lists.lustre.org
Subject: [lustre-devel] [PATCH v2 08/33] lustre: lov: embedded raid0 in struct lov_layout_composite
Date: Sun,  6 Jan 2019 17:14:03 -0500	[thread overview]
Message-ID: <1546812868-11794-9-git-send-email-jsimmons@infradead.org> (raw)
In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org>

From: Bobi Jam <bobijam@hotmail.com>

Create bare bones struct lov_layout_composite that
Make client layer support composite layout.

Plain layout will be stored in LOV layer as a composite layout
containing a single component.

Signed-off-by: Jinshan Xiong <jinshan.xiong@gmail.com>
Signed-off-by: Bobi Jam <bobijam@hotmail.com>
Signed-off-by: Niu Yawei <yawei.niu@intel.com>
WC-bug-id: https://jira.whamcloud.com/browse/LU-8998
Reviewed-on: https://review.whamcloud.com/24850
Reviewed-by: Lai Siyao <lai.siyao@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../staging/lustre/lustre/lov/lov_cl_internal.h    | 78 ++++++++++++----------
 drivers/staging/lustre/lustre/lov/lov_object.c     |  8 +--
 drivers/staging/lustre/lustre/lov/lovsub_object.c  |  8 +--
 3 files changed, 50 insertions(+), 44 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h
index e4f7621..c6ace49 100644
--- a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h
+++ b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h
@@ -129,6 +129,42 @@ static inline char *llt2str(enum lov_layout_type llt)
 	return "";
 }
 
+struct lov_layout_raid0 {
+	unsigned int		lo_nr;
+	/**
+	 * When this is true, lov_object::lo_attr contains
+	 * valid up to date attributes for a top-level
+	 * object. This field is reset to 0 when attributes of
+	 * any sub-object change.
+	 */
+	int			lo_attr_valid;
+	/**
+	 * Array of sub-objects. Allocated when top-object is
+	 * created (lov_init_raid0()).
+	 *
+	 * Top-object is a strict master of its sub-objects:
+	 * it is created before them, and outlives its
+	 * children (this later is necessary so that basic
+	 * functions like cl_object_top() always
+	 * work). Top-object keeps a reference on every
+	 * sub-object.
+	 *
+	 * When top-object is destroyed (lov_delete_raid0())
+	 * it releases its reference to a sub-object and waits
+	 * until the latter is finally destroyed.
+	 */
+	struct lovsub_object  **lo_sub;
+	/**
+	 * protect lo_sub
+	 */
+	spinlock_t		lo_sub_lock;
+	/**
+	 * Cached object attribute, built from sub-object
+	 * attributes.
+	 */
+	struct cl_attr		lo_attr;
+};
+
 /**
  * lov-specific file state.
  *
@@ -178,45 +214,15 @@ struct lov_object {
 	struct lov_stripe_md  *lo_lsm;
 
 	union lov_layout_state {
-		struct lov_layout_raid0 {
-			unsigned int	       lo_nr;
-			/**
-			 * When this is true, lov_object::lo_attr contains
-			 * valid up to date attributes for a top-level
-			 * object. This field is reset to 0 when attributes of
-			 * any sub-object change.
-			 */
-			int		       lo_attr_valid;
-			/**
-			 * Array of sub-objects. Allocated when top-object is
-			 * created (lov_init_raid0()).
-			 *
-			 * Top-object is a strict master of its sub-objects:
-			 * it is created before them, and outlives its
-			 * children (this later is necessary so that basic
-			 * functions like cl_object_top() always
-			 * work). Top-object keeps a reference on every
-			 * sub-object.
-			 *
-			 * When top-object is destroyed (lov_delete_raid0())
-			 * it releases its reference to a sub-object and waits
-			 * until the latter is finally destroyed.
-			 */
-			struct lovsub_object **lo_sub;
-			/**
-			 * protect lo_sub
-			 */
-			spinlock_t		lo_sub_lock;
-			/**
-			 * Cached object attribute, built from sub-object
-			 * attributes.
-			 */
-			struct cl_attr	 lo_attr;
-		} raid0;
 		struct lov_layout_state_empty {
 		} empty;
 		struct lov_layout_state_released {
 		} released;
+		struct lov_layout_composite {
+			struct lov_layout_entry {
+				struct lov_layout_raid0 lle_raid0;
+			} lo_entries;
+		} composite;
 	} u;
 	/**
 	 * Thread that acquired lov_object::lo_type_guard in an exclusive
@@ -627,7 +633,7 @@ static inline struct lov_layout_raid0 *lov_r0(struct lov_object *lov)
 	LASSERT(lov->lo_type == LLT_RAID0);
 	LASSERT(lov->lo_lsm->lsm_magic == LOV_MAGIC ||
 		lov->lo_lsm->lsm_magic == LOV_MAGIC_V3);
-	return &lov->u.raid0;
+	return &lov->u.composite.lo_entries.lle_raid0;
 }
 
 /* lov_pack.c */
diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c
index ad2901a..15ed378 100644
--- a/drivers/staging/lustre/lustre/lov/lov_object.c
+++ b/drivers/staging/lustre/lustre/lov/lov_object.c
@@ -228,7 +228,7 @@ static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev,
 	struct lov_thread_info  *lti     = lov_env_info(env);
 	struct cl_object_conf   *subconf = &lti->lti_stripe_conf;
 	struct lu_fid	   *ofid    = &lti->lti_fid;
-	struct lov_layout_raid0 *r0      = &state->raid0;
+	struct lov_layout_raid0 *r0 = &state->composite.lo_entries.lle_raid0;
 
 	if (lsm->lsm_magic != LOV_MAGIC_V1 && lsm->lsm_magic != LOV_MAGIC_V3) {
 		dump_lsm(D_ERROR, lsm);
@@ -375,7 +375,7 @@ static void lov_subobject_kill(const struct lu_env *env, struct lov_object *lov,
 	wait_queue_head_t *wq;
 	wait_queue_entry_t	  *waiter;
 
-	r0  = &lov->u.raid0;
+	r0  = &lov->u.composite.lo_entries.lle_raid0;
 	LASSERT(r0->lo_sub[idx] == los);
 
 	sub  = lovsub2cl(los);
@@ -418,7 +418,7 @@ static void lov_subobject_kill(const struct lu_env *env, struct lov_object *lov,
 static int lov_delete_raid0(const struct lu_env *env, struct lov_object *lov,
 			    union lov_layout_state *state)
 {
-	struct lov_layout_raid0 *r0 = &state->raid0;
+	struct lov_layout_raid0 *r0 = &state->composite.lo_entries.lle_raid0;
 	struct lov_stripe_md    *lsm = lov->lo_lsm;
 	int i;
 
@@ -451,7 +451,7 @@ static void lov_fini_empty(const struct lu_env *env, struct lov_object *lov,
 static void lov_fini_raid0(const struct lu_env *env, struct lov_object *lov,
 			   union lov_layout_state *state)
 {
-	struct lov_layout_raid0 *r0 = &state->raid0;
+	struct lov_layout_raid0 *r0 = &state->composite.lo_entries.lle_raid0;
 
 	if (r0->lo_sub) {
 		kvfree(r0->lo_sub);
diff --git a/drivers/staging/lustre/lustre/lov/lovsub_object.c b/drivers/staging/lustre/lustre/lov/lovsub_object.c
index 13d4520..7360c16 100644
--- a/drivers/staging/lustre/lustre/lov/lovsub_object.c
+++ b/drivers/staging/lustre/lustre/lov/lovsub_object.c
@@ -80,10 +80,10 @@ static void lovsub_object_free(const struct lu_env *env, struct lu_object *obj)
 	 */
 	if (lov) {
 		LASSERT(lov->lo_type == LLT_RAID0);
-		LASSERT(lov->u.raid0.lo_sub[los->lso_index] == los);
-		spin_lock(&lov->u.raid0.lo_sub_lock);
-		lov->u.raid0.lo_sub[los->lso_index] = NULL;
-		spin_unlock(&lov->u.raid0.lo_sub_lock);
+		LASSERT(lov->u.composite.lo_entries.lle_raid0.lo_sub[los->lso_index] == los);
+		spin_lock(&lov->u.composite.lo_entries.lle_raid0.lo_sub_lock);
+		lov->u.composite.lo_entries.lle_raid0.lo_sub[los->lso_index] = NULL;
+		spin_unlock(&lov->u.composite.lo_entries.lle_raid0.lo_sub_lock);
 	}
 
 	lu_object_fini(obj);
-- 
1.8.3.1

  parent reply	other threads:[~2019-01-06 22:14 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-06 22:13 [lustre-devel] [PATCH v2 00/33] lustre: add PFL support James Simmons
2019-01-06 22:13 ` [lustre-devel] [PATCH v2 01/33] lustre: clio: fix incorrect invariant in cl_io_iter_fini() James Simmons
2019-01-06 22:13 ` [lustre-devel] [PATCH v2 02/33] lustre: pfl: Basic data structures for composite layout James Simmons
2019-01-06 22:13 ` [lustre-devel] [PATCH v2 03/33] lustre: lov: move code for PFL work James Simmons
2019-01-06 22:13 ` [lustre-devel] [PATCH v2 04/33] lustre: lov: merge lov_mds_md_v3 and lov_mds_md_v1 handling James Simmons
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 05/33] lustre: lov: fold lmm_verify() handling into lmm_unpackmd() James Simmons
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 06/33] lustre: lov: create struct lov_stripe_md_entry James Simmons
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 07/33] lustre: lov: add composite layout unpacking James Simmons
2019-01-06 22:14 ` James Simmons [this message]
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 09/33] lustre: lov: migrate lov raid0 to future PFL component handling James Simmons
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 10/33] lustre: lov: reduce code indentation James Simmons
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 11/33] lustre: lov: change lo_entries to array James Simmons
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 12/33] lustre: lov: move around PFL code and cleanups James Simmons
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 13/33] lustre: lov: remove lsm_stripe_by_[index|offset]_plain James Simmons
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 14/33] lustre: lov: add looping lsm_entry_count times James Simmons
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 15/33] lustre: lov: create lov_comp_* wrappers James Simmons
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 16/33] lustre: clio: client side implementation for PFL James Simmons
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 17/33] lustre: clio: getstripe support comp layout James Simmons
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 18/33] lustre: pfl: enhance PFID EA for PFL James Simmons
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 19/33] lustre: pfl: dynamic layout modification with write/truncate James Simmons
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 20/33] lustre: ldlm: Transfer layout only if layout lock is granted James Simmons
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 21/33] lustre: pfl: calculate PFL file LOVEA correctly James Simmons
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 22/33] lustre: lov: keep minimum LOVEA size James Simmons
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 23/33] lustre: pfl: Read should not trigger layout write intent James Simmons
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 24/33] lustre: pfl: fix hang with grouplocks James Simmons
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 25/33] lustre: pfl: fix ost pool op->size handling James Simmons
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 26/33] lustre: lov: readahead shouldn't exceed component boundary James Simmons
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 27/33] lustre: uapi: support negative flags James Simmons
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 28/33] lustre: llite: return v1/v3 layout for legacy app James Simmons
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 29/33] lustre: llite: restore ll_file_getstripe in ll_lov_setstripe James Simmons
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 30/33] lustre: lov: do not split IO for single striped file James Simmons
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 31/33] lustre: lov: call cl_object_attr_get under cl_attr lock James Simmons
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 32/33] lustre: lov: use stripe_count instead of stripe_nr James Simmons
2019-01-06 22:14 ` [lustre-devel] [PATCH v2 33/33] lustre: update version to 2.9.99 James Simmons
2019-01-08  1:38   ` NeilBrown
2019-01-08  4:26     ` James Simmons
2019-01-08 10:13       ` Andreas Dilger
2019-01-08 21:47         ` James Simmons
2019-01-09  0:15           ` Andreas Dilger
2019-01-09 18:28             ` James Simmons
2019-01-09 23:16               ` Andreas Dilger
2019-01-10  1:36                 ` NeilBrown
2019-01-10  9:10                   ` Andreas Dilger
2019-01-10  1:46           ` NeilBrown
2019-01-10  7:41             ` Andreas Dilger
2019-01-10  0:40         ` NeilBrown
2019-01-10  7:28           ` Andreas Dilger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1546812868-11794-9-git-send-email-jsimmons@infradead.org \
    --to=jsimmons@infradead.org \
    --cc=lustre-devel@lists.lustre.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.