All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IMSM: move "validate_container_imsm" to be included in mdassemble
@ 2014-07-18 15:01 Pawel Baldysiak
  2014-07-21  6:57 ` NeilBrown
  0 siblings, 1 reply; 4+ messages in thread
From: Pawel Baldysiak @ 2014-07-18 15:01 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid, pawel.baldysiak, artur.paszkiewicz, ssuominen

Commit 0c21b485e4beb7bcfe631412a231f7c1ea1067bc added new
function in imsm superswitch. This function should be
included in mdassemble.

Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
---
 super-intel.c |   82 +++++++++++++++++++++++++++++----------------------------
 1 file changed, 41 insertions(+), 41 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index b4efa72..e28ac7d 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -9048,6 +9048,47 @@ int open_backup_targets(struct mdinfo *info, int raid_disks, int *raid_fds,
 	return 0;
 }
 
+/*******************************************************************************
+ * Function:	validate_container_imsm
+ * Description: This routine validates container after assemble,
+ *		eg. if devices in container are under the same controller.
+ *
+ * Parameters:
+ *	info	: linked list with info about devices used in array
+ * Returns:
+ *	1 : HBA mismatch
+ *	0 : Success
+ ******************************************************************************/
+int validate_container_imsm(struct mdinfo *info)
+{
+	if (!check_env("IMSM_NO_PLATFORM")) {
+		struct sys_dev *idev;
+		struct mdinfo *dev;
+		char *hba_path = NULL;
+		char *dev_path = devt_to_devpath(makedev(info->disk.major,
+										info->disk.minor));
+
+		for (idev = find_intel_devices(); idev; idev = idev->next) {
+			if (strstr(dev_path, idev->path)) {
+				hba_path = idev->path;
+				break;
+			}
+		}
+		free(dev_path);
+
+		if (hba_path) {
+			for (dev = info->next; dev; dev = dev->next) {
+				if (!devt_attached_to_hba(makedev(dev->disk.major,
+						dev->disk.minor), hba_path)) {
+					pr_err("WARNING - IMSM container assembled with disks under different HBAs!\n"
+						"       This operation is not supported and can lead to data loss.\n");
+					return 1;
+				}
+			}
+		}
+	}
+	return 0;
+}
 #ifndef MDASSEMBLE
 /*******************************************************************************
  * Function:	init_migr_record_imsm
@@ -10524,47 +10565,6 @@ abort:
 	return ret_val;
 }
 
-/*******************************************************************************
- * Function:	validate_container_imsm
- * Description: This routine validates container after assemble,
- *		eg. if devices in container are under the same controller.
- *
- * Parameters:
- *	info	: linked list with info about devices used in array
- * Returns:
- *	1 : HBA mismatch
- *	0 : Success
- ******************************************************************************/
-int validate_container_imsm(struct mdinfo *info)
-{
-	if (!check_env("IMSM_NO_PLATFORM")) {
-		struct sys_dev *idev;
-		struct mdinfo *dev;
-		char *hba_path = NULL;
-		char *dev_path = devt_to_devpath(makedev(info->disk.major,
-										info->disk.minor));
-
-		for (idev = find_intel_devices(); idev; idev = idev->next) {
-			if (strstr(dev_path, idev->path)) {
-				hba_path = idev->path;
-				break;
-			}
-		}
-		free(dev_path);
-
-		if (hba_path) {
-			for (dev = info->next; dev; dev = dev->next) {
-				if (!devt_attached_to_hba(makedev(dev->disk.major,
-						dev->disk.minor), hba_path)) {
-					pr_err("WARNING - IMSM container assembled with disks under different HBAs!\n"
-						"       This operation is not supported and can lead to data loss.\n");
-					return 1;
-				}
-			}
-		}
-	}
-	return 0;
-}
 #endif /* MDASSEMBLE */
 
 struct superswitch super_imsm = {


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] IMSM: move "validate_container_imsm" to be included in mdassemble
  2014-07-18 15:01 [PATCH] IMSM: move "validate_container_imsm" to be included in mdassemble Pawel Baldysiak
@ 2014-07-21  6:57 ` NeilBrown
  2014-07-21  7:47   ` Samuli Suominen
  0 siblings, 1 reply; 4+ messages in thread
From: NeilBrown @ 2014-07-21  6:57 UTC (permalink / raw)
  To: Pawel Baldysiak, ssuominen; +Cc: linux-raid, artur.paszkiewicz

[-- Attachment #1: Type: text/plain, Size: 3920 bytes --]

On Fri, 18 Jul 2014 17:01:27 +0200 Pawel Baldysiak
<pawel.baldysiak@intel.com> wrote:

> Commit 0c21b485e4beb7bcfe631412a231f7c1ea1067bc added new
> function in imsm superswitch. This function should be
> included in mdassemble.
> 
> Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
> ---
>  super-intel.c |   82 +++++++++++++++++++++++++++++----------------------------
>  1 file changed, 41 insertions(+), 41 deletions(-)
> 
> diff --git a/super-intel.c b/super-intel.c
> index b4efa72..e28ac7d 100644
> --- a/super-intel.c
> +++ b/super-intel.c
> @@ -9048,6 +9048,47 @@ int open_backup_targets(struct mdinfo *info, int raid_disks, int *raid_fds,
>  	return 0;
>  }
>  
> +/*******************************************************************************
> + * Function:	validate_container_imsm
> + * Description: This routine validates container after assemble,
> + *		eg. if devices in container are under the same controller.
> + *
> + * Parameters:
> + *	info	: linked list with info about devices used in array
> + * Returns:
> + *	1 : HBA mismatch
> + *	0 : Success
> + ******************************************************************************/
> +int validate_container_imsm(struct mdinfo *info)
> +{
> +	if (!check_env("IMSM_NO_PLATFORM")) {
> +		struct sys_dev *idev;
> +		struct mdinfo *dev;
> +		char *hba_path = NULL;
> +		char *dev_path = devt_to_devpath(makedev(info->disk.major,
> +										info->disk.minor));
> +
> +		for (idev = find_intel_devices(); idev; idev = idev->next) {
> +			if (strstr(dev_path, idev->path)) {
> +				hba_path = idev->path;
> +				break;
> +			}
> +		}
> +		free(dev_path);
> +
> +		if (hba_path) {
> +			for (dev = info->next; dev; dev = dev->next) {
> +				if (!devt_attached_to_hba(makedev(dev->disk.major,
> +						dev->disk.minor), hba_path)) {
> +					pr_err("WARNING - IMSM container assembled with disks under different HBAs!\n"
> +						"       This operation is not supported and can lead to data loss.\n");
> +					return 1;
> +				}
> +			}
> +		}
> +	}
> +	return 0;
> +}
>  #ifndef MDASSEMBLE
>  /*******************************************************************************
>   * Function:	init_migr_record_imsm
> @@ -10524,47 +10565,6 @@ abort:
>  	return ret_val;
>  }
>  
> -/*******************************************************************************
> - * Function:	validate_container_imsm
> - * Description: This routine validates container after assemble,
> - *		eg. if devices in container are under the same controller.
> - *
> - * Parameters:
> - *	info	: linked list with info about devices used in array
> - * Returns:
> - *	1 : HBA mismatch
> - *	0 : Success
> - ******************************************************************************/
> -int validate_container_imsm(struct mdinfo *info)
> -{
> -	if (!check_env("IMSM_NO_PLATFORM")) {
> -		struct sys_dev *idev;
> -		struct mdinfo *dev;
> -		char *hba_path = NULL;
> -		char *dev_path = devt_to_devpath(makedev(info->disk.major,
> -										info->disk.minor));
> -
> -		for (idev = find_intel_devices(); idev; idev = idev->next) {
> -			if (strstr(dev_path, idev->path)) {
> -				hba_path = idev->path;
> -				break;
> -			}
> -		}
> -		free(dev_path);
> -
> -		if (hba_path) {
> -			for (dev = info->next; dev; dev = dev->next) {
> -				if (!devt_attached_to_hba(makedev(dev->disk.major,
> -						dev->disk.minor), hba_path)) {
> -					pr_err("WARNING - IMSM container assembled with disks under different HBAs!\n"
> -						"       This operation is not supported and can lead to data loss.\n");
> -					return 1;
> -				}
> -			}
> -		}
> -	}
> -	return 0;
> -}
>  #endif /* MDASSEMBLE */
>  
>  struct superswitch super_imsm = {


Applied, thanks.

Though I do wonder if we really need mdassemble.  Is there a convincing
use-case?

NeilBrown


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] IMSM: move "validate_container_imsm" to be included in mdassemble
  2014-07-21  6:57 ` NeilBrown
