From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933241AbWKNAWh (ORCPT ); Mon, 13 Nov 2006 19:22:37 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S933243AbWKNAWh (ORCPT ); Mon, 13 Nov 2006 19:22:37 -0500 Received: from cantor.suse.de ([195.135.220.2]:31641 "EHLO mx1.suse.de") by vger.kernel.org with ESMTP id S933240AbWKNAWg (ORCPT ); Mon, 13 Nov 2006 19:22:36 -0500 From: NeilBrown To: Andrew Morton Date: Tue, 14 Nov 2006 11:22:28 +1100 Message-Id: <1061114002228.31156@suse.de> X-face: [Gw_3E*Gng}4rRrKRYotwlE?.2|**#s9D Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org stripe_to_pdidx finds the index of the parity disk for a given stripe. It assumes raid5 in that it uses "disks-1" to determine the number of data disks. This is incorrect for raid6 but fortunately the two usages cancel each other out. The only way that 'data_disks' affects the calculation of pd_idx in raid5_compute_sector is when it is divided into the sector number. But as that sector number is calculated by multiplying in the wrong value of 'data_disks' the division produces the right value. So it is innocuous but needs to be fixed. Signed-off-by: Neil Brown ### Diffstat output ./drivers/md/raid5.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff .prev/drivers/md/raid5.c ./drivers/md/raid5.c --- .prev/drivers/md/raid5.c 2006-11-14 10:05:00.000000000 +1100 +++ ./drivers/md/raid5.c 2006-11-14 10:33:41.000000000 +1100 @@ -1355,8 +1355,10 @@ static int stripe_to_pdidx(sector_t stri int pd_idx, dd_idx; int chunk_offset = sector_div(stripe, sectors_per_chunk); - raid5_compute_sector(stripe*(disks-1)*sectors_per_chunk - + chunk_offset, disks, disks-1, &dd_idx, &pd_idx, conf); + raid5_compute_sector(stripe * (disks - conf->max_degraded) + *sectors_per_chunk + chunk_offset, + disks, disks - conf->max_degraded, + &dd_idx, &pd_idx, conf); return pd_idx; }