Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp413047pxb; Wed, 18 Nov 2020 07:41:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJw+BU0alHdry2hoRUi0KsYvTZz+rJTgKwwMYu8EAGwKvBFKpV1Y6vUf1hf4aBM/OqIl+pzL X-Received: by 2002:a50:9e05:: with SMTP id z5mr25265813ede.231.1605714070550; Wed, 18 Nov 2020 07:41:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605714070; cv=none; d=google.com; s=arc-20160816; b=LovDR1IidG0KSk5MlThgCs2CWLBxbQpPRHvu7FIngx4n1uOggsLA0xYFltZJ3Crarc IqUwoG7ZxEybopPHa7LWrq6bymC9nVKKjr6DB0qhwWcFzC8lWAaKBQKcGOD8pwQQxyPF uHXaIRmCULkRCeF5YGGifQOHAeDDaHBU1s246hOY34R8Gis9hRpnro8hr7iMuE2CKeiw Txu//yDYosgai/ImHz97p5CdI+4zsUjWmzn3oKi8CHbRdSyWL/54Q8RrUh5T8U0s3II6 RZhWtND2SOjwIE7QAbf9Q49lYDpvcdvvLt3oavxx+4hof2C2clt+f1xzG2Ch2bRI43SB FCWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:sender:dkim-signature; bh=zJ7+kIvrxgVWJHLbQfy0p/hhFwuLvV16JAIDT0Z5Cng=; b=aPyZvoj95/ciCq0AP2aMbUt8e2Ny/sGDzdFz+0k2k7hxbCDWg2FHgvea4XoywjukDE ukshuEyzvUEVAvWwFSNqoHcSaso+yx6RM/0vgWT3HNWOJlAebXsGjE//UgknSfQrWOzS Jzy+2pSy7/6NS+WbamPIkj51OgRLqucduj2Zpeu2iH9SbbBbVRd1ud8HMpCm1puHpzYc YZxUn4rfLoq9dK03m8Jk+MwiRsT+vN/Lnthn761gzSQgHG5xbf8LJkt6MlQ5W2GbUr8R mTWadmGjfg8SOzvcA1tii/4FOY5SY/fpLiNllLVTFU6hzVEwP7r1qm/eWncYp5btHr03 yN+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=T8phYXG2; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p22si14981440ejw.31.2020.11.18.07.40.46; Wed, 18 Nov 2020 07:41:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=T8phYXG2; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727413AbgKRPkj (ORCPT + 99 others); Wed, 18 Nov 2020 10:40:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726624AbgKRPkj (ORCPT ); Wed, 18 Nov 2020 10:40:39 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43DD8C0613D4 for ; Wed, 18 Nov 2020 07:40:39 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id b25so2982126ybj.2 for ; Wed, 18 Nov 2020 07:40:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=zJ7+kIvrxgVWJHLbQfy0p/hhFwuLvV16JAIDT0Z5Cng=; b=T8phYXG2xonLTx5TMF9inTZrvbMxLAhJr0UJrKq3t5Mw2QmBj2DJySDJrSh08PMgeh rBo51bxWO5MNhauWn6BFK3irki/14uK/gCeGdV8fKPQpryHKetNMJx4Hx0NjjXxOV8r+ Babw9MtpTmaonb34Z3XJ2M/h/pGvxkiVHqMeHkRvzsWTURpEOtplR05AsQgbFtEmcDa3 LP3Fi6pUZL+l0kzBahsQ973C+iDhzg6+yekvYdyO2VNOxlm69wBlTVffGVCEaGPte5XY SDSjlAmljJKV9n/zguMlBEF55AN6FOBvMmMviABY2U1tj8SL5S9RLiLriGSWMPuCGLB+ j5tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=zJ7+kIvrxgVWJHLbQfy0p/hhFwuLvV16JAIDT0Z5Cng=; b=c7PAqmdYOXfAKyTSBaQYKRCEwBrh04hBuyqow15ZVu67JszvseNDcEKlF8vDLS+eCY 3FeM80T+CccEhHKye1oEsGdy2fhXjKhWI0YmWGb8KJLuey/uRHU2bSwqeSY7g2oYF9Og RTSnyXiGGnNnNVsA1tQfpUtJjwOVttpuik26zbROyu7YHSFWkDTJ3LQhOlz7e+fLGG59 IsvXFuoEqHSdywzIAaoMC1Cc47zMQiGhaEPC6RA7j8RI5Dzt2Xx3C35KveSzW/tc6QCT A1ODRtLRdOzXK2RQgW8tnqpr0pfB/oMNS7AF3XLfaVMp7aXCbT8QoxjDYSlsOt8Vo5Ll nDFw== X-Gm-Message-State: AOAM531OgBfNp1KSDOBuW8HnUtobrvoSGFMWlcg7qqwpMoVWgiBRTAzr p3Ho57N22aM7tAZ9RBW89P545kwuvD6NCI1CtCivO2oJ1fgp9MaScgekRIWeK8DgBMr/UHgq1h2 j06hqOG+wbrOdFCwHk9cI3aY6namIA6iQ89DGuhgy83JSmT03GQplK1FxfmY44oimbiEU6V2G7S nHJmGuh+w= Sender: "saranyamohan via sendgmr" X-Received: from saranyamohan.svl.corp.google.com ([100.116.76.178]) (user=saranyamohan job=sendgmr) by 2002:a25:2482:: with SMTP id k124mr5981787ybk.343.1605714038476; Wed, 18 Nov 2020 07:40:38 -0800 (PST) Date: Wed, 18 Nov 2020 07:38:53 -0800 In-Reply-To: <20201118153947.3394530-1-saranyamohan@google.com> Message-Id: <20201118153947.3394530-8-saranyamohan@google.com> Mime-Version: 1.0 References: <20201118153947.3394530-1-saranyamohan@google.com> X-Mailer: git-send-email 2.29.2.299.gdc1121823c-goog Subject: [RFC PATCH v3 07/61] e2fsck: copy badblocks when copying fs From: Saranya Muruganandam To: linux-ext4@vger.kernel.org, tytso@mit.edu Cc: adilger.kernel@dilger.ca, Wang Shilong , Li Xi , Saranya Muruganandam Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Wang Shilong This patch copies badblocks when the copying fs. Signed-off-by: Li Xi Signed-off-by: Wang Shilong Signed-off-by: Saranya Muruganandam --- e2fsck/pass1.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index 3a4286e1..14508dd8 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -2123,6 +2123,12 @@ static errcode_t e2fsck_pass1_copy_fs(ext2_filsys dest, ext2_filsys src) return retval; } + if (src->badblocks) { + retval = ext2fs_badblocks_copy(src->badblocks, &dest->badblocks); + if (retval) + return retval; + } + /* icache will be rebuilt if needed, so do not copy from @src */ src->icache = NULL; return 0; @@ -2155,6 +2161,13 @@ static int e2fsck_pass1_merge_fs(ext2_filsys dest, ext2_filsys src) src->icache = NULL; } + if (src->badblocks) { + retval = ext2fs_badblocks_copy(src->badblocks, &dest->badblocks); + + ext2fs_badblocks_list_free(src->badblocks); + src->badblocks = NULL; + } + return retval; } -- 2.29.2.299.gdc1121823c-goog