[Dmraid-debian-commits] [SCM] Maintenance of the dmraid package branch, master, updated. debian/1.0.0.rc15-11-8-gf2b47d1

Giuseppe Iuculano iuculano at debian.org
Sun Nov 1 17:30:53 UTC 2009


The following commit has been merged in the master branch:
commit f2b47d175159041d8e567b8ee8b6abdb68ca7fa0
Author: Giuseppe Iuculano <iuculano at debian.org>
Date:   Sun Nov 1 18:30:13 2009 +0100

    Refreshed patches and deleted patches merged in upstream

diff --git a/1.0.0.rc16/lib/activate/activate.c.orig b/1.0.0.rc16/lib/activate/activate.c.orig
deleted file mode 100644
index 64f58c3..0000000
--- a/1.0.0.rc16/lib/activate/activate.c.orig
+++ /dev/null
@@ -1,1122 +0,0 @@
-/*
- * Copyright (C) 2004-2008  Heinz Mauelshagen, Red Hat GmbH.
- *                          All rights reserved.
- *
- * Copyright (C) 2007,2009   Intel Corporation. All rights reserved.
- * November, 2007 - additions for Create, Delete, Rebuild & Raid 10.
- * March, 2008 - additions for hot-spare check
- * August, 2008 - check before Activation
- * January, 2009 - additions for Activation, Rebuild check
- * April, 2009 - automatic un/registration added
- * April, 2009 -Activation array in degraded state added
- * May, 2009 - fix for wrong error_target place in device-mapper table
- * 
- * See file LICENSE at the top of this source tree for license information.
- */
-
-/*
- * Activate/Deactivate code for hierarchical RAID Sets.
- */
-
-#include "internal.h"
-#include "devmapper.h"
-
-static int
-valid_rd(struct raid_dev *rd)
-{
-	return (S_OK(rd->status) || S_INCONSISTENT(rd->status) ||
-		S_NOSYNC(rd->status)) && !T_SPARE(rd);
-}
-
-static int
-valid_rs(struct raid_set *rs)
-{
-	return (S_OK(rs->status) || S_INCONSISTENT(rs->status)||
-		S_NOSYNC(rs->status)) && !T_SPARE(rs);
-}
-
-/* Return rounded size in case of unbalanced mappings */
-static uint64_t
-maximize(struct raid_set *rs, uint64_t sectors, uint64_t last, uint64_t min)
-{
-	return sectors > min ? min(last, sectors) : last;
-}
-
-/* Find biggest device */
-static uint64_t
-_biggest(struct raid_set *rs)
-{
-	uint64_t ret = 0;
-	struct raid_dev *rd;
-
-	list_for_each_entry(rd, &rs->devs, devs) {
-		if (!T_SPARE(rd) && rd->sectors > ret)
-                	ret = rd->sectors;
-	}
-
-	return ret;
-}
-
-/* Find smallest set/disk larger than given minimum. */
-static uint64_t
-_smallest(struct lib_context *lc, struct raid_set *rs, uint64_t min)
-{
-	uint64_t ret = ~0;
-	struct raid_set *r;
-	struct raid_dev *rd;
-
-	list_for_each_entry(r, &rs->sets, list)
-		ret = maximize(r, total_sectors(lc, r), ret, min);
-
-	list_for_each_entry(rd, &rs->devs, devs) {
-		if (!T_SPARE(rd))
-			ret = maximize(rs, rd->sectors, ret, min);
-	}
-
-	return ret == (uint64_t) ~0 ? 0 : ret;
-}
-
-/*
- * Definitions of mappings.
- */
-
-/* Undefined/-supported mapping. */
-static int
-_dm_un(struct lib_context *lc, char **table,
-       struct raid_set *rs, const char *what)
-{
-	LOG_ERR(lc, 0, "Un%sed RAID type %s[%u] on %s", what,
-		get_set_type(lc, rs), rs->type, rs->name);
-}
-
-static int
-dm_undef(struct lib_context *lc, char **table, struct raid_set *rs)
-{
-	return _dm_un(lc, table, rs, "defin");
-}
-
-static int
-dm_unsup(struct lib_context *lc, char **table, struct raid_set *rs)
-{
-	return _dm_un(lc, table, rs, "support");
-}
-
-
-/* "Spare mapping". */
-static int
-dm_spare(struct lib_context *lc, char **table, struct raid_set *rs)
-{
-	LOG_ERR(lc, 0, "spare set \"%s\" cannot be activated", rs->name);
-}
-
-/* Push path and offset onto a table. */
-static int
-_dm_path_offset(struct lib_context *lc, char **table,
-		int valid, const char *path, uint64_t offset)
-{
-	return p_fmt(lc, table, " %s %U",
-		     valid ? path : lc->path.error, offset);
-}
-
-/*
- * Create dm table for linear mapping.
- */
-static int
-_dm_linear(struct lib_context *lc, char **table, int valid,
-	   const char *path, uint64_t start, uint64_t sectors, uint64_t offset)
-{
-	return p_fmt(lc, table, "%U %U %s", start, sectors,
-		     get_dm_type(lc, t_linear)) ?
-		_dm_path_offset(lc, table, valid, path, offset) : 0;
-}
-
-static int
-dm_linear(struct lib_context *lc, char **table, struct raid_set *rs)
-{
-	unsigned int segments = 0;
-	uint64_t start = 0, sectors = 0;
-	struct raid_dev *rd;
-	struct raid_set *r;
-
-	/* Stacked linear sets. */
-	list_for_each_entry(r, &rs->sets, list) {
-		if (!T_SPARE(r)) {
-			int ret;
-			char *path;
-
-			if (!(path = mkdm_path(lc, r->name)))
-				goto err;
-
-			sectors = total_sectors(lc, r);
-			ret = _dm_linear(lc, table, valid_rs(r), path,
-					 start, sectors, 0);
-			dbg_free(path);
-			segments++;
-			start += sectors;
-
-			if (!ret ||
-			    (r->sets.next != &rs->sets &&
-			     !p_fmt(lc, table, "\n")))
-				goto err;
-		}
-	}
-
-	/* Devices of a linear set. */
-	list_for_each_entry(rd, &rs->devs, devs) {
-		if (!T_SPARE(rd)) {
-			if (!_dm_linear
-			    (lc, table, valid_rd(rd), rd->di->path, start,
-			     rd->sectors, rd->offset))
-				goto err;
-
-			segments++;
-			start += rd->sectors;
-
-			if (rd->devs.next != &rs->devs &&
-			    !p_fmt(lc, table, "\n"))
-				goto err;
-		}
-	}
-
-	return segments ? 1 : 0;
-
-      err:
-	return log_alloc_err(lc, __func__);
-}
-
-/*
- * Create dm table for a partition mapping.
- *
- * Partitioned RAID set with 1 RAID device
- * defining a linear partition mapping.
- */
-static int
-dm_partition(struct lib_context *lc, char **table, struct raid_set *rs)
-{
-	return dm_linear(lc, table, rs);
-}
-
-/*
- * Create dm table for striped mapping taking
- * different disk sizes and the stride size into acccount.
- *
- * If metadata format handler requests a maximized mapping,
- * more than one mapping table record will be created and
- * stride boundaries will get paid attention to.
- *
- * Eg, 3 disks of 80, 100, 120 GB capacity:
- *
- * 0     240GB striped /dev/sda 0 /dev/sdb 0 /dev/sdc 0 
- * 240GB 40GB  striped /dev/sdb 80GB /dev/sdc 80GB
- * 280GB 20GB  linear /dev/sdc 100GB
- *
- */
-/* Push begin of line onto a RAID0 table. */
-static int
-_dm_raid0_bol(struct lib_context *lc, char **table,
-	      uint64_t min, uint64_t last_min,
-	      unsigned int n, unsigned int stride)
-{
-	return p_fmt(lc, table,
-		     n > 1 ? "%U %U %s %u %u" : "%U %U %s",
-		     last_min * n, (min - last_min) * n,
-		     get_dm_type(lc, n > 1 ? t_raid0 : t_linear), n, stride);
-}
-
-/* Push end of line onto a RAID0 table. */
-static int
-_dm_raid0_eol(struct lib_context *lc,
-	      char **table, struct raid_set *rs,
-	      unsigned int *stripes, uint64_t last_min)
-{
-	struct raid_set *r;
-	struct raid_dev *rd;
-
-	/* Stacked striped sets. */
-	list_for_each_entry(r, &rs->sets, list) {
-		if (total_sectors(lc, r) > last_min) {
-			int ret;
-			char *path;
-
-			if (!(path = mkdm_path(lc, r->name)))
-				goto err;
-
-			ret = _dm_path_offset(lc, table, valid_rs(r),
-					      path, last_min);
-			dbg_free(path);
-
-			if (!ret)
-				goto err;
-
-			(*stripes)++;
-		}
-	}
-
-	list_for_each_entry(rd, &rs->devs, devs) {
-		if (!T_SPARE(rd) &&
-		    rd->sectors > last_min &&
-		    !_dm_path_offset(lc, table, valid_rd(rd), rd->di->path,
-				     rd->offset + last_min))
-			goto err;
-
-		(*stripes)++;
-	}
-
-	return 1;
-
-      err:
-	return 0;
-}
-
-/* Count RAID sets/devices larger than given minimum size. */
-static unsigned int
-_dm_raid_devs(struct lib_context *lc, struct raid_set *rs, uint64_t min)
-{
-	unsigned int ret = 0;
-	struct raid_set *r;
-	struct raid_dev *rd;
-
-	/* Stacked sets. */
-	list_for_each_entry(r, &rs->sets, list) {
-		if (!T_SPARE(r) && total_sectors(lc, r) > min)
-			ret++;
-	}
-
-	list_for_each_entry(rd, &rs->devs, devs) {
-		if (!T_SPARE(rd) && rd->sectors > min)
-			ret++;
-	}
-
-	return ret;
-}
-
-static int
-dm_raid0(struct lib_context *lc, char **table, struct raid_set *rs)
-{
-	unsigned int stripes = 0;
-	uint64_t min, last_min = 0;
-
-	for (; (min = _smallest(lc, rs, last_min)); last_min = min) {
-		if (last_min && !p_fmt(lc, table, "\n"))
-			goto err;
-
-		if (!_dm_raid0_bol(lc, table, round_down(min, rs->stride),
-				   last_min, _dm_raid_devs(lc, rs,
-							   last_min),
-				   rs->stride)
-		    || !_dm_raid0_eol(lc, table, rs, &stripes, last_min))
-			goto err;
-
-		if (!F_MAXIMIZE(rs))
-			break;
-	}
-
-	return stripes ? 1 : 0;
-
-     err:
-	return log_alloc_err(lc, __func__);
-}
-
-/*
- * Create dm table for mirrored mapping.
- */
-
-/* Calculate dirty log region size. */
-static unsigned int
-calc_region_size(struct lib_context *lc, uint64_t sectors)
-{
-	const unsigned int mb_128 = 128 * 2 * 1024;
-	unsigned int max, region_size;
-
-	if ((max = sectors / 1024) > mb_128)
-		max = mb_128;
-
-	for (region_size = 128; region_size < max; region_size <<= 1);
-	return region_size >> 1;
-}
-
-static unsigned int
-get_rds(struct raid_set *rs, int valid)
-{
-	unsigned int ret = 0;
-	struct raid_dev *rd;
-
-	list_for_each_entry(rd, &rs->devs, devs) {
-		if (valid) {
-			if (valid_rd(rd))
-				ret++;
-		} else
-			ret++;
-	}
-
-	return ret;
-}
-
-static unsigned int
-get_dm_devs(struct raid_set *rs, int valid)
-{
-	unsigned int ret = 0;
-	struct raid_set *r;
-
-	/* Stacked mirror sets. */
-	list_for_each_entry(r, &rs->sets, list) {
-		if (valid) {
-			if (valid_rs(r))
-				ret++;
-		} else
-			ret++;
-	}
-
-	return ret + get_rds(rs, valid);
-}
-
-/* Retrieve number of drive to rebuild from metadata format handler. */
-static int
-get_rebuild_drive(struct lib_context *lc, struct raid_set *rs,
-		  struct handler_info *info)
-{
-	/* Initialize drive to rebuild invalid. */
-	info->data.i32 = -1;
-
-	if (lc->options[LC_REBUILD_SET].opt) {
-		struct raid_dev *rd;
-
-		if (list_empty(&rs->devs))
-			LOG_ERR(lc, 0, "RAID set has no devices!");
-
-		rd = list_entry(rs->devs.next, typeof(*rd), devs);
-		if (rd->fmt->metadata_handler) {
-			if (!rd->
-			    fmt->metadata_handler(lc, GET_REBUILD_DRIVE_NO,
-						  info, rs))
-				LOG_ERR(lc, 0, "Can't get rebuild drive #!");
-		} else
-			LOG_ERR(lc, 0,
-				"Can't rebuild w/o metadata_handler for %s",
-				rd->fmt->name);
-	}
-
-	return 1;
-}
-
-/* Return true if RAID set needs rebuilding. */
-static inline int
-rs_need_sync(struct raid_set *rs)
-{
-	return S_INCONSISTENT(rs->status) || S_NOSYNC(rs->status);
-}
-
-
-/* Push begin of line onto a RAID1 table. */
-/* FIXME: persistent dirty log. */
-static int
-_dm_raid1_bol(struct lib_context *lc, char **table,
-	      struct raid_set *rs,
-	      uint64_t sectors, unsigned int mirrors, int need_sync)
-{
-	/*
-	 * Append the flag/feature required for dmraid1
-	 * event handling in the kernel driver here for RHEL5.
-	 * In mainline, dm-raid1 handles it, in RHEL5, it's dm-log.
-	 */
-	return (p_fmt(lc, table, "0 %U %s core 3 %u %s block_on_error %u",
-		      sectors, get_dm_type(lc, t_raid1),
-		      calc_region_size(lc, sectors),
-		      (need_sync) ? "sync" : "nosync", mirrors));
-}
-
-static int
-dm_raid1(struct lib_context *lc, char **table, struct raid_set *rs)
-{
-	int need_sync;
-	struct handler_info rebuild_drive;
-	uint64_t sectors = 0;
-	unsigned int mirrors = get_dm_devs(rs, 1);
-	struct raid_set *r, *swap_rs;
-	struct raid_dev *rd, *swap_rd;
-
-	switch (mirrors) {
-	case 0:
-		return 0;
-
-	case 1:
-		/*
-		 * In case we only have one mirror left,
-		 * a linear mapping will do.
-		 */
-		log_err(lc, "creating degraded mirror mapping for \"%s\"",
-			rs->name);
-		return dm_linear(lc, table, rs);
-	}
-
-	if (!(sectors = _smallest(lc, rs, 0)))
-		LOG_ERR(lc, 0, "can't find smallest mirror!");
-
-	/*
-	 * Get drive for reordering - copy is made from first
-	 * drive (i.e. the master) to the other mirrors.
-	 */
-	need_sync = rs_need_sync(rs);
-	rebuild_drive.data.i32 = -1;
-	if (need_sync && !get_rebuild_drive(lc, rs, &rebuild_drive))
-		return 0;
-
-	if (!_dm_raid1_bol(lc, table, rs, sectors, mirrors, need_sync))
-		goto err;
-
-	/* Stacked mirror sets. */
-	swap_rs = NULL;
-	list_for_each_entry(r, &rs->sets, list) {
-		if (valid_rs(r)) {
-			int ret = 1;
-			char *path;
-
-			if (!(path = mkdm_path(lc, r->name)))
-				goto err;
-
-			if (!rebuild_drive.data.i32 && !swap_rs)
-				swap_rs = r;
-			else
-				ret = _dm_path_offset(lc, table, 1, path, 0);
-
-			dbg_free(path);
-
-			if (!ret)
-				goto err;
-		}
-	}
-
-	/* Add rebuild target to the end of the list. */
-	if (swap_rs && valid_rs(swap_rs)) {
-		int ret = 1;
-		char *path;
-
-		if (!(path = mkdm_path(lc, swap_rs->name)))
-			goto err;
-
-		ret = _dm_path_offset(lc, table, 1, path, 0);
-		dbg_free(path);
-
-		if (!ret)
-			goto err;
-	}
-
-	/* Lowest level mirror devices. */
-	swap_rd = NULL;
-	list_for_each_entry(rd, &rs->devs, devs) {
-		if (valid_rd(rd)) {
-			if (!rebuild_drive.data.i32 && !swap_rd)
-				swap_rd = rd;
-			else if (!_dm_path_offset(lc, table, 1,
-						  rd->di->path, rd->offset))
-				goto err;
-		}
-	}
-
-	/* Add rebuild target to the end of the list. */
-	if (swap_rd && valid_rd(swap_rd))
-		if (!_dm_path_offset(lc, table, valid_rd(swap_rd),
-				     swap_rd->di->path, swap_rd->offset))
-			goto err;
-
-	return 1;
-
-      err:
-	return log_alloc_err(lc, __func__);
-}
-
-/*
- * Create dm table for RAID5 mapping.
- */
-
-/* Push begin of line onto a RAID5 table. */
-/* FIXME: persistent dirty log. */
-static int
-_dm_raid45_bol(struct lib_context *lc, char **table, struct raid_set *rs,
-	       uint64_t sectors, unsigned int members)
-{
-	int need_sync = rs_need_sync(rs);
-	struct handler_info rebuild_drive;
-
-	/* Get drive as rebuild target. */
-	rebuild_drive.data.i32 = -1;
-	if (need_sync && !get_rebuild_drive(lc, rs, &rebuild_drive))
-		return 0;
-
-	return p_fmt(lc, table, "0 %U %s core 2 %u %s %s 1 %u %u %d",
-		     sectors, get_dm_type(lc, rs->type),
-		     calc_region_size(lc,
-				      total_sectors(lc, rs) /
-				      _dm_raid_devs(lc, rs, 0)),
-		     (need_sync) ? "sync" : "nosync", get_type(lc, rs->type),
-		     rs->stride, members, rebuild_drive.data.i32);
-}
-
-/* Create "error target" name based on raid set name. */
-static char *err_target_name(struct raid_set *rs)
-{
-	char *ret;
-	static const char *_err_target = "_err_target";
-
-	if ((ret = dbg_malloc(strlen(rs->name) + strlen(_err_target) + 1)))
-		sprintf(ret, "%s%s", rs->name, _err_target);
-
-	return ret;
-}
-
-/*
- * Create "error target" device to replace missing
- * disk path by "error target" in order to avoid any
- * further access to the real (unavailable) device.
- */
-static char *
-create_error_target(struct lib_context *lc, struct raid_set *rs) 
-{
-	uint64_t err_targ_size;
-	char *err_name, *path = NULL, *table;
-
-	/* "error target" should be bigger than the biggest device in the set */
-	err_targ_size = _biggest(rs) + 1;
-	
-	/* create "error target" name based on raid set name*/
-	if (!(err_name = err_target_name(rs))) {
-		log_alloc_err(lc, __func__);
-		goto err;
-	}
-
-	/* Allocate memory for "error target" table. */
-	if ((table = dbg_malloc(ERROR_TARG_TABLE_LEN)))
-		sprintf(table, "0 %llu error",
-			(long long unsigned) err_targ_size);
-	else {
-		log_alloc_err(lc, __func__);
-		dbg_free(err_name);
-		goto err;
-	}
-
-	/* Create "error target" in device-mapper. */
-	if (dm_create(lc, rs, table, err_name))
-		path = mkdm_path(lc, err_name);
-	
-	dbg_free(err_name);
-	dbg_free(table);
-   err:
-	return path;
-}
-
-/* Delete "error target" device */
-void delete_error_target(struct lib_context *lc, struct raid_set *rs) 
-{
-	char *err_name;
-
-	/* Create "error target" name based on raid set name. */
-	if ((err_name = err_target_name(rs))) {
-		/* Remove "error target" form device-mapper. */
-		dm_remove(lc, rs, err_name);
-		dbg_free(err_name);
-	} else
-		log_alloc_err(lc, __func__);
-}
-
-/* Alloc a dummy rd to insert for a missing drive. */
-static struct raid_dev *add_rd_dummy(struct lib_context *lc,
-				     struct raid_dev *rd_ref,
-				     struct list_head *rd_list, char *path)
-{
-	struct raid_dev *rd = NULL;
-	int area_size = rd_ref->meta_areas->size;
-
-	/* Create dummy rd for error_target. */
-	if ((rd = alloc_raid_dev(lc, __func__))) {
-		rd->name = NULL;
-		rd->fmt = rd_ref->fmt;
-		rd->status = s_inconsistent;
-		rd->type = t_undef;
-		rd->sectors = rd_ref->sectors;
-		rd->offset = rd_ref->offset;
-		rd->areas = rd_ref->areas;
-
-		rd->di = alloc_dev_info(lc, path);
-		if (!rd->di)
-			goto err;
-
-		rd->meta_areas = alloc_meta_areas(lc, rd, rd->fmt->name, 1);
-		if (!rd->meta_areas)
-			goto err;				
-            
-		rd->meta_areas->size = area_size;
-		rd->meta_areas->offset = rd_ref->meta_areas->offset;     
-
-		rd->meta_areas->area = 
-				alloc_private(lc, rd->fmt->name, area_size);
-		if (!rd->meta_areas->area)
-			goto err;
-	    
-		memcpy(rd->meta_areas->area, rd_ref->meta_areas->area, area_size);
-	
-		list_add_tail(&rd->devs, rd_list);
-	}
-
-	return rd;
-err:
-	free_raid_dev(lc, &rd);
-	return NULL;
-}
-
-static int
-dm_raid45(struct lib_context *lc, char **table, struct raid_set *rs)
-{
-	int ret;
-	uint64_t sectors = 0;
-	unsigned int members = get_dm_devs(rs, 0);
-	struct raid_dev *rd;
-	struct raid_set *r;
-	char *err_targ_path = NULL;
-    
-	/* If one disk is missing create error target to replace it. */
-	if (members != rs->found_devs) {
-		int i, ndev, idx;
-		struct raid_dev *rd_first, *rd_tmp;
-		struct handler_info info;
-
-		/* Get get number of disks from metadata handler. */	    
-		rd_first = list_entry(rs->devs.next, struct raid_dev, devs); 
-		if (rd_first->fmt->metadata_handler) {
-			ndev = rd_first->fmt->metadata_handler(lc,
-				 GET_NUMBER_OF_DEVICES, NULL, rs); 
-			if (ndev < 0)
-				LOG_ERR(lc, 0, "No devices in RAID set!");
-		} else
-			goto out;
-
-		/* Delete potentially existing error_target. */
-		delete_error_target(lc, rs);
-
-		/* Create error_target */
-		if (!(err_targ_path = create_error_target(lc, rs)))
-			LOG_ERR(lc, 0,
-				"Cannot create error target for missing"
-				" disk(s) in degraded array!");
-
-		/* Insert dummy rd(s) into rd list */		
-		i = 0;
-		list_for_each_entry_safe(rd, rd_tmp, &rs->devs, devs) {
-			info.data.ptr = rd;
-			idx = rd_first->fmt->metadata_handler(lc,
-				 GET_DEVICE_IDX, &info, rs); 
-			if (idx < 0)
-				LOG_ERR(lc, 0, "Can't get index of \"%s\"",
-					rd->di->path);
-
-			/* Insert dummy devices for any missing raid devices. */
-			while (i < idx) {
-				if (!add_rd_dummy(lc, rd_first, &rd->devs,
-						  err_targ_path))
-			        	goto err;
-
-				members++;
-				i++;
-			}
-
-			i++;
-		}
-
-		/* Insert any missing RAID devices after the last one found. */
-		while (i < ndev) {
-			if (!add_rd_dummy(lc, rd_first, &rs->devs,
-					  err_targ_path))
-		        	goto err;
-
-			members++;
-			i++;
-		}
-	}
-    
-	if (!(sectors = _smallest(lc, rs, 0)))
-		LOG_ERR(lc, 0, "can't find smallest RAID4/5 member!");
-
-	/* Adjust sectors with chunk size: only whole chunks count. */
-	sectors = sectors / rs->stride * rs->stride;
-
-	/*
-	 * Multiply size of smallest member by the number of data
-	 * devices to get the total sector count for the mapping.
-	 */
-	sectors *= members - 1;
-
-	if (!_dm_raid45_bol(lc, table, rs, sectors, members))
-		goto err;
-
-	/* Stacked RAID sets (for RAID50 etc.) */
-	list_for_each_entry(r, &rs->sets, list) {
-		char *path;
-
-		if (!(path = mkdm_path(lc, r->name)))
-			goto err;
-
-		ret = _dm_path_offset(lc, table, valid_rs(r), path, 0);
-		dbg_free(path);
-
-		if (!ret)
-			goto err;
-	}
-
-	/* Lowest level RAID devices. */
-	list_for_each_entry(rd, &rs->devs, devs) {
-		if (!_dm_path_offset(lc, table, valid_rd(rd), 
-				     rd->di->path, rd->offset))
-			goto err;
-	}
-
-	if (err_targ_path)
-		dbg_free(err_targ_path);
-out:
-	return 1;
-
-err:
-	if (err_targ_path)
-		dbg_free(err_targ_path);
-
-	return log_alloc_err(lc, __func__);
-}
-
-/*
- * Activate/deactivate (sub)sets.
- */
-
-/*
- * Array of handler functions for the various types.
- */
-static struct type_handler {
-	const enum type type;
-	int (*f) (struct lib_context * lc, char **table, struct raid_set * rs);
-} type_handler[] = {
-	{ t_undef, dm_undef },	/* Needs to stay here! */
-	{ t_partition, dm_partition },
-	{ t_spare, dm_spare },
-	{ t_linear, dm_linear },
-	{ t_raid0, dm_raid0 },
-	{ t_raid1, dm_raid1 },
-	{ t_raid4, dm_raid45 },
-	{ t_raid5_ls, dm_raid45 },
-	{ t_raid5_rs, dm_raid45 },
-	{ t_raid5_la, dm_raid45 },
-	{ t_raid5_ra, dm_raid45 },
-	/* RAID types below not supported (yet) */
-	{ t_raid6, dm_unsup },
-};
-
-/* Retrieve type handler from array. */
-static struct type_handler *
-handler(struct raid_set *rs)
-{
-	struct type_handler *th = type_handler;
-
-	do {
-		if (rs->type == th->type)
-			return th;
-	} while (++th < ARRAY_END(type_handler));
-
-	return type_handler;
-}
-
-/* Return mapping table */
-char *
-libdmraid_make_table(struct lib_context *lc, struct raid_set *rs)
-{
-	char *ret = NULL;
-
-	if (T_GROUP(rs))
-		return NULL;
-
-	if (!(handler(rs))->f(lc, &ret, rs))
-		LOG_ERR(lc, NULL, "no mapping possible for RAID set %s",
-			rs->name);
-
-	return ret;
-}
-
-
-enum dm_what { DM_ACTIVATE, DM_REGISTER };
-
-/* Register devices of the RAID set with the dmeventd. */
-#define	ALL_EVENTS 0xffffffff
-static int
-dm_register_for_event(char *dev_name, char *lib_name)
-{
-#ifdef	DMRAID_AUTOREGISTER
-	dm_register_device(dev_name, lib_name);
-#endif
-	return 1;
-}
-
-static int
-dm_unregister_for_event(char *dev_name, char *lib_name)
-{
-#ifdef	DMRAID_AUTOREGISTER
-	dm_unregister_device(dev_name, lib_name);
-#endif
-	return 1;
-}
-
-#define LIB_NAME_LENGTH 255
-static int
-do_device(struct lib_context *lc, struct raid_set *rs, int (*f) ())
-{
-	int ret = 0;
-	char lib_name[LIB_NAME_LENGTH];
-
-	if (OPT_TEST(lc))
-		return 1;
-
-        struct dmraid_format *fmt = get_format(rs);
-
-        if (fmt->name != NULL) {
-                strncpy(lib_name, "libdmraid-events-",LIB_NAME_LENGTH);
-                strncat(lib_name, fmt->name, LIB_NAME_LENGTH-strlen(fmt->name)-3);
-                strncat(lib_name, ".so", 3);
-
-                ret = f(rs->name, lib_name);
-        }
-
-	return ret ? 1 : 0;
-}
-
-static int
-register_devices(struct lib_context *lc, struct raid_set *rs)
-{
-	return do_device(lc, rs, dm_register_for_event);
-}
-
-/* Unregister devices of the RAID set with the dmeventd. */
-static int
-unregister_devices(struct lib_context *lc, struct raid_set *rs)
-{
-	return do_device(lc, rs, dm_unregister_for_event);
-}
-
-/* Reload a single set. */
-static int
-reload_subset(struct lib_context *lc, struct raid_set *rs)
-{
-	int ret = 0;
-	char *table = NULL;
-
-	if (T_GROUP(rs) || T_RAID0(rs))
-		return 1;
-
-	/* Suspend device */
-	if (!(ret = dm_suspend(lc, rs)))
-		LOG_ERR(lc, ret, "Device suspend failed.");
-
-	/* Call type handler */
-	if ((ret = (handler(rs))->f(lc, &table, rs))) {
-		if (OPT_TEST(lc))
-			display_table(lc, rs->name, table);
-		else
-			ret = dm_reload(lc, rs, table);
-	} else
-		log_err(lc, "no mapping possible for RAID set %s", rs->name);
-
-	free_string(lc, &table);
-
-	/* Try to resume */
-	if (ret)
-		dm_resume(lc, rs);
-	else if (!(ret = dm_resume(lc, rs)))
-		LOG_ERR(lc, ret, "Device resume failed.");
-
-	return ret;
-}
-
-/* Reload a RAID set recursively (eg, RAID1 on top of RAID0). */
-static int
-reload_set(struct lib_context *lc, struct raid_set *rs)
-{
-	struct raid_set *r;
-
-	/* FIXME: Does it matter if the set is (in)active? */
-#if 0
-	if (!OPT_TEST(lc) && what == DM_ACTIVATE && dm_status(lc, rs)) {
-		log_print(lc, "RAID set \"%s\" already active", rs->name);
-		return 1;
-	}
-#endif
-
-	/* Recursively walk down the chain of stacked RAID sets */
-	list_for_each_entry(r, &rs->sets, list) {
-		/* Activate set below this one */
-		if (!reload_set(lc, r) && !T_GROUP(rs))
-			continue;
-	}
-
-	return reload_subset(lc, rs);
-}
-
-/* Activate a single set. */
-static int
-activate_subset(struct lib_context *lc, struct raid_set *rs, enum dm_what what)
-{
-	int ret = 0;
-	char *table = NULL;
-
-	if (T_GROUP(rs))
-		return 1;
-
-	if (what == DM_REGISTER)
-		return register_devices(lc, rs);
-
-	/* Call type handler */
-	if ((ret = (handler(rs))->f(lc, &table, rs))) {
-		if (OPT_TEST(lc))
-			display_table(lc, rs->name, table);
-		else if ((ret = dm_create(lc, rs, table, rs->name)))
-			log_print(lc, "RAID set \"%s\" was activated",
-				  rs->name);
-		else {
-            		/*
-			 * Error target must be removed
-		 	 * if activation did not succeed.
-		 	 */
-			delete_error_target(lc, rs);
-			log_print(lc, "RAID set \"%s\" was not activated",
-				  rs->name);
-		}
-	} else
-		log_err(lc, "no mapping possible for RAID set %s", rs->name);
-
-	free_string(lc, &table);
-	return ret;
-}
-
-/* Activate a RAID set recursively (eg, RAID1 on top of RAID0). */
-static int
-activate_set(struct lib_context *lc, struct raid_set *rs, enum dm_what what)
-{
-	struct raid_set *r;
-
-	if (!OPT_TEST(lc) && what == DM_ACTIVATE && dm_status(lc, rs)) {
-		log_print(lc, "RAID set \"%s\" already active", rs->name);
-		return 1;
-	}
-
-	/* Before activating the whole superset, */
-	/* we should check that the metdata handler allows it */
-	if ((what == DM_ACTIVATE) && T_GROUP(rs)) {
-		struct raid_dev *rd = list_entry(rs->devs.next, typeof(*rd),
-						devs);
-		if (rd->fmt->metadata_handler) {
-			if (!rd->fmt->metadata_handler(lc, ALLOW_ACTIVATE, 
-							NULL, rs)) {
-				log_err(lc, 
-					"RAID set \"%s\" can't be activated", 
-					 rs->name);
-				return 0; 
-			}
-		}
-	}
-
-	/* Before activating the whole superset, */
-	/* we should check that the metdata handler allows it */
-	if ((what == DM_ACTIVATE) && T_GROUP(rs)) {
-		struct raid_dev *rd = list_entry(rs->devs.next, typeof(*rd),
-						devs);
-		if (rd->fmt->metadata_handler) {
-			if (!rd->fmt->metadata_handler(lc, ALLOW_ACTIVATE, 
-							NULL, rs)) {
-				log_err(lc, 
-					"RAID set \"%s\" can't be activated", 
-					 rs->name);
-				return 0; 
-			}
-		}
-	}
-
-	/* Recursively walk down the chain of stacked RAID sets */
-	list_for_each_entry(r, &rs->sets, list) {
-		/* Activate set below this one */
-		if (!activate_set(lc, r, what) && !T_GROUP(rs))
-			return 0;
-	}
-
-	return activate_subset(lc, rs, what);
-}
-
-/* Deactivate a single set (one level of a device stack). */
-static int
-deactivate_superset(struct lib_context *lc, struct raid_set *rs,
-		    enum dm_what what)
-{
-	int ret = 1, status;
-
-	if (what == DM_REGISTER)
-		return unregister_devices(lc, rs);
-
-	status = dm_status(lc, rs);
-	if (OPT_TEST(lc))
-		log_print(lc, "%s [%sactive]", rs->name, status ? "" : "in");
-	else if (status)
-		ret = dm_remove(lc, rs, rs->name);
-	else
-		log_print(lc, "RAID set \"%s\" is not active", rs->name);
-    
-	/*
-	 * Special case for degraded raid5 array, 
-	 * activated with error target device .
-	 */
-	delete_error_target(lc, rs);
-	return ret;
-}
-
-/* Deactivate a RAID set. */
-static int
-deactivate_set(struct lib_context *lc, struct raid_set *rs, enum dm_what what)
-{
-	struct raid_set *r;
-
-	/*
-	 * Deactivate myself if not a group set,
-	 * which gets never activated itself.
-	 */
-	if (!T_GROUP(rs) && !deactivate_superset(lc, rs, what))
-		return 0;
-
-	/* Deactivate any subsets recursively. */
-	list_for_each_entry(r, &rs->sets, list) {
-		if (!deactivate_set(lc, r, what))
-			return 0;
-	}
-
-	return 1;
-}
-
-
-/* External (de)activate interface. */
-int
-change_set(struct lib_context *lc, enum activate_type what, void *v)
-{
-	int ret;
-	struct raid_set *rs = v;
-
-	switch (what) {
-	case A_ACTIVATE:
-		ret = activate_set(lc, rs, DM_ACTIVATE) &&
-		      activate_set(lc, rs, DM_REGISTER);
-		break;
-
-	case A_DEACTIVATE:
-		ret = deactivate_set(lc, rs, DM_REGISTER) &&
-		      deactivate_set(lc, rs, DM_ACTIVATE);
-		break;
-
-	case A_RELOAD:
-		ret = reload_set(lc, rs);
-		break;
-
-	default:
-		log_err(lc, "%s: invalid activate type!", __func__);
-		ret = 0;
-	}
-
-	return ret;
-}
diff --git a/debian/patches/01_fix_broken_linking.patch b/debian/patches/01_fix_broken_linking.patch
index 7bca3b6..9d77262 100644
--- a/debian/patches/01_fix_broken_linking.patch
+++ b/debian/patches/01_fix_broken_linking.patch
@@ -1,7 +1,7 @@
 Author: Luke Yelavich <themuso at ubuntu.com>
 Description: Fix library symbolic link creation and library linking.
