From patchwork Fri Mar 2 23:10:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Bo X-Patchwork-Id: 10255891 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 83E3860211 for ; Sat, 3 Mar 2018 00:21:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74C24285FD for ; Sat, 3 Mar 2018 00:21:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 682BF28608; Sat, 3 Mar 2018 00:21:11 +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 02728285FD for ; Sat, 3 Mar 2018 00:21:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935449AbeCCAVI (ORCPT ); Fri, 2 Mar 2018 19:21:08 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:57006 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932890AbeCCAVG (ORCPT ); Fri, 2 Mar 2018 19:21:06 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w230HUx7021619 for ; Sat, 3 Mar 2018 00:21:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id; s=corp-2017-10-26; bh=df6tEQwndYopzTGCwFfeKKu/EEpxxuWFsh9RLpKcdcI=; b=QUIFuIx5Hgahxr+DaqEy3s0K0cQX76RXHjLbnnDUajU0+f1nuCdfWBT65bK9yv71sSdH U96lVSqrAm5ED4lYJDQdMa/5V53S4Ied2rfKI+jX9FL19CB9LGNG7dT4xpS0ZexmD+Dk xXfMemoutWOX3mw38wRWYkhp8c3Obe8f8QJz8lV3cO6IQ9lNCGU6gsW4DgU00k2wqGwf 0a3BCuer3Ot8lI9Tfyo3OC4c0C6wqLUZXWQVOnGlZIA7Kuqk8d6NCpqLz06ZTIbelekV Zpjce1MsTvYjVNgQKLe9EVdoDV8BaZO2/YAPuEhQBRMPQMf8X5UKWXxSqSm9jTnRrpRo Og== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2gf4g1ub08-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sat, 03 Mar 2018 00:21:06 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w230G5Ft031506 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Sat, 3 Mar 2018 00:16:05 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w230G4fL006153 for ; Sat, 3 Mar 2018 00:16:04 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 ; Fri, 02 Mar 2018 16:16:04 -0800 From: Liu Bo To: linux-btrfs@vger.kernel.org Subject: [PATCH] Btrfs: replace: cache rbio when rebuild data on missing device Date: Fri, 2 Mar 2018 16:10:38 -0700 Message-Id: <20180302231041.10442-2-bo.li.liu@oracle.com> X-Mailer: git-send-email 2.9.4 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8820 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=5 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=410 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803030003 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 Rebuild on missing device is as same as recover, after it's done, rbio has data which is consistent with on-disk data, so it can be cached to avoid further reads. Signed-off-by: Liu Bo --- fs/btrfs/raid56.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index dec0907..bb8a3c5 100644 --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c @@ -1986,7 +1986,8 @@ static void __raid_recover_end_io(struct btrfs_raid_bio *rbio) kfree(pointers); cleanup_io: - if (rbio->operation == BTRFS_RBIO_READ_REBUILD) { + if (rbio->operation == BTRFS_RBIO_READ_REBUILD || + rbio->operation == BTRFS_RBIO_REBUILD_MISSING) { /* * - In case of two failures, where rbio->failb != -1: * @@ -2008,8 +2009,6 @@ static void __raid_recover_end_io(struct btrfs_raid_bio *rbio) clear_bit(RBIO_CACHE_READY_BIT, &rbio->flags); rbio_orig_end_io(rbio, err); - } else if (rbio->operation == BTRFS_RBIO_REBUILD_MISSING) { - rbio_orig_end_io(rbio, err); } else if (err == BLK_STS_OK) { rbio->faila = -1; rbio->failb = -1;