public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Shailendra Tripathi <stripathi@agami.com>
To: cousins@umit.maine.edu
Cc: "xfs@oss.sgi.com" <xfs@oss.sgi.com>
Subject: Re: swidth with mdadm and RAID6
Date: Wed, 20 Sep 2006 01:49:51 +0530	[thread overview]
Message-ID: <451050E7.40806@agami.com> (raw)
In-Reply-To: <Pine.LNX.4.10.10609191517590.2460-100000@limpet.umeoce.maine.edu>

Steve Cousins wrote:

>>a 2.6.17 kernel.  So, with this in mind, is there a change that I
>>should try in libdisk/md.c?  Tim had suggested:
>>
>>	s/nr_disks/raid_disks/
>>
>>Would this be sufficient? Or should nr_disks be initialized as raid_disks
>>and then go into the switch clause?
>>    
>>
>
>I ended up just adding:
>
>	md.nr_disks = md.raid_disks;
>
>right be fore the switch statement and it worked fine in my situation.
>Not sure how this would work with other kernels etc. but I'll let you
>figure that out.  
>
>Thanks very much for your help.
>
>Steve
>
>  
>
Hi Steve,
             Technically speaking, you are doing the same thing. 
However, just write the function below to avoid any confusion.

int
md_get_subvol_stripe(
	char		*dfile,
	sv_type_t	type,
	int		*sunit,
	int		*swidth,
	int		*sectalign,
	struct stat64	*sb)
{
	if (mnt_is_md_subvol(sb->st_rdev)) {
		struct md_array_info	md;
		int			fd;

		/* Open device */
		fd = open(dfile, O_RDONLY);
		if (fd == -1)
			return 0;

		/* Is this thing on... */
		if (ioctl(fd, GET_ARRAY_INFO, &md)) {
			fprintf(stderr,
				_("Error getting MD array info from %s\n"),
				dfile);
			exit(1);
		}
		close(fd);

		/*
		 * Ignore levels we don't want aligned (e.g. linear)
		 * and deduct disk(s) from stripe width on RAID4/5/6
		 */
		switch (md.level) {
		case 6:
			md.raid_disks--;
			/* fallthrough */
		case 5:
		case 4:
			md.raid_disks--;
			/* fallthrough */
		case 1:
		case 0:
		case 10:
			break;
		default:
			return 0;
		}

		/* Update sizes */
		*sunit = md.chunk_size >> 9;
		*swidth = *sunit * md.raid_disks;
		*sectalign = (md.level == 4 || md.level == 5 || md.level == 6);

		return 1;
	}
	return 0;
}

  reply	other threads:[~2006-09-19 20:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <fc.004c4d192b3470d73b9aca0029fcf469.2b349301@umit.maine.edu>
2006-09-19 17:52 ` swidth with mdadm and RAID6 Steve Cousins
2006-09-19 19:22   ` Steve Cousins
2006-09-19 20:19     ` Shailendra Tripathi [this message]
     [not found] <fc.004c4d192b2da8e03b9aca0078918430.2b2da8e5@umit.maine.edu>
2006-09-19 16:36 ` Steve Cousins
2006-09-19 16:58   ` Shailendra Tripathi
2006-09-19 17:13   ` Steve Cousins
     [not found] <fc.004c4d192b2c45a93b9aca00fc3f0f38.2b2c4b4d@umit.maine.edu>
2006-09-18 20:28 ` Steve Cousins
2006-09-18 20:44 ` Steve Cousins
2006-09-18 21:06   ` Shailendra Tripathi
2006-09-18 22:13   ` Shailendra Tripathi
2006-09-19  5:11     ` Timothy Shimmin
2006-09-19  6:44       ` Shailendra Tripathi
2006-09-19  7:02         ` Timothy Shimmin
     [not found] <fc.004c4d192b2a17d13b9aca00b4f73745.2b2a26d7@umit.maine.edu>
2006-09-18 15:33 ` Steve Cousins
2006-09-18 18:10   ` Shailendra Tripathi
2006-09-18 18:19     ` Shailendra Tripathi
2006-09-15 21:07 Steve Cousins
2006-09-15 23:49 ` Peter Grandi
2006-09-18 14:50 ` Shailendra Tripathi

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=451050E7.40806@agami.com \
    --to=stripathi@agami.com \
    --cc=cousins@umit.maine.edu \
    --cc=xfs@oss.sgi.com \
    /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