---- a/1.0.0.rc15/configure
-+++ b/1.0.0.rc15/configure
+--- a/1.0.0.rc16/configure
++++ b/1.0.0.rc16/configure
 @@ -693,6 +693,7 @@ DEBUG_MALLOC
  DMRAID_TEST
  DMRAID_VERSION
@@ -21,8 +21,8 @@ Description: Fix library symbolic link creation and library linking.
  fi
  
  
---- a/1.0.0.rc15/configure.in
-+++ b/1.0.0.rc15/configure.in
+--- a/1.0.0.rc16/configure.in
++++ b/1.0.0.rc16/configure.in
 @@ -178,7 +178,7 @@ if test x$DEBUG_MALLOC = xyes; then
  fi
  
@@ -51,21 +51,21 @@ Description: Fix library symbolic link creation and library linking.
  AC_SUBST(DIETLIBC)
  AC_SUBST(GROUP)
  AC_SUBST(JOBS)
---- a/1.0.0.rc15/lib/Makefile.in
-+++ b/1.0.0.rc15/lib/Makefile.in
-@@ -56,6 +56,11 @@ ifeq ("@KLIBC@", "no")
-     LIB_SHARED=$(top_srcdir)/lib/libdmraid.so
-     TARGETS += $(LIB_SHARED)
-     INSTALL_TARGETS += $(LIB_SHARED)
-+    ifeq ("@DIETLIBC@", "yes")
-+      LIBDMRAIDLIBS += -ldevmapper_dietc
-+    else
-+      LIBDMRAIDLIBS += -ldevmapper
-+    endif
-   endif
+--- a/1.0.0.rc16/lib/Makefile.in
++++ b/1.0.0.rc16/lib/Makefile.in
+@@ -65,6 +65,11 @@ ifeq ("@KLIBC@", "no")
+ 		LIB_EVENTS_SHARED=$(top_srcdir)/lib/$(LIB_EVENTS_NAME).so
+ 		TARGETS += $(LIB_SHARED) $(LIB_EVENTS_SHARED)
+ 		INSTALL_TARGETS += $(LIB_SHARED) $(LIB_EVENTS_SHARED)
++		ifeq ("@DIETLIBC@", "yes")
++			LIBDMRAIDLIBS += -ldevmapper_dietc
++		else
++			LIBDMRAIDLIBS += -ldevmapper
++		endif
+ 	endif
  endif
  