@ 2014-07-21  7:47   ` Samuli Suominen
  2014-07-21  8:02     ` Baldysiak, Pawel
  0 siblings, 1 reply; 4+ messages in thread
From: Samuli Suominen @ 2014-07-21  7:47 UTC (permalink / raw)
  To: NeilBrown, Pawel Baldysiak; +Cc: linux-raid, artur.paszkiewicz


On 21/07/14 09:57, NeilBrown wrote:
> On Fri, 18 Jul 2014 17:01:27 +0200 Pawel Baldysiak
> <pawel.baldysiak@intel.com> wrote:
>
>> Commit 0c21b485e4beb7bcfe631412a231f7c1ea1067bc added new
>> function in imsm superswitch. This function should be
>> included in mdassemble.
>>
>> Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
>> ---
>>  super-intel.c |   82 +++++++++++++++++++++++++++++----------------------------
>>  1 file changed, 41 insertions(+), 41 deletions(-)
>>
>> diff --git a/super-intel.c b/super-intel.c
>> index b4efa72..e28ac7d 100644
>> --- a/super-intel.c
>> +++ b/super-intel.c
>> @@ -9048,6 +9048,47 @@ int open_backup_targets(struct mdinfo *info, int raid_disks, int *raid_fds,
>>  	return 0;
>>  }
>>  
>> +/*******************************************************************************
>> + * Function:	validate_container_imsm
>> + * Description: This routine validates container after assemble,
>> + *		eg. if devices in container are under the same controller.
>> + *
>> + * Parameters:
>> + *	info	: linked list with info about devices used in array
>> + * Returns:
>> + *	1 : HBA mismatch
>> + *	0 : Success
>> + ******************************************************************************/
>> +int validate_container_imsm(struct mdinfo *info)
>> +{
>> +	if (!check_env("IMSM_NO_PLATFORM")) {
>> +		struct sys_dev *idev;
>> +		struct mdinfo *dev;
>> +		char *hba_path = NULL;
>> +		char *dev_path = devt_to_devpath(makedev(info->disk.major,
>> +										info->disk.minor));
>> +
>> +		for (idev = find_intel_devices(); idev; idev = idev->next) {
>> +			if (strstr(dev_path, idev->path)) {
>> +				hba_path = idev->path;
>> +				break;
>> +			}
>> +		}
>> +		free(dev_path);
>> +
>> +		if (hba_path) {
>> +			for (dev = info->next; dev; dev = dev->next) {
>> +				if (!devt_attached_to_hba(makedev(dev->disk.major,
>> +						dev->disk.minor), hba_path)) {
>> +					pr_err("WARNING - IMSM container assembled with disks under different HBAs!\n"
>> +						"       This operation is not supported and can lead to data loss.\n");
>> +					return 1;
>> +				}
>> +			}
>> +		}
>> +	}
>> +	return 0;
>> +}
>>  #ifndef MDASSEMBLE
>>  /*******************************************************************************
>>   * Function:	init_migr_record_imsm
>> @@ -10524,47 +10565,6 @@ abort:
>>  	return ret_val;
>>  }
>>  
>> -/*******************************************************************************
>> - * Function:	validate_container_imsm
>> - * Description: This routine validates container after assemble,
>> - *		eg. if devices in container are under the same controller.
>> - *
>> - * Parameters:
>> - *	info	: linked list with info about devices used in array
>> - * Returns:
>> - *	1 : HBA mismatch
>> - *	0 : Success
>> - ******************************************************************************/
>> -int validate_container_imsm(struct mdinfo *info)
>> -{
>> -	if (!check_env("IMSM_NO_PLATFORM")) {
>> -		struct sys_dev *idev;
>> -		struct mdinfo *dev;
>> -		char *hba_path = NULL;
>> -		char *dev_path = devt_to_devpath(makedev(info->disk.major,
>> -										info->disk.minor));
>> -
>> -		for (idev = find_intel_devices(); idev; idev = idev->next) {
>> -			if (strstr(dev_path, idev->path)) {
>> -				hba_path = idev->path;
>> -				break;
>> -			}
>> -		}
>> -		free(dev_path);
>> -
>> -		if (hba_path) {
>> -			for (dev = info->next; dev; dev = dev->next) {
>> -				if (!devt_attached_to_hba(makedev(dev->disk.major,
>> -						dev->disk.minor), hba_path)) {
>> -					pr_err("WARNING - IMSM container assembled with disks under different HBAs!\n"
>> -						"       This operation is not supported and can lead to data loss.\n");
>> -					return 1;
>> -				}
>> -			}
>> -		}
>> -	}
>> -	return 0;
>> -}
>>  #endif /* MDASSEMBLE */
>>  
>>  struct superswitch super_imsm = {
>
> Applied, thanks.
>
> Though I do wonder if we really need mdassemble.  Is there a convincing
> use-case?
>
> NeilBrown
>

This is why we are packaging mdassemble in Gentoo's sys-fs/mdadm package:

http://bugs.gentoo.org/show_bug.cgi?id=211426

Quoting from the bug:

"mdassemble is a lightweight program to assemble raid devices that can
be called directly for an initramfs filesystem. It weights 88ko compiled
statically with dietlibc."

So the use case seems to be initramfs, embedded, minimal systems

- Samuli

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] IMSM: move "validate_container_imsm" to be included in mdassemble
  2014-07-21  7:47   ` Samuli Suominen
@ 2014-07-21  8:02     ` Baldysiak, Pawel
  0 siblings, 0 replies; 4+ messages in thread
