From patchwork Mon Dec 4 22:40:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Bo X-Patchwork-Id: 10091973 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D04C760329 for ; Tue, 5 Dec 2017 01:28:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C42C4294CE for ; Tue, 5 Dec 2017 01:28:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B8A16294DE; Tue, 5 Dec 2017 01:28:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49223294CE for ; Tue, 5 Dec 2017 01:28:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752451AbdLEB2D (ORCPT ); Mon, 4 Dec 2017 20:28:03 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:44215 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752196AbdLEB14 (ORCPT ); Mon, 4 Dec 2017 20:27:56 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.21/8.16.0.21) with SMTP id vB4NfrLD182888 for ; Mon, 4 Dec 2017 23:43:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=QY/tjMG+FoJfuYHj+iavO9//cJwKY4LloSmf3lf7tsA=; b=SdApmwtgZI0y+b1okeo9Pi5zqsvD2rmGuqzocXhMH1sl0CL82Sus0wk4rGi02cnp/DWu mv9Rxfj3PuOB4kibgWOG2iRlLpHRsUc86bwSiy1fZo+4SQ3IBlb6CIZ0Z3rX1NFXOzIH rcziOkj3Oc1nk2Ku63OFnmHSaSCqjaj02PgQ0YfLr0//gbMotsPdzT1YLfHXzpPXGeuy J8pkv2FdeuG8FO7cf8KmQWkLDhDR7a8Acd9NeiN6boHFnvsYZ43eHKe78mC3867rqbkm Rd6eqoJxWcUr9rjatCK17ICi6VIozwmy4Q4xbvQeCYCzXKbtofhkO0K7+SejpU/XqgT/ Tg== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2ekpeyn3fn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 04 Dec 2017 23:43:24 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id vB4NhNse013537 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 4 Dec 2017 23:43:23 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id vB4NhNLT003666 for ; Mon, 4 Dec 2017 23:43:23 GMT Received: from dhcp-10-211-47-181.usdhcp.oraclecorp.com.com (/10.211.47.181) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 04 Dec 2017 15:43:23 -0800 From: Liu Bo To: linux-btrfs@vger.kernel.org Subject: [PATCH 2/3] Btrfs: do not merge rbios if their fail stripe index are not identical Date: Mon, 4 Dec 2017 15:40:36 -0700 Message-Id: <20171204224037.7556-3-bo.li.liu@oracle.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20171204224037.7556-1-bo.li.liu@oracle.com> References: <20171204224037.7556-1-bo.li.liu@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8735 signatures=668637 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=5 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1712040332 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since fail stripe index in rbio would be used to decide which algorithm reconstruction would be run, we cannot merge rbios if their's fail striped index are different, otherwise, one of the two reconstructions would fail. Signed-off-by: Liu Bo --- fs/btrfs/raid56.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index c4188fb..8d09535 100644 --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c @@ -601,6 +601,15 @@ static int rbio_can_merge(struct btrfs_raid_bio *last, if (last->operation == BTRFS_RBIO_REBUILD_MISSING) return 0; + if (last->operation == BTRFS_RBIO_READ_REBUILD) { + int fa = (last->faila < last->failb) ? last->faila : last->failb; + int fb = (last->faila < last->failb) ? last->failb : last->faila; + int cur_fa = (cur->faila < cur->failb) ? cur->faila : cur->failb; + int cur_fb = (cur->faila < cur->failb) ? cur->failb : cur->faila; + + if (fa != cur_fa || fb != cur_fb) + return 0; + } return 1; }