-@@ -72,10 +77,11 @@ install_dmraid_libs: $(INSTALL_TARGETS)
+@@ -82,10 +87,11 @@ install_dmraid_libs: $(INSTALL_TARGETS)
  	for f in $(INSTALL_TARGETS); \
  	do \
  		n=$$(basename $${f}) ; \
@@ -79,8 +79,8 @@ Description: Fix library symbolic link creation and library linking.
  		else \
  			$(INSTALL) -m 555 $(STRIP) $$f $(libdir)/$${n}; \
  		fi \
---- a/1.0.0.rc15/make.tmpl.in
-+++ b/1.0.0.rc15/make.tmpl.in
+--- a/1.0.0.rc16/make.tmpl.in
++++ b/1.0.0.rc16/make.tmpl.in
 @@ -44,6 +44,7 @@ endif
  OWNER = @OWNER@
  GROUP = @GROUP@
@@ -89,18 +89,18 @@ Description: Fix library symbolic link creation and library linking.
  
  # The number of jobs to run, if blank, defaults to the make standard
  ifndef MAKEFLAGS
-@@ -131,7 +132,7 @@ $(TARGETS): $(OBJECTS)
+@@ -136,7 +137,7 @@ $(TARGETS): $(OBJECTS)
  
  %.so: $(OBJECTS)
  	$(CC) -shared -Wl,-soname,$(notdir $@).$(DMRAID_LIB_VERSION) \
