linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] linear does not need chunksize
@ 2005-07-16 23:12 Michael Tokarev
  2005-07-16 23:22 ` Neil Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Tokarev @ 2005-07-16 23:12 UTC (permalink / raw)
  To: linux-raid

When debugging some weird raid failure case, we come
across a problem when kernel disallows assembling a
linear array with zero chunksize, printing
'no chunksize specified' in dmesg and mdadm failing
with EINVAL.  The following patch fixes the problem
(the patch is with large context to show why the change).

Note chunk size is never used on linear array.  The
only usage of chunk_size member is in /proc/mdstat,
as "rounding" parameter (linear.c) - looks like it
should be removed too.

Signed-Off-By: Michael Tokarev <mjt@tls.msk.ru>

--- linux-2.6.12/drivers/md/md.c.orig	2005-06-17 23:48:29.000000000 +0400
+++ linux-2.6.12/drivers/md/md.c	2005-07-17 03:07:05.000000000 +0400
@@ -1516,21 +1516,21 @@ static int do_md_run(mddev_t * mddev)
 
 	/*
 	 * Analyze all RAID superblock(s)
 	 */
 	if (!mddev->raid_disks)
 		analyze_sbs(mddev);
 
 	chunk_size = mddev->chunk_size;
 	pnum = level_to_pers(mddev->level);
 
-	if ((pnum != MULTIPATH) && (pnum != RAID1)) {
+	if ((pnum != MULTIPATH) && (pnum != RAID1) && (pnum != LINEAR)) {
 		if (!chunk_size) {
 			/*
 			 * 'default chunksize' in the old md code used to
 			 * be PAGE_SIZE, baaad.
 			 * we abort here to be on the safe side. We don't
 			 * want to continue the bad practice.
 			 */
 			printk(KERN_ERR 
 				"no chunksize specified, see 'man raidtab'\n");
 			return -EINVAL;

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

* Re: [patch] linear does not need chunksize
  2005-07-16 23:12 [patch] linear does not need chunksize Michael Tokarev
@ 2005-07-16 23:22 ` Neil Brown
  2005-07-16 23:50   ` Michael Tokarev
  0 siblings, 1 reply; 3+ messages in thread
From: Neil Brown @ 2005-07-16 23:22 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: linux-raid

On Sunday July 17, mjt@tls.msk.ru wrote:
> When debugging some weird raid failure case, we come
> across a problem when kernel disallows assembling a
> linear array with zero chunksize, printing
> 'no chunksize specified' in dmesg and mdadm failing
> with EINVAL.  The following patch fixes the problem
> (the patch is with large context to show why the change).
> 
> Note chunk size is never used on linear array.  The
> only usage of chunk_size member is in /proc/mdstat,
> as "rounding" parameter (linear.c) - looks like it
> should be removed too.

This statement isn't entirely true, though it took me a little while
to remind myself exactly how linear.c does use chunk_size.

linear_run in linear.c uses rdev->size for each devices.
in md.c rdev->size is set by a call to calc_dev_size()
calc_dev_size *does* use chunk_size (if it is non-zero)

However that doesn't make your patch wrong, as a zero chunk size
certainly seems to be handled correctly by linear.  However I might
spend a little while reviewing that aspect of the code before I pass
on this patch.

Thanks,
NeilBrown


> 
> Signed-Off-By: Michael Tokarev <mjt@tls.msk.ru>
> 
> --- linux-2.6.12/drivers/md/md.c.orig	2005-06-17 23:48:29.000000000 +0400
> +++ linux-2.6.12/drivers/md/md.c	2005-07-17 03:07:05.000000000 +0400
> @@ -1516,21 +1516,21 @@ static int do_md_run(mddev_t * mddev)
>  
>  	/*
>  	 * Analyze all RAID superblock(s)
>  	 */
>  	if (!mddev->raid_disks)
>  		analyze_sbs(mddev);
>  
>  	chunk_size = mddev->chunk_size;
>  	pnum = level_to_pers(mddev->level);
>  
> -	if ((pnum != MULTIPATH) && (pnum != RAID1)) {
> +	if ((pnum != MULTIPATH) && (pnum != RAID1) && (pnum != LINEAR)) {
>  		if (!chunk_size) {
>  			/*
>  			 * 'default chunksize' in the old md code used to
>  			 * be PAGE_SIZE, baaad.
>  			 * we abort here to be on the safe side. We don't
>  			 * want to continue the bad practice.
>  			 */
>  			printk(KERN_ERR 
>  				"no chunksize specified, see 'man raidtab'\n");
>  			return -EINVAL;
> -
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [patch] linear does not need chunksize
  2005-07-16 23:22 ` Neil Brown
@ 2005-07-16 23:50   ` Michael Tokarev
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Tokarev @ 2005-07-16 23:50 UTC (permalink / raw)
  To: Neil Brown; +Cc: linux-raid

Neil Brown wrote:
> On Sunday July 17, mjt@tls.msk.ru wrote:
[]
>>Note chunk size is never used on linear array.  The
>>only usage of chunk_size member is in /proc/mdstat,
>>as "rounding" parameter (linear.c) - looks like it
>>should be removed too.
> 
> This statement isn't entirely true, though it took me a little while
> to remind myself exactly how linear.c does use chunk_size.
> 
> linear_run in linear.c uses rdev->size for each devices.
> in md.c rdev->size is set by a call to calc_dev_size()
> calc_dev_size *does* use chunk_size (if it is non-zero)

Aha.

Well, in that case, the whole stuff around that check should
be reviewed.  At least, all the various raid levels should
have device size to be at least PAGE_SIZE (as checked in the
code fragment surrounded by this if() statement).

BTW, I don't really know how we got zero chunksize in the
superblock in the first place.  It was evms who screwed up
3-components linear array somehow (which worked before),
and, since I for one know nothing about evms, we tried to
assemble it with mdadm, which failed due to this very check
in kernel.  So we were forced to re-create the array to
work around this in-kernel check (since for linear array
recreate operation is safe and leaves the data intact).

So maybe the whole issue is moot: how often do you see
an array with zero chunk-size?

Thanks.

/mjt

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

end of thread, other threads:[~2005-07-16 23:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-16 23:12 [patch] linear does not need chunksize Michael Tokarev
2005-07-16 23:22 ` Neil Brown
2005-07-16 23:50   ` Michael Tokarev

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).