Received: with ECARTIS (v1.0.0; list xfs); Tue, 19 Sep 2006 10:51:20 -0700 (PDT) Received: from cuda.sgi.com (cuda1.sgi.com [192.48.168.28]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id k8JHpEaG015639 for ; Tue, 19 Sep 2006 10:51:14 -0700 X-ASG-Debug-ID: 1158683789-32514-431-0 X-Barracuda-URL: http://cuda.sgi.com:80/cgi-bin/mark.cgi Received: from limpet.umeoce.maine.edu (limpet.umeoce.maine.edu [130.111.192.115]) by cuda.sgi.com (Spam Firewall) with ESMTP id B0DE5455D3F for ; Tue, 19 Sep 2006 09:36:29 -0700 (PDT) Received: from localhost (cousins@localhost) by limpet.umeoce.maine.edu (8.9.3/8.9.3) with ESMTP id MAA02470; Tue, 19 Sep 2006 12:36:20 -0400 Date: Tue, 19 Sep 2006 12:36:20 -0400 (EDT) From: Steve Cousins Reply-To: cousins@umit.maine.edu To: Shailendra Tripathi cc: xfs@oss.sgi.com X-ASG-Orig-Subj: Re: swidth with mdadm and RAID6 Subject: Re: swidth with mdadm and RAID6 In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.02, rules version 3.0.21546 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-archive-position: 9026 X-ecartis-version: Ecartis v1.0.0 Sender: xfs-bounce@oss.sgi.com Errors-to: xfs-bounce@oss.sgi.com X-original-sender: cousins@limpet.umeoce.maine.edu Precedence: bulk X-list: xfs Content-Length: 4189 Lines: 139 Hi Shailendra, I ran the program and it reports: Level 6, disks=11 spare_disks=1 raid_disks=10 which looks good. I don't understand why you got: Level 5, disks=7 spare_disks=3 raid_disks=5 Why would it have 3 spare_disks? Thanks, Steve ______________________________________________________________________ Steve Cousins, Ocean Modeling Group Email: cousins@umit.maine.edu Marine Sciences, 452 Aubert Hall http://rocky.umeoce.maine.edu Univ. of Maine, Orono, ME 04469 Phone: (207) 581-4302 On Mon, 18 Sep 2006, Shailendra Tripathi wrote: > Hi Steve, > Your guess appears to be correct. md_ioctl returns nr which > is total number of disk in the array including the spare disks. However, > XFS function md_get_vol_stripe does not take spare disk into account. It > needs to subtract spare_disks as well. > However, md.spare_disks returned by the call returns spare + parity > (both). So, one way could be substract spare_disks directly. Otherwise, > the xfs should rely on md.raid_disks. This does not include spare_disks > and nr.disks should be changed for that. > > When I run my program md_info on raid5 array with 5 devices and 2 > spares, I get > [root@ga09 root]# ./a.out /dev/md11 > Level 5, disks=7 spare_disks=3 raid_disks=5 > > Steve can you please compile the pasted program and run on your system > with md prepared. It takes /dev/md as input. > In your case, you should get above line as: > Level 6, disks=11 spare disks=3 raid_disks=10 > > nr=working=active=failed=spare=0; > ITERATE_RDEV(mddev,rdev,tmp) { > nr++; > if (rdev->faulty) > failed++; > else { > working++; > if (rdev->in_sync) > active++; > else > spare++; > } > } > > info.level = mddev->level; > info.size = mddev->size; > info.nr_disks = nr; > .... > info.active_disks = active; > info.working_disks = working; > info.failed_disks = failed; > info.spare_disks = spare; > > -shailendra > The program is pasted below: > md_info.c. Takes /dev/md as name. For example, /dev/md11. > > #include > #include > #include > #ifndef MD_MAJOR > #define MD_MAJOR 9 > #endif > > #define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, struct md_array_info) > > > struct md_array_info { > __uint32_t major_version; > __uint32_t minor_version; > __uint32_t patch_version; > __uint32_t ctime; > __uint32_t level; > __uint32_t size; > __uint32_t nr_disks; > __uint32_t raid_disks; > __uint32_t md_minor; > __uint32_t not_persistent; > /* > * Generic state information > */ > __uint32_t utime; /* 0 Superblock update time */ > __uint32_t state; /* 1 State bits (clean, ...) */ > __uint32_t active_disks; /* 2 Number of currently active disks */ > __uint32_t working_disks; /* 3 Number of working disks */ > __uint32_t failed_disks; /* 4 Number of failed disks */ > __uint32_t spare_disks; /* 5 Number of spare disks */ > /* > * Personality information > */ > __uint32_t layout; /* 0 the array's physical layout */ > __uint32_t chunk_size; /* 1 chunk size in bytes */ > > }; > > int main(int argc, char *argv[]) > { > struct md_array_info md; > int fd; > > > /* Open device */ > fd = open(argv[1], O_RDONLY); > if (fd == -1) { > printf("Could not open %s\n", argv[1]); > exit(1); > } > if (ioctl(fd, GET_ARRAY_INFO, &md)) { > printf("Error getting MD array info from %s\n", argv[1]); > exit(1); > } > close(fd); > printf("Level %d, disks=%d spare_disks=%d raid_disks=%d\n", > md.level, md.nr_disks, > md.spare_disks, md.raid_disks); > return 0; > } > > > > > > >