--	-Wl,--version-script,.export.sym $(OBJECTS) -o $@
-+	-Wl,--version-script,.export.sym $(OBJECTS) $(LIBDMRAIDLIBS) -o $@
+-	-Wl,--version-script,.export.sym $(OBJECTS) -o $@ -ldevmapper-event
++	-Wl,--version-script,.export.sym $(OBJECTS) $(LIBDMRAIDLIBS) -o $@ -ldevmapper-event
  
  $(LIB_STATIC): $(OBJECTS)
  	$(RM) $@
---- a/1.0.0.rc15/tools/Makefile.in
-+++ b/1.0.0.rc15/tools/Makefile.in
-@@ -28,9 +28,13 @@ ifeq ("@KLIBC@", "yes")
+--- a/1.0.0.rc16/tools/Makefile.in
++++ b/1.0.0.rc16/tools/Makefile.in
+@@ -34,12 +34,16 @@ ifeq ("@KLIBC@", "yes")
  	DMRAIDLIBS += -ldevmapper_klibc
  else
  	ifeq ("@DIETLIBC@", "yes")
@@ -108,11 +108,14 @@ Description: Fix library symbolic link creation and library linking.
 +		ifeq ("@LIB_SO@", "no")
 +			DMRAIDLIBS += -ldevmapper_dietc
 +		endif
+ 		ifeq ("@STATIC_LINK@", "no")
+ 			DMEVENTTOOLLIBS = -ldevmapper-event_dietc
+ 		endif
  	else
 -		DMRAIDLIBS += -ldevmapper
 +		ifeq ("@LIB_SO@", "no")
 +			DMRAIDLIBS += -ldevmapper
 +		endif
- 	endif
- 
- 	ifeq ("@LIBSELINUX@", "yes")
+ 		ifeq ("@STATIC_LINK@", "no")
+ 			DMEVENTTOOLLIBS = -ldevmapper-event
+ 		endif
diff --git a/debian/patches/02_scsi_serial_remove_ws.patch b/debian/patches/02_scsi_serial_remove_ws.patch
deleted file mode 100644
index dd30db9..0000000
--- a/debian/patches/02_scsi_serial_remove_ws.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-Author: Giuseppe Iuculano <giuseppe at iuculano.it>
-Description: remove whitespace from serial id (LP: #305011)
---- a/1.0.0.rc15/lib/device/scsi.c
-+++ b/1.0.0.rc15/lib/device/scsi.c
-@@ -110,7 +110,10 @@ get_scsi_serial(struct lib_context *lc, 
- 		}
- 
- 		ret = ret &&
--		     (di->serial = dbg_strdup((char *) &response[p->start + 1]));
-+		      (di->serial =
-+		       dbg_strdup(remove_white_space(lc,
-+				  (char *) &response[p->start + 1],
-+				  serial_len)));
- 	}
- 
- 	dbg_free(response);
diff --git a/debian/patches/03_fix_hyphen-used-as-minus-sign.patch b/debian/patches/03_fix_hyphen-used-as-minus-sign.patch
index 976b763..3afca23 100644
--- a/debian/patches/03_fix_hyphen-used-as-minus-sign.patch
+++ b/debian/patches/03_fix_hyphen-used-as-minus-sign.patch
@@ -1,8 +1,8 @@
 Author: Giuseppe Iuculano <giuseppe at iuculano.it>
 Description: Fix hyphen-used-as-minus-sign
---- a/1.0.0.rc15/man/dmraid.8
-+++ b/1.0.0.rc15/man/dmraid.8
-@@ -4,19 +4,19 @@ dmraid \- discover, configure and activa
+--- a/1.0.0.rc16/man/dmraid.8
++++ b/1.0.0.rc16/man/dmraid.8
+@@ -4,20 +4,20 @@ dmraid \- discover, configure and activa
  .SH SYNOPSIS
  .B dmraid
   {-a|--activate} {y|n|yes|no} 
@@ -12,10 +12,11 @@ Description: Fix hyphen-used-as-minus-sign
 + [\-f|--format FORMAT[,FORMAT...]]
   [{-P|--partchar} CHAR]
 - [-p|--no_partitions]
-- [--separator SEPARATOR]
-- [-t|--test]
+- [-Z|--rm_partitions]
 + [\-p|--no_partitions]
-+ [\--separator SEPARATOR]
++ [\-Z|--rm_partitions]
+  [--separator SEPARATOR]
+- [-t|--test]
 + [\-t|--test]
   [RAID-set...]
  
@@ -30,7 +31,7 @@ Description: Fix hyphen-used-as-minus-sign
   [device-path...]
  
  .B dmraid
-@@ -24,60 +24,60 @@ dmraid \- discover, configure and activa
+@@ -25,60 +25,60 @@ dmraid \- discover, configure and activa
  
  .B dmraid
   {-l|--list_formats}
@@ -119,16 +120,16 @@ Description: Fix hyphen-used-as-minus-sign
   [RAID-set...]
  
  .B dmraid
-@@ -112,7 +112,7 @@ When activating RAID sets,
- .B -p
- disables the activation of partitions on them.
+@@ -117,7 +117,7 @@ will make dmraid tell the kernel to remo
+ underlying the set, ie if sda is part of the set, remove sda1, sda2, etc.
+ This prevents applications from directly accessiong the disks bypassing dmraid.
  RAID set names given on command line don't need to be fully specified
 -(eg, "dmraid -ay sil" would activate all discovered Silicon Image Medley
 +(eg, "dmraid \-ay sil" would activate all discovered Silicon Image Medley
  RAID sets).
  
  .TP
-@@ -129,7 +129,7 @@ See description of
+@@ -134,7 +134,7 @@ See description of
  below for FIELD identifiers.
  
  .TP
@@ -137,7 +138,7 @@ Description: Fix hyphen-used-as-minus-sign
  Enable debugging output. Opion can be given multiple times
  increasing the debug output level.
  
-@@ -209,18 +209,18 @@ is added to the system.
+@@ -214,18 +214,18 @@ is added to the system.
      During system reboot, enter OROM and mark the new drive as the rebuild drive.  
      After booting to the OS, use the dmraid command to rebuild.
  
@@ -160,7 +161,7 @@ Description: Fix hyphen-used-as-minus-sign
  
  .TP
  .I {-x|--remove} [RAID-set]
-@@ -230,11 +230,11 @@ Delete one or all existing software RAID
+@@ -235,11 +235,11 @@ Delete one or all existing software RAID
  .I -f FORMAT-handler {-C|--create} --type raidlevel [--size=setsize --strip stripsize] --disk "device-path, device-path [,device-path]"
  Delete one or all existing Configure a software RAID device  and store the configuration data in a group of hard drive devices consisting of this array. This command requires the following options:
  
@@ -175,7 +176,7 @@ Description: Fix hyphen-used-as-minus-sign
  .br
  	specify the raid level of the software RAID set. 
  .br
-@@ -246,7 +246,7 @@ Delete one or all existing Configure a s
+@@ -251,7 +251,7 @@ Delete one or all existing Configure a s
  .br
  		01: raid01 (isw raid10)
  .br
@@ -184,7 +185,7 @@ Description: Fix hyphen-used-as-minus-sign
  .br
  	specify the size of the RAID set.The number is an integer followed by [kKmMgG] and/or [bB].
  .br
-@@ -262,11 +262,11 @@ Delete one or all existing Configure a s
+@@ -267,11 +267,11 @@ Delete one or all existing Configure a s
  .br
  If this option is missing, it's set to the default value pre-configured by the vendor. Note that different vendors may apply different constraints on the granularity of the size or the minimal value.
  .br
@@ -198,7 +199,7 @@ Description: Fix hyphen-used-as-minus-sign
  .br
  	specify the array of the hard drives, e.g. /dev/sda.
  
-@@ -344,7 +344,7 @@ Use SEPARATOR as a delimiter for all opt
+@@ -349,7 +349,7 @@ Use SEPARATOR as a delimiter for all opt
  .TP
  .I -s... [a|i] [RAID-set...]
  Display properties of RAID sets. Multiple RAID set names can be given
@@ -207,7 +208,7 @@ Description: Fix hyphen-used-as-minus-sign
  would display all discovered Highpoint RAID sets). Enter
  .B -s
  twice to display RAID subsets too.
-@@ -372,7 +372,7 @@ Enable verbose runtime information outpu
+@@ -377,7 +377,7 @@ Enable verbose runtime information outpu
  increasing the verbosity level.
  
  .SH EXAMPLES
@@ -216,7 +217,7 @@ Description: Fix hyphen-used-as-minus-sign
  some descriptive information, eg:
  .br
  hpt37x : (+) Highpoint HPT37X
-@@ -395,16 +395,16 @@ dos    : (+) DOS partitions on SW RAIDs
+@@ -400,16 +400,16 @@ dos    : (+) DOS partitions on SW RAIDs
  .br
  (0): Discover, (+): Discover+Activate
  
@@ -237,7 +238,7 @@ Description: Fix hyphen-used-as-minus-sign
  .br
  /dev/dm-46: hpt45x, "hpt45x_chidjhaiaa-0", striped, ok, 320172928 sectors, data@ 0
  .br
-@@ -415,7 +415,7 @@ supported formats.
+@@ -420,7 +420,7 @@ supported formats.
  /dev/dm-58: hpt45x, "hpt45x_chidjhaiaa-1", striped, ok, 320172928 sectors, data@ 0
  
  
@@ -246,7 +247,7 @@ Description: Fix hyphen-used-as-minus-sign
  set "hpt45x_chidjhaiaa", eg:
  .br
  *** Superset
-@@ -473,7 +473,7 @@ dev    : 2
+@@ -478,7 +478,7 @@ dev    : 2
  spare  : 0
  .br
  
@@ -255,7 +256,7 @@ Description: Fix hyphen-used-as-minus-sign
  and subsets with hpt45* format, eg:
  .br
  hpt45x_chidjhaiaa,640345856,128,raid10,ok,4,0
-@@ -482,7 +482,7 @@ hpt45x_chidjhaiaa-a,640345856,128,stripe
+@@ -487,7 +487,7 @@ hpt45x_chidjhaiaa-a,640345856,128,stripe
  .br
  hpt45x_chidjhaiaa-b,640345856,128,stripe,ok,2,0
  
@@ -264,7 +265,7 @@ Description: Fix hyphen-used-as-minus-sign
  RAID devices in column format using ':' as a delimiter, eg:
  .br
  /dev/dm-8:320173055
-@@ -513,18 +513,18 @@ RAID devices in column format using ':' 
+@@ -518,18 +518,18 @@ RAID devices in column format using ':' 
  .br
  /dev/dm-66:390624896
  
diff --git a/debian/patches/04_do_not_use_p_for_partition.patch b/debian/patches/04_do_not_use_p_for_partition.patch
index 6636b05..aca4fb1 100644
--- a/debian/patches/04_do_not_use_p_for_partition.patch
+++ b/debian/patches/04_do_not_use_p_for_partition.patch
@@ -1,7 +1,7 @@
 Author: Giuseppe Iuculano <giuseppe at iuculano.it>
 Description: Removed "p" from device name. A proper upgrade script is needed before using it.
---- a/1.0.0.rc15/lib/format/partition/dos.c
-+++ b/1.0.0.rc15/lib/format/partition/dos.c
+--- a/1.0.0.rc16/lib/format/partition/dos.c
++++ b/1.0.0.rc16/lib/format/partition/dos.c
 @@ -31,7 +31,7 @@ _name(struct lib_context *lc, struct rai
  {
  	const char *base = get_basename(lc, rd->di->path);
diff --git a/debian/patches/05_jmicron-name-fix.patch b/debian/patches/05_jmicron-name-fix.patch
deleted file mode 100644
index ad1a45d..0000000
--- a/debian/patches/05_jmicron-name-fix.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-Fix segfault when attempting to generate name for jmicron controllers.
-LP #344215
---- a/1.0.0.rc15/lib/format/ataraid/jm.c
-+++ b/1.0.0.rc15/lib/format/ataraid/jm.c
-@@ -25,18 +25,19 @@ static int member(struct jm *jm);
- static char *
- name(struct lib_context *lc, struct raid_dev *rd, unsigned int subset)
- {
--	int i;
-+	size_t i = JM_NAME_LEN-1;
- 	size_t len;
- 	struct jm *jm = META(rd, jm);
--	char buf[JM_NAME_LEN + 1], *ret, *name = (char *) jm->name;
-+	char *ret, *name = (char *) jm->name;
-+	char buf[JM_NAME_LEN+1] = { '\0' };
- 
--	/* Name always 0 terminated or whitespace at end ? */
--	strncpy(buf, name, JM_NAME_LEN);
--	len = strlen(buf);
--	i = len < JM_NAME_LEN ? len : JM_NAME_LEN;
--	buf[i] = 0;
--	while (i-- && isspace(buf[i]))
--		buf[i] = 0;
-+	/* Sanitize name, make sure it's null terminated */
-+	strncpy(buf, jm->name, JM_NAME_LEN);
-+	while (i && isspace(buf[i])) {
-+		name[i]='\0';
-+		buf[i]='\0';
-+		--i;
-+	}
- 
- 	len = strlen(buf) + sizeof(HANDLER) + (jm->mode == JM_T_RAID01 ? 3 : 2);
- 	if ((ret = dbg_malloc(len))) {
diff --git a/debian/patches/06_fix_led_support_compilation.patch b/debian/patches/06_fix_led_support_compilation.patch
deleted file mode 100644
index dfe1a72..0000000
--- a/debian/patches/06_fix_led_support_compilation.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-Author: Giuseppe Iuculano <giuseppe at iuculano.it>
-Description: fix FTBFS when LED support is enabled
---- a/1.0.0.rc15/include/dmraid/misc.h
-+++ b/1.0.0.rc15/include/dmraid/misc.h
-@@ -64,7 +64,7 @@ div_up(uint64_t what, unsigned int by)
- #define LED_OFF		0
- #define LED_REBUILD 1
- 
--int led(char *rd, int status);
-+int led(const char *rd, int status);
- #endif
- 
- #endif
diff --git a/debian/patches/07_isw_metadata_normal_state.patch b/debian/patches/07_isw_metadata_normal_state.patch
deleted file mode 100644
index 74d2bca..0000000
--- a/debian/patches/07_isw_metadata_normal_state.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-Author: Giuseppe Iuculano <giuseppe at iuculano.it>
-Description: Fix Metadata is not put in the NORMAL state after dmraid rebuild is started manually
-             (Origin: Upstream)
---- a/1.0.0.rc15/lib/misc/init.c
-+++ b/1.0.0.rc15/lib/misc/init.c
-@@ -15,7 +15,7 @@ libdmraid_init(int argc, char **argv)
- {
- 	struct lib_context *lc;
- 
--	dso = (argv[0] && strcmp(argv[0], "dso")) ? 1 : 0;
-+	dso = (argv[0] && !strcmp(argv[0], "dso")) ? 1 : 0;
- 
- 	if ((lc = alloc_lib_context(argv))) {
- 		if (!register_format_handlers(lc)) {
diff --git a/debian/patches/08_isw_rebuild.patch b/debian/patches/08_isw_rebuild.patch
deleted file mode 100644
index d8b647e..0000000
--- a/debian/patches/08_isw_rebuild.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-Author: Giuseppe Iuculano <giuseppe at iuculano.it>
-Description: Fix ISW Metadata is corrupted after rebuilding is started
-             (Origin: Upstream)
---- a/1.0.0.rc15/lib/format/ataraid/isw.c
-+++ b/1.0.0.rc15/lib/format/ataraid/isw.c
-@@ -2387,14 +2387,13 @@ update_metadata_isw_dev(struct isw *new_
- 	 * a new function 'raid_is_rebuildable()'.
- 	 */
- 	((struct isw_map *)
--	 ((void *) &new_dev->vol.map + map_size))->map_state =
-+	 ((void *) &new_dev->vol.map) + map_size)->map_state =
- 		new_dev->vol.map.raid_level == ISW_T_RAID0 ?
- 		ISW_T_STATE_FAILED : ISW_T_STATE_DEGRADED;
- 
- 	return (unsigned)
--		((unsigned long) &new_dev->vol.map + 2 * map_size) -
--		((unsigned long) new_isw->disk + new_isw->num_disks) -
--		isw_dev_offs;
-+		((unsigned long) (((void*) &new_dev->vol.map) + 2 * map_size)) -
-+		((unsigned long) new_dev);
- }
- 
- /* Update metadata wit hdrive to rebuild. */
diff --git a/debian/patches/09_promise-add-offsets.patch b/debian/patches/09_promise-add-offsets.patch
index 5d3c461..5c5c6b6 100644
--- a/debian/patches/09_promise-add-offsets.patch
+++ b/debian/patches/09_promise-add-offsets.patch
@@ -1,13 +1,13 @@
 Author: Luke Yelavich <themuso at ubuntu.com>
 Description: Add extra offsets where promise metadata can be found.
---- a/1.0.0.rc15/lib/format/ataraid/pdc.h
-+++ b/1.0.0.rc15/lib/format/ataraid/pdc.h
+--- a/1.0.0.rc16/lib/format/ataraid/pdc.h
++++ b/1.0.0.rc16/lib/format/ataraid/pdc.h
 @@ -13,7 +13,7 @@
  
  #include <stdint.h>
  
--#define PDC_CONFIGOFFSETS	63,255,256,16,399,675,735,974,991
-+#define PDC_CONFIGOFFSETS	63,255,256,16,399,675,735,974,991,911,974,591
+-#define PDC_CONFIGOFFSETS	63,255,256,16,399,591,675,735,974,991
++#define PDC_CONFIGOFFSETS	63,255,256,16,399,591,675,735,974,991,911
  #define	PDC_DATAOFFSET 0
  
  /*
diff --git a/debian/patches/10_exit_code.patch b/debian/patches/10_exit_code.patch
index b74bdfb..7633664 100644
--- a/debian/patches/10_exit_code.patch
+++ b/debian/patches/10_exit_code.patch
@@ -1,8 +1,8 @@
 Author: Giuseppe Iuculano <giuseppe at iuculano.it>
 Description: Fix exit-code for "No RAID disks" and "no block devices found" errors (LP: #300825)
---- a/1.0.0.rc15/lib/metadata/metadata.c
-+++ b/1.0.0.rc15/lib/metadata/metadata.c
-@@ -2092,7 +2092,7 @@ get_metadata(struct lib_context *lc, enu
+--- a/1.0.0.rc16/lib/metadata/metadata.c
++++ b/1.0.0.rc16/lib/metadata/metadata.c
+@@ -2096,7 +2096,7 @@ get_metadata(struct lib_context *lc, enu
  
  	if (!count_devices(lc, DEVICE)) {
  		log_print(lc, "no block devices found");
@@ -11,7 +11,7 @@ Description: Fix exit-code for "No RAID disks" and "no block devices found" erro
  	}
  
  	if (!(M_RAID & p->metadata))
-@@ -2114,7 +2114,7 @@ get_metadata(struct lib_context *lc, enu
+@@ -2118,7 +2118,7 @@ get_metadata(struct lib_context *lc, enu
  	if (!OPT_HOT_SPARE_SET(lc) && !OPT_CREATE(lc)
  	    && !count_devices(lc, RAID)) {
  		format_error(lc, "disks", argv);
diff --git a/debian/patches/11_isw-raid10.patch b/debian/patches/11_isw-raid10.patch
deleted file mode 100644
index 1c21091..0000000
--- a/debian/patches/11_isw-raid10.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-Author: Giuseppe Iuculano <giuseppe at iuculano.it>
-Description: Fix mismatch between BIOS and dmraid's view of ISW raid 10 sets
-		(Origin: Fedora)
---- a/1.0.0.rc15/lib/format/ataraid/isw.c
-+++ b/1.0.0.rc15/lib/format/ataraid/isw.c
-@@ -155,7 +155,7 @@ name(struct lib_context *lc, struct raid
- 
- 			while (i--) {
- 				if (disk == isw->disk + i) {
--					id = i % 2;
-+					id = i / 2;
- 					goto ok;
- 				}
- 			}
diff --git a/debian/patches/12_support_virtio_devices.patch b/debian/patches/12_support_virtio_devices.patch
index b5ad558..a83274c 100644
--- a/debian/patches/12_support_virtio_devices.patch
+++ b/debian/patches/12_support_virtio_devices.patch
@@ -1,7 +1,7 @@
 Author: Luke Yelavich <themuso at ubuntu.com>
 Description: Support for checking virtio devices for dmraid metadata.
---- a/1.0.0.rc15/lib/device/scan.c
-+++ b/1.0.0.rc15/lib/device/scan.c
+--- a/1.0.0.rc16/lib/device/scan.c
++++ b/1.0.0.rc16/lib/device/scan.c
 @@ -174,7 +174,7 @@ interested(struct lib_context *lc, char 
  	 * Whole IDE and SCSI disks only.
  	 */
diff --git a/debian/patches/13_rm_partitions.patch b/debian/patches/13_rm_partitions.patch
deleted file mode 100644
index a3b3b70..0000000
--- a/debian/patches/13_rm_partitions.patch
+++ /dev/null
@@ -1,236 +0,0 @@
-Author: Giuseppe Iuculano <giuseppe at iuculano.it>
-Description: Add patch adding --rm_partitions cmdline option and functionality
-		(Origin Fedora)
---- a/1.0.0.rc15/include/dmraid/lib_context.h
-+++ b/1.0.0.rc15/include/dmraid/lib_context.h
-@@ -169,6 +169,7 @@ enum action {
- 	PARTCHAR = 0x20000000,
- 
- #endif
-+	RMPARTITIONS = 0x40000000,
- };
- 
- /* Arguments allowed ? */
---- a/1.0.0.rc15/lib/Makefile.in
-+++ b/1.0.0.rc15/lib/Makefile.in
-@@ -12,6 +12,7 @@ SOURCES=\
- 	activate/activate.c \
- 	activate/devmapper.c \
- 	device/ata.c \
-+	device/partition.c \
- 	device/scan.c \
- 	device/scsi.c \
- 	display/display.c \
---- a/1.0.0.rc15/lib/device/dev-io.h
-+++ b/1.0.0.rc15/lib/device/dev-io.h
-@@ -19,5 +19,6 @@
- 
- int discover_devices(struct lib_context *lc, char **devnodes);
- int removable_device(struct lib_context *lc, char *dev_path);
-+int remove_device_partitions(struct lib_context *lc, void *rs, int dummy);
- 
- #endif
---- /dev/null
-+++ b/1.0.0.rc15/lib/device/partition.c
-@@ -0,0 +1,59 @@
-+/*
-+ * Copyright (C) 2009  Hans de Goede <hdegoede at redhat.com>, Red Hat Inc.
-+ *                     All rights reserved.
-+ *
-+ * See file LICENSE at the top of this source tree for license information.
-+ */
-+#include <linux/blkpg.h>
-+#include <sys/ioctl.h>
-+#include <errno.h>
-+#include <fcntl.h>
-+#include "internal.h"
-+
-+static int
-+_remove_subset_partitions(struct lib_context *lc, struct raid_set *rs)
-+{
-+	struct raid_dev *rd;
-+	struct blkpg_partition part = { 0, };
-+	struct blkpg_ioctl_arg io = {
-+		.op = BLKPG_DEL_PARTITION,
-+		.datalen = sizeof(part),
-+		.data = &part,
-+	};
-+
-+	list_for_each_entry(rd, &rs->devs, devs) {
-+		int fd = open(rd->di->path, O_RDWR);
-+		if (fd < 0)
-+			LOG_ERR(lc, 0, "opening %s: %s\n", rd->di->path,
-+				strerror(errno));
-+
-+		/* There is no way to enumerate partitions */
-+		for (part.pno = 1; part.pno <= 256; part.pno++) {
-+			if (ioctl(fd, BLKPG, &io) < 0 && errno != ENXIO &&
-+					(part.pno < 16 || errno != EINVAL))
-+				LOG_ERR(lc, 0,
-+					"removing part %d from %s: %s\n",
-+					part.pno, rd->di->path,
-+					strerror(errno));
-+		}
-+	}
-+	return 1;
-+}
-+
-+/* Remove the partition block devices (ie sda1) from block devices (ie sda)
-+   used in the set, so that things like hal / blkid won't try to access the
-+   disks directly */
-+int
-+remove_device_partitions(struct lib_context *lc, void *v, int dummy)
-+{
-+	struct raid_set *subset, *rs = v;
-+
-+	/* Recursively walk down the chain of stacked RAID sets */
-+	list_for_each_entry(subset, &rs->sets, list) {
-+		/* Remove partitions from devices of set below this one */
-+		if (!T_GROUP(rs) && !remove_device_partitions(lc, subset, 0))
-+			return 0;
-+	}
-+
-+	return _remove_subset_partitions(lc, rs);
-+}
---- a/1.0.0.rc15/lib/metadata/metadata.c
-+++ b/1.0.0.rc15/lib/metadata/metadata.c
-@@ -2147,6 +2147,9 @@ lib_perform(struct lib_context *lc, enum
- 	if (get_metadata(lc, action, p, argv))
- 		ret = p->post(lc, p->pre ? p->pre(p->arg) : p->arg);
- 
-+	if (ret && (RMPARTITIONS & action))
-+		process_sets(lc, remove_device_partitions, 0, SETS);
-+
- 	if (LOCK == p->lock)
- 		unlock_resource(lc, NULL);
- 
---- a/1.0.0.rc15/tools/commands.c
-+++ b/1.0.0.rc15/tools/commands.c
-@@ -38,7 +38,7 @@ static char const *short_opts = "a:hipP:
- #endif
- 	"rR:s::tv"
- #endif
--	"VC:S::";
-+	"VC:S::Z";
- 
- #ifdef HAVE_GETOPTLONG
- static struct option long_opts[] = {
-@@ -73,6 +73,7 @@ static struct option long_opts[] = {
- 	{"version", no_argument, NULL, 'V'},
- 	{"create", required_argument, NULL, 'C'},
- 	{"spare", optional_argument, NULL, 'S'},
-+	{"rm_partitions", no_argument, NULL, 'Z'},
- 	{NULL, no_argument, NULL, 0}
- };
- #endif /* #ifdef HAVE_GETOPTLONG */
-@@ -209,6 +210,7 @@ help(struct lib_context *lc, int arg)
- 		  "\t[-f|--format FORMAT[,FORMAT...]]\n"
- 		  "\t[-P|--partchar CHAR]\n"
- 		  "\t[-p|--no_partitions]\n"
-+		  "\t[-Z|--rm_partitions]\n"
- 		  "\t[--separator SEPARATOR]\n" "\t[RAID-set...]\n", c);
- 	log_print(lc, "%s\t{-h|--help}\n", c);
- 	log_print(lc, "%s\t{-V/--version}\n", c);
-@@ -221,7 +223,7 @@ help(struct lib_context *lc, int arg)
- 		  "\t[-f|--format FORMAT[,FORMAT...]]\n"
- 		  "\t[-P|--partchar CHAR]\n" "\t[-p|--no_partitions]\n"
- 		  "\t[--separator SEPARATOR]\n" "\t[-t|--test]\n"
--		  "\t[RAID-set...]\n", c);
-+		  "\t[-Z|--rm_partitions] [RAID-set...]\n", c);
- 	log_print(lc,
- 		  "%s\t{-b|--block_devices} *\n"
- 		  "\t[-c|--display_columns][FIELD[,FIELD...]]...\n"
-@@ -274,7 +276,7 @@ static struct actions actions[] = {
- 	 UNDEF,			/* Set in check_activate() by mandatory option argument. */
- 	 UNDEF,
- 	 ACTIVATE | DEACTIVATE | FORMAT | HELP | IGNORELOCKING | NOPARTITIONS |
--	 SEPARATOR
-+	 SEPARATOR | RMPARTITIONS
- #ifndef DMRAID_MINI
- 	 | DBG | TEST | VERBOSE
- #endif
-@@ -293,7 +295,8 @@ static struct actions actions[] = {
- #  endif
- 	 | RAID_DEVICES | RAID_SETS,
- 	 ACTIVE | INACTIVE | COLUMN | DBG | DUMP | DMERASE | GROUP | HELP |
--	 IGNORELOCKING | NOPARTITIONS | SEPARATOR | TEST | VERBOSE
-+	 IGNORELOCKING | NOPARTITIONS | SEPARATOR | TEST | VERBOSE |
-+	 RMPARTITIONS
- #else
- 	 , UNDEF
- #endif
-@@ -310,7 +313,7 @@ static struct actions actions[] = {
- 	{'P',
- 	 PARTCHAR,
- 	 ACTIVATE | DEACTIVATE,
--	 FORMAT | HELP | IGNORELOCKING | SEPARATOR
-+	 FORMAT | HELP | IGNORELOCKING | SEPARATOR | RMPARTITIONS
- #ifndef DMRAID_MINI
- 	 | DBG | TEST | VERBOSE
- #endif
-@@ -323,7 +326,7 @@ static struct actions actions[] = {
- 	{'p',
- 	 NOPARTITIONS,
- 	 ACTIVATE | DEACTIVATE,
--	 FORMAT | HELP | IGNORELOCKING | SEPARATOR
-+	 FORMAT | HELP | IGNORELOCKING | SEPARATOR | RMPARTITIONS
- #ifndef DMRAID_MINI
- 	 | DBG | TEST | VERBOSE
- #endif
-@@ -573,6 +576,15 @@ static struct actions actions[] = {
- 	 check_spare_argument,
- 	 LC_HOT_SPARE_SET,
- 	 },
-+	{'Z',
-+	 RMPARTITIONS,
-+	 ACTIVATE, /* We cannot undo this on DEACTIVATE ! */
-+	 DBG | FORMAT | HELP | IGNORELOCKING | NOPARTITIONS | VERBOSE |
-+	 SEPARATOR,
-+	 ARGS,
-+	 NULL,
-+	 0,
-+	 },
- };
- 
- /*
---- a/1.0.0.rc15/man/dmraid.8
-+++ b/1.0.0.rc15/man/dmraid.8
-@@ -8,6 +8,7 @@ dmraid \- discover, configure and activa
-  [\-f|--format FORMAT[,FORMAT...]]
-  [{-P|--partchar} CHAR]
-  [\-p|--no_partitions]
-+ [\-Z|--rm_partitions]
-  [\--separator SEPARATOR]
-  [\-t|--test]
-  [RAID-set...]
-@@ -110,7 +111,11 @@ In case metadata format handlers are cho
- Useful if devices have multiple metadata signatures.
- When activating RAID sets,
- .B -p
--disables the activation of partitions on them.
-+disables the activation of partitions on them, and
-+.B -Z
-+will make dmraid tell the kernel to remove the partitions from the disks
-+underlying the set, ie if sda is part of the set, remove sda1, sda2, etc.
-+This prevents applications from directly accessing the disks bypassing dmraid.
- RAID set names given on command line don't need to be fully specified
- (eg, "dmraid \-ay sil" would activate all discovered Silicon Image Medley
- RAID sets).
-@@ -160,7 +165,7 @@ See
- .B -l
- for a list of supported format handler names. This is useful to
- select particular formats in case multiple metadata signatures are found
--on a device. A comma seperated list of format names can be specified which 
-+on a device. A comma separated list of format names can be specified which 
- may not contain white space.
- 
- .TP
-@@ -178,7 +183,7 @@ List all available metadata format handl
- descriptions. Supported RAID levels are listed in parenthesis:
- .br
- 
--S: Span (concatination)
-+S: Span (concatenation)
- .br
- 0: RAID0 (stripe)
- .br
diff --git a/debian/patches/14_isw-serial-fix.patch b/debian/patches/14_isw-serial-fix.patch
deleted file mode 100644
index eaae976..0000000
--- a/debian/patches/14_isw-serial-fix.patch
+++ /dev/null
@@ -1,91 +0,0 @@
-Author: Hans de Goede <hdegoede at redhat.com>
-Description: Change the serial number scan to only look at the LAST 16 bytes rather than the first
-                (LP: #267953)
-		https://bugzilla.redhat.com/show_bug.cgi?id=490121
---- a/1.0.0.rc15/lib/format/ataraid/isw.c
-+++ b/1.0.0.rc15/lib/format/ataraid/isw.c
-@@ -81,15 +81,43 @@ is_raid10(struct isw_dev *dev)
- }
- 
- /* Find a disk table slot by serial number. */
-+static const char *dev_info_serial_to_isw(const char *di_serial)
-+{
-+	static char isw_serial[1024];
-+
-+	int i, isw_serial_len = 0;
-+
-+	for (i = 0; di_serial[i] && isw_serial_len < 1023; i++) {
-+		if (((unsigned char)di_serial[i]) > 0x20) {
-+			/* ':' is reserved for use in placeholder serial
-+			 * numbers for missing disks */
-+			if (di_serial[i] == ':')
-+				isw_serial[isw_serial_len] = ';';
-+			else
-+				isw_serial[isw_serial_len] = di_serial[i];
-+			isw_serial_len++;
-+		}
-+	}
-+	isw_serial[isw_serial_len] = 0;
-+
-+	if (isw_serial_len > MAX_RAID_SERIAL_LEN)
-+		memmove(isw_serial,
-+			isw_serial + (isw_serial_len - MAX_RAID_SERIAL_LEN),
-+			MAX_RAID_SERIAL_LEN);
-+
-+	return isw_serial;
-+}
-+
- static struct isw_disk *
- _get_disk(struct isw *isw, struct dev_info *di)
- {
- 	if (di->serial) {
- 		int i = isw->num_disks;
- 		struct isw_disk *disk = isw->disk;
-+		const char *isw_serial = dev_info_serial_to_isw(di->serial);
- 
- 		while (i--) {
--			if (!strncmp(di->serial, (const char *) disk[i].serial,
-+			if (!strncmp(isw_serial, (const char *) disk[i].serial,
- 				     MAX_RAID_SERIAL_LEN))
- 				return disk + i;
- 		}
-@@ -866,7 +894,8 @@ rd_by_serial(struct raid_set *rs, const 
- 
- 	list_for_each_entry(rd, &rs->devs, devs) {
- 		if (rd->di &&
--		    !strncmp(rd->di->serial, serial, MAX_RAID_SERIAL_LEN))
-+		    !strncmp(dev_info_serial_to_isw(rd->di->serial), serial,
-+						    MAX_RAID_SERIAL_LEN))
- 			return rd;
- 	}
- 
-@@ -1297,7 +1326,8 @@ isw_config_disks(struct lib_context *lc,
- 	struct raid_dev *rd;
- 
- 	list_for_each_entry(rd, &rs->devs, devs) {
--		strncpy((char *) disk[i].serial, rd->di->serial,
-+		strncpy((char *) disk[i].serial,
-+			dev_info_serial_to_isw(rd->di->serial),
- 			MAX_RAID_SERIAL_LEN);
- 		disk[i].totalBlocks = rd->di->sectors;
- 
-@@ -2420,7 +2450,8 @@ update_metadata(struct lib_context *lc, 
- 	while (i--) {
- 		/* Check if the disk is listed. */
- 		list_for_each_entry(di, LC_DI(lc), list) {
--			if (!strncmp(di->serial, (const char *) disk[i].serial,
-+			if (!strncmp(dev_info_serial_to_isw(di->serial),
-+				     (const char *) disk[i].serial,
- 				     MAX_RAID_SERIAL_LEN))
- 				goto goon;
- 		}
-@@ -2516,7 +2547,8 @@ update_metadata(struct lib_context *lc, 
- 	new_disk->status = CONFIG_ON_DISK |
- 		DISK_SMART_EVENT_SUPPORTED |
- 		CLAIMED_DISK | DETECTED_DISK | USABLE_DISK | CONFIGURED_DISK;
--	strncpy((char *) new_disk->serial, di->serial, MAX_RAID_SERIAL_LEN);
-+	strncpy((char *) new_disk->serial, dev_info_serial_to_isw(di->serial),
-+		MAX_RAID_SERIAL_LEN);
- 
- 	/* build new isw_disk array */
- 	for (i = 0; i < isw->num_disks; i++) {
diff --git a/debian/patches/15_activate_multiple_raid_sets.patch b/debian/patches/15_activate_multiple_raid_sets.patch
index a5fa879..3a5c823 100644
--- a/debian/patches/15_activate_multiple_raid_sets.patch
+++ b/debian/patches/15_activate_multiple_raid_sets.patch
@@ -1,6 +1,6 @@
 Continue onto all raid sets instead of returning after processing the first. (LP: #401713)
---- a/1.0.0.rc15/lib/metadata/metadata.c
-+++ b/1.0.0.rc15/lib/metadata/metadata.c
+--- a/1.0.0.rc16/lib/metadata/metadata.c
++++ b/1.0.0.rc16/lib/metadata/metadata.c
 @@ -839,7 +839,7 @@ _discover_partitions(struct lib_context 
  		 */
  		if (T_GROUP(rs)) {
diff --git a/debian/patches/16_fix_isw_sectors_calculation.patch b/debian/patches/16_fix_isw_sectors_calculation.patch
deleted file mode 100644
index ff96880..0000000
--- a/debian/patches/16_fix_isw_sectors_calculation.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-Fix for #524637. Do not subtract RAID_DS_JOURNAL
---- a/1.0.0.rc15/lib/format/ataraid/isw.c
-+++ b/1.0.0.rc15/lib/format/ataraid/isw.c
-@@ -695,7 +695,9 @@ _create_rd(struct lib_context *lc,
- 	r->di = rd->di;
- 	r->fmt = rd->fmt;
- 	r->offset = dev->vol.map.pba_of_lba0;
--	if ((r->sectors = dev->vol.map.blocks_per_member - RAID_DS_JOURNAL))
-+	/* Fix for #524637. Do not subtract RAID_DS_JOURNAL
-+	if ((r->sectors = dev->vol.map.blocks_per_member - RAID_DS_JOURNAL)) */
-+	if ((r->sectors = dev->vol.map.blocks_per_member))
- 		goto out;
- 
- 	log_zero_sectors(lc, rd->di->path, handler);
diff --git a/debian/patches/17_isw-probe-hpa.patch b/debian/patches/17_isw-probe-hpa.patch
index cad7703..f1a770e 100644
--- a/debian/patches/17_isw-probe-hpa.patch
+++ b/debian/patches/17_isw-probe-hpa.patch
@@ -1,9 +1,7 @@
 Probe isw disks with [some] HPA awareness, thanks to Robert Collins <robert at ubuntu.com>. (LP: #372170)
-Index: dmraid-1.0.0.rc15/1.0.0.rc15/lib/format/ataraid/isw.c
-===================================================================
---- dmraid-1.0.0.rc15.orig/1.0.0.rc15/lib/format/ataraid/isw.c	2009-05-16 20:02:46.000000000 +1000
-+++ dmraid-1.0.0.rc15/1.0.0.rc15/lib/format/ataraid/isw.c	2009-05-16 20:02:50.000000000 +1000
-@@ -328,6 +328,7 @@
+--- a/1.0.0.rc16/lib/format/ataraid/isw.c
++++ b/1.0.0.rc16/lib/format/ataraid/isw.c
+@@ -353,6 +353,7 @@ raiddev(struct isw *isw, unsigned i)
  enum convert { FULL, FIRST, LAST };
  #if	BYTE_ORDER == LITTLE_ENDIAN
  #  define	to_cpu(x, y)
@@ -11,7 +9,7 @@ Index: dmraid-1.0.0.rc15/1.0.0.rc15/lib/format/ataraid/isw.c
  #else
  /*
   * We can differ from the read_raid_dev template here,
-@@ -524,15 +525,16 @@
+@@ -547,15 +548,16 @@ disk_ok(struct lib_context *lc, struct d
  }
  
  static void *
@@ -32,7 +30,7 @@ Index: dmraid-1.0.0.rc15/1.0.0.rc15/lib/format/ataraid/isw.c
  		goto out;
  
  	/*
-@@ -542,9 +544,15 @@
+@@ -565,9 +567,15 @@ isw_read_metadata(struct lib_context *lc
  	to_cpu(isw, FIRST);
  
  	/* Check Signature and read optional extended metadata. */
@@ -50,7 +48,7 @@ Index: dmraid-1.0.0.rc15/1.0.0.rc15/lib/format/ataraid/isw.c
  
  	/*
  	 * Now that we made sure, that we've got all the
-@@ -555,6 +563,8 @@
+@@ -578,6 +586,8 @@ isw_read_metadata(struct lib_context *lc
  	if (disk_ok(lc, di, isw)) {
  		*sz = size;
  		*offset = info->u64 = isw_sboffset;
@@ -59,7 +57,7 @@ Index: dmraid-1.0.0.rc15/1.0.0.rc15/lib/format/ataraid/isw.c
  		goto out;
  	}
  
-@@ -566,6 +576,54 @@
+@@ -589,6 +599,54 @@ out:
  	return (void *) isw;
  }
  
@@ -114,11 +112,9 @@ Index: dmraid-1.0.0.rc15/1.0.0.rc15/lib/format/ataraid/isw.c
  static int setup_rd(struct lib_context *lc, struct raid_dev *rd,
  		    struct dev_info *di, void *meta, union read_info *info);
  static struct raid_dev *
-Index: dmraid-1.0.0.rc15/1.0.0.rc15/lib/format/ataraid/isw.h
-===================================================================
---- dmraid-1.0.0.rc15.orig/1.0.0.rc15/lib/format/ataraid/isw.h	2009-05-16 20:02:46.000000000 +1000
-+++ dmraid-1.0.0.rc15/1.0.0.rc15/lib/format/ataraid/isw.h	2009-05-16 20:02:50.000000000 +1000
-@@ -35,8 +35,11 @@
+--- a/1.0.0.rc16/lib/format/ataraid/isw.h
++++ b/1.0.0.rc16/lib/format/ataraid/isw.h
+@@ -36,8 +36,11 @@
  
  /* Intel metadata offset in bytes */
  #define	ISW_CONFIGSECTOR(di)	((di)->sectors - 2)
@@ -131,7 +127,7 @@ Index: dmraid-1.0.0.rc15/1.0.0.rc15/lib/format/ataraid/isw.h
  
  #define MPB_SIGNATURE	     "Intel Raid ISM Cfg Sig. "
  #define MPB_SIGNATURE_SIZE	(sizeof(MPB_SIGNATURE) - 1)
-@@ -209,6 +212,14 @@
+@@ -222,6 +225,14 @@ struct isw {
  	// here comes isw_dev[num_raid_devs]
  } __attribute__ ((packed));
  
diff --git a/debian/patches/series b/debian/patches/series
index a776862..1109ef1 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,17 +1,9 @@
 01_fix_broken_linking.patch
-02_scsi_serial_remove_ws.patch
+02_disable_dmreg.patch
 03_fix_hyphen-used-as-minus-sign.patch
 04_do_not_use_p_for_partition.patch
-05_jmicron-name-fix.patch
-06_fix_led_support_compilation.patch
-07_isw_metadata_normal_state.patch
-08_isw_rebuild.patch
 09_promise-add-offsets.patch
 10_exit_code.patch
-11_isw-raid10.patch
 12_support_virtio_devices.patch
-13_rm_partitions.patch
-14_isw-serial-fix.patch
-16_fix_isw_sectors_calculation.patch
 17_isw-probe-hpa.patch
 15_activate_multiple_raid_sets.patch

-- 
Maintenance of the dmraid package



More information about the Dmraid-debian-commits mailing list