From: Baldysiak, Pawel @ 2014-07-21  8:02 UTC (permalink / raw)
  To: Samuli Suominen, NeilBrown; +Cc: linux-raid@vger.kernel.org, Paszkiewicz, Artur

> On Monday, July 21, 2014 9:48 AM Samuli Suominen [mailto:ssuominen@gentoo.org] wrote:
> To: NeilBrown; Baldysiak, Pawel
> Cc: linux-raid@vger.kernel.org; Paszkiewicz, Artur
> Subject: Re: [PATCH] IMSM: move "validate_container_imsm" to be included
> in mdassemble
> 
> 
> On 21/07/14 09:57, NeilBrown wrote:
> > On Fri, 18 Jul 2014 17:01:27 +0200 Pawel Baldysiak
> > <pawel.baldysiak@intel.com> wrote:
> >
> >> Commit 0c21b485e4beb7bcfe631412a231f7c1ea1067bc added new
> function in
> >> imsm superswitch. This function should be included in mdassemble.
> >>
> >> Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
> >> ---
> >>  super-intel.c |   82 +++++++++++++++++++++++++++++--------------------
> --------
> >>  1 file changed, 41 insertions(+), 41 deletions(-)
> >>
> >> diff --git a/super-intel.c b/super-intel.c index b4efa72..e28ac7d
> >> 100644
> >> --- a/super-intel.c
> >> +++ b/super-intel.c
> >> @@ -9048,6 +9048,47 @@ int open_backup_targets(struct mdinfo *info,
> int raid_disks, int *raid_fds,
> >>  	return 0;
> >>  }
> >>
> >>
> +/*********************************************************
> **********************
> >> + * Function:	validate_container_imsm
> >> + * Description: This routine validates container after assemble,
> >> + *		eg. if devices in container are under the same controller.
> >> + *
> >> + * Parameters:
> >> + *	info	: linked list with info about devices used in array
> >> + * Returns:
> >> + *	1 : HBA mismatch
> >> + *	0 : Success
> >> +
> >>
> +*********************************************************
> ***********
> >> +**********/ int validate_container_imsm(struct mdinfo *info) {
> >> +	if (!check_env("IMSM_NO_PLATFORM")) {
> >> +		struct sys_dev *idev;
> >> +		struct mdinfo *dev;
> >> +		char *hba_path = NULL;
> >> +		char *dev_path = devt_to_devpath(makedev(info-
> >disk.major,
> >> +
> 	info->disk.minor));
> >> +
> >> +		for (idev = find_intel_devices(); idev; idev = idev->next) {
> >> +			if (strstr(dev_path, idev->path)) {
> >> +				hba_path = idev->path;
> >> +				break;
> >> +			}
> >> +		}
> >> +		free(dev_path);
> >> +
> >> +		if (hba_path) {
> >> +			for (dev = info->next; dev; dev = dev->next) {
> >> +				if (!devt_attached_to_hba(makedev(dev-
> >disk.major,
> >> +						dev->disk.minor), hba_path))
> {
> >> +					pr_err("WARNING - IMSM container
> assembled with disks under different HBAs!\n"
> >> +						"       This operation is not
> supported and can lead to data loss.\n");
> >> +					return 1;
> >> +				}
> >> +			}
> >> +		}
> >> +	}
> >> +	return 0;
> >> +}
> >>  #ifndef MDASSEMBLE
> >>
> /**********************************************************
> *********************
> >>   * Function:	init_migr_record_imsm
> >> @@ -10524,47 +10565,6 @@ abort:
> >>  	return ret_val;
> >>  }
> >>
> >> -
> /**********************************************************
> *********************
> >> - * Function:	validate_container_imsm
> >> - * Description: This routine validates container after assemble,
> >> - *		eg. if devices in container are under the same controller.
> >> - *
> >> - * Parameters:
> >> - *	info	: linked list with info about devices used in array
> >> - * Returns:
> >> - *	1 : HBA mismatch
> >> - *	0 : Success
> >> -
> >>
> **********************************************************
> ***********
> >> *********/ -int validate_container_imsm(struct mdinfo *info) -{
> >> -	if (!check_env("IMSM_NO_PLATFORM")) {
> >> -		struct sys_dev *idev;
> >> -		struct mdinfo *dev;
> >> -		char *hba_path = NULL;
> >> -		char *dev_path = devt_to_devpath(makedev(info-
> >disk.major,
> >> -
> 	info->disk.minor));
> >> -
> >> -		for (idev = find_intel_devices(); idev; idev = idev->next) {
> >> -			if (strstr(dev_path, idev->path)) {
> >> -				hba_path = idev->path;
> >> -				break;
> >> -			}
> >> -		}
> >> -		free(dev_path);
> >> -
> >> -		if (hba_path) {
> >> -			for (dev = info->next; dev; dev = dev->next) {
> >> -				if (!devt_attached_to_hba(makedev(dev-
> >disk.major,
> >> -						dev->disk.minor), hba_path))
> {
> >> -					pr_err("WARNING - IMSM container
> assembled with disks under different HBAs!\n"
> >> -						"       This operation is not
> supported and can lead to data loss.\n");
> >> -					return 1;
> >> -				}
> >> -			}
> >> -		}
> >> -	}
> >> -	return 0;
> >> -}
> >>  #endif /* MDASSEMBLE */
> >>
> >>  struct superswitch super_imsm = {
> >
> > Applied, thanks.
> >
> > Though I do wonder if we really need mdassemble.  Is there a
> > convincing use-case?
> >
> > NeilBrown
> >
> 
> This is why we are packaging mdassemble in Gentoo's sys-fs/mdadm
> package:
> 
> http://bugs.gentoo.org/show_bug.cgi?id=211426
> 
> Quoting from the bug:
> 
> "mdassemble is a lightweight program to assemble raid devices that can be
> called directly for an initramfs filesystem. It weights 88ko compiled statically
> with dietlibc."
> 
> So the use case seems to be initramfs, embedded, minimal systems
> 
> - Samuli

Hi

Intel does not support mdassemble.
Above fix  was created only to avoid compilation errors.

Thanks
Pawel Baldysiak

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-07-21  8:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-18 15:01 [PATCH] IMSM: move "validate_container_imsm" to be included in mdassemble Pawel Baldysiak
2014-07-21  6:57 ` NeilBrown
2014-07-21  7:47   ` Samuli Suominen
2014-07-21  8:02     ` Baldysiak, Pawel

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.