linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pawel Baldysiak <pawel.baldysiak@intel.com>
To: jes.sorensen@gmail.com
Cc: linux-raid@vger.kernel.org,
	Pawel Baldysiak <pawel.baldysiak@intel.com>,
	Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Subject: [PATCH 03/12] imsm: Add support for multiple ppls
Date: Thu, 28 Sep 2017 14:41:09 +0200	[thread overview]
Message-ID: <20170928124118.23361-4-pawel.baldysiak@intel.com> (raw)
In-Reply-To: <20170928124118.23361-1-pawel.baldysiak@intel.com>

Add interpreting new rwh_policy bits. Set PPL size as 1MB.
If new array with ppl is created - use new implementation of ppl by
default.

Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
---
 super-intel.c | 37 +++++++++++++++++++++++++++----------
 1 file changed, 27 insertions(+), 10 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index 2f378dea..21eb048a 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -92,6 +92,9 @@
 #define NUM_BLOCKS_DIRTY_STRIPE_REGION 2056
 #define SECT_PER_MB_SHIFT 11
 #define MAX_SECTOR_SIZE 4096
+#define MULTIPLE_PPL_AREA_SIZE_IMSM (1024 * 1024) /* Size of the whole
+						   * mutliple PPL area
+						   */
 
 /* Disk configuration info. */
 #define IMSM_MAX_DEVICES 255
@@ -207,6 +210,9 @@ struct imsm_dev {
 #define RWH_OFF 0
 #define RWH_DISTRIBUTED 1
 #define RWH_JOURNALING_DRIVE 2
+#define RWH_MULTIPLE_DISTRIBUTED 3
+#define RWH_MULTIPLE_PPLS_JOURNALING_DRIVE 4
+#define RWH_MULTIPLE_OFF 5
 	__u8  rwh_policy; /* Raid Write Hole Policy */
 	__u8  jd_serial[MAX_RAID_SERIAL_LEN]; /* Journal Drive serial number */
 	__u8  filler1;
@@ -284,7 +290,7 @@ static char *map_state_str[] = { "normal", "uninitialized", "degraded", "failed"
 				 *  already been migrated and must
 				 *  be recovered from checkpoint area */
 
-#define PPL_ENTRY_SPACE (128 * 1024) /* Size of the PPL, without the header */
+#define PPL_ENTRY_SPACE (128 * 1024) /* Size of single PPL, without the header */
 
 struct migr_record {
 	__u32 rec_status;	    /* Status used to determine how to restart
@@ -1539,12 +1545,16 @@ static void print_imsm_dev(struct intel_super *super,
 	printf("    Dirty State : %s\n", (dev->vol.dirty & RAIDVOL_DIRTY) ?
 					 "dirty" : "clean");
 	printf("     RWH Policy : ");
-	if (dev->rwh_policy == RWH_OFF)
+	if (dev->rwh_policy == RWH_OFF || dev->rwh_policy == RWH_MULTIPLE_OFF)
 		printf("off\n");
 	else if (dev->rwh_policy == RWH_DISTRIBUTED)
 		printf("PPL distributed\n");
 	else if (dev->rwh_policy == RWH_JOURNALING_DRIVE)
 		printf("PPL journaling drive\n");
+	else if (dev->rwh_policy == RWH_MULTIPLE_DISTRIBUTED)
+		printf("Multiple distributed PPLs\n");
+	else if (dev->rwh_policy == RWH_MULTIPLE_PPLS_JOURNALING_DRIVE)
+		printf("Multiple PPLs on journaling drive\n");
 	else
 		printf("<unknown:%d>\n", dev->rwh_policy);
 }
@@ -3294,10 +3304,16 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
 	memset(info->uuid, 0, sizeof(info->uuid));
 	info->recovery_start = MaxSector;
 
-	if (info->array.level == 5 && dev->rwh_policy == RWH_DISTRIBUTED) {
+	if (info->array.level == 5 &&
+	    (dev->rwh_policy == RWH_DISTRIBUTED ||
+	     dev->rwh_policy == RWH_MULTIPLE_DISTRIBUTED)) {
 		info->consistency_policy = CONSISTENCY_POLICY_PPL;
 		info->ppl_sector = get_ppl_sector(super, super->current_vol);
-		info->ppl_size = (PPL_HEADER_SIZE + PPL_ENTRY_SPACE) >> 9;
+		if (dev->rwh_policy == RWH_MULTIPLE_DISTRIBUTED)
+			info->ppl_size = MULTIPLE_PPL_AREA_SIZE_IMSM >> 9;
+		else
+			info->ppl_size = (PPL_HEADER_SIZE + PPL_ENTRY_SPACE)
+					  >> 9;
 	} else if (info->array.level <= 0) {
 		info->consistency_policy = CONSISTENCY_POLICY_NONE;
 	} else {
@@ -5390,9 +5406,9 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
 	dev->my_vol_raid_dev_num = mpb->num_raid_devs_created;
 
 	if (s->consistency_policy <= CONSISTENCY_POLICY_RESYNC) {
-		dev->rwh_policy = RWH_OFF;
+		dev->rwh_policy = RWH_MULTIPLE_OFF;
 	} else if (s->consistency_policy == CONSISTENCY_POLICY_PPL) {
-		dev->rwh_policy = RWH_DISTRIBUTED;
+		dev->rwh_policy = RWH_MULTIPLE_DISTRIBUTED;
 	} else {
 		free(dev);
 		free(dv);
@@ -7403,9 +7419,9 @@ static int update_subarray_imsm(struct supertype *st, char *subarray,
 			return 2;
 
 		if (strcmp(update, "ppl") == 0)
-			new_policy = RWH_DISTRIBUTED;
+			new_policy = RWH_MULTIPLE_DISTRIBUTED;
 		else
-			new_policy = RWH_OFF;
+			new_policy = RWH_MULTIPLE_OFF;
 
 		if (st->update_tail) {
 			struct imsm_update_rwh_policy *u = xmalloc(sizeof(*u));
@@ -8205,7 +8221,8 @@ skip_mark_checkpoint:
 			dev->vol.dirty = RAIDVOL_CLEAN;
 		} else {
 			dev->vol.dirty = RAIDVOL_DIRTY;
-			if (dev->rwh_policy == RWH_DISTRIBUTED)
+			if (dev->rwh_policy == RWH_DISTRIBUTED ||
+			    dev->rwh_policy == RWH_MULTIPLE_DISTRIBUTED)
 				dev->vol.dirty |= RAIDVOL_DSRECORD_VALID;
 		}
 		super->updates_pending++;
@@ -8759,7 +8776,7 @@ static struct mdinfo *imsm_activate_spare(struct active_array *a,
 		di->bb.supported = 1;
 		if (a->info.consistency_policy == CONSISTENCY_POLICY_PPL) {
 			di->ppl_sector = get_ppl_sector(super, inst);
-			di->ppl_size = (PPL_HEADER_SIZE + PPL_ENTRY_SPACE) >> 9;
+			di->ppl_size = MULTIPLE_PPL_AREA_SIZE_IMSM >> 9;
 		}
 		super->random = random32();
 		di->next = rv;
-- 
2.13.5


  parent reply	other threads:[~2017-09-28 12:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-28 12:41 [PATCH 00/12] Multiple PPL support and PPL bugfixes Pawel Baldysiak
2017-09-28 12:41 ` [PATCH 01/12] Don't abort starting the array if kernel does not support ppl Pawel Baldysiak
2017-09-28 12:41 ` [PATCH 02/12] super1: Add support for multiple-ppls Pawel Baldysiak
2017-09-28 12:41 ` Pawel Baldysiak [this message]
2017-09-28 12:41 ` [PATCH 04/12] imsm: validate multiple ppls during assemble Pawel Baldysiak
2017-09-28 12:41 ` [PATCH 05/12] Zeroout whole ppl space during creation/force assemble Pawel Baldysiak
2017-09-28 12:41 ` [PATCH 06/12] imsm: switch to multiple ppls automatically during assemble Pawel Baldysiak
2017-09-28 12:41 ` [PATCH 07/12] Grow: fix switching on PPL during recovery Pawel Baldysiak
2017-09-28 12:41 ` [PATCH 08/12] imsm: don't skip resync when an invalid ppl header is found Pawel Baldysiak
2017-09-28 12:41 ` [PATCH 09/12] imsm: Write empty PPL header if assembling regular clean array Pawel Baldysiak
2017-09-28 12:41 ` [PATCH 10/12] imsm: always do ppl recovery when starting a rebuilding array Pawel Baldysiak
2017-09-28 12:41 ` [PATCH 11/12] imsm: use correct map when validating ppl Pawel Baldysiak
2017-09-28 12:41 ` [PATCH 12/12] imsm: write initial ppl on a disk added for rebuild Pawel Baldysiak
2017-10-02 20:16 ` [PATCH 00/12] Multiple PPL support and PPL bugfixes Jes Sorensen

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=20170928124118.23361-4-pawel.baldysiak@intel.com \
    --to=pawel.baldysiak@intel.com \
    --cc=artur.paszkiewicz@intel.com \
    --cc=jes.sorensen@gmail.com \
    --cc=linux-raid@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).