From patchwork Wed Feb 28 01:10:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Bo X-Patchwork-Id: 10246515 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 96E4A60212 for ; Wed, 28 Feb 2018 02:14:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 895C82884B for ; Wed, 28 Feb 2018 02:14:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E5A928C10; Wed, 28 Feb 2018 02:14: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 1B4002884B for ; Wed, 28 Feb 2018 02:14:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751839AbeB1COD (ORCPT ); Tue, 27 Feb 2018 21:14:03 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:54274 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751831AbeB1COA (ORCPT ); Tue, 27 Feb 2018 21:14:00 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1S2CXkD094154 for ; Wed, 28 Feb 2018 02:13:59 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=H9RTJ/vzubO+iBNk+DV4HoOCPJDSmhfAZjor6hkGWzo=; b=kAt9OPGeYP7CPgobb29PG+a7ddHVDwGpdXHQFiH2bHhx6fG7Q1RwGRsPl/nk0poSyIjL vuGajzsa9XoefFPe6e6qZNEpn+HPmd0e20jbcx7BGENiuVgbXKC9RpMvX8skaMorY0yi SBFjnXJzreTancWTanp6IO5bikkFxhQnlE59zm9C6JvM+7ogfZovb1N0WWyNfgd6v/O/ iT3nscOSFMBuqS64klrNOXiDdO7v4aIreMjlmpKe7W4D/MrN6hHJ4d1Vu+ErcEqKSCVr V3JAhTwnyo/a2cSTNJsqFQOg9gn9Lfo8XiZmZWspOpwdPmY5p7mOknDJ//NKQ1QG3Y+Q RA== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2130.oracle.com with ESMTP id 2gdgpk8e46-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 28 Feb 2018 02:13:59 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w1S2Dw53014805 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 28 Feb 2018 02:13:58 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w1S2DwFZ002715 for ; Wed, 28 Feb 2018 02:13:58 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 ; Tue, 27 Feb 2018 18:13:58 -0800 From: Liu Bo To: linux-btrfs@vger.kernel.org Subject: [PATCH] Btrfs: dev-replace: skip prealloc extents when copy nocow pages Date: Tue, 27 Feb 2018 18:10:58 -0700 Message-Id: <20180228011058.23906-1-bo.li.liu@oracle.com> X-Mailer: git-send-email 2.9.4 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8817 signatures=668681 X-Proofpoint-Spam-Details: rule=notspam policy=default score=1 suspectscore=18 malwarescore=0 phishscore=0 bulkscore=0 spamscore=1 mlxscore=1 mlxlogscore=186 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802280025 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 It doens't make sense to process prealloc extents as pages will be filled with zero when reading prealloc extents. Signed-off-by: Liu Bo Reviewed-by: Filipe Manana --- fs/btrfs/scrub.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index ec56f33..9882513 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -4480,7 +4480,8 @@ static int check_extent_to_block(struct btrfs_inode *inode, u64 start, u64 len, * move on to the next inode. */ if (em->block_start > logical || - em->block_start + em->block_len < logical + len) { + em->block_start + em->block_len < logical + len || + test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) { free_extent_map(em); ret = 1; goto out_unlock;