Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp743543lqc; Fri, 8 Mar 2024 10:17:03 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWsJRJ4wU+M3Y5sqVMSPWzJSiO/xtQEnP8uPDDrUifulWEsqbSl96OVlP03dr6lY6hJQDz1BoJrgmM2XhB6Q7vb+vdy8GtucTix6rli7w== X-Google-Smtp-Source: AGHT+IGKCDgMJf6Q76PWlqWSeXfGAWmAetWx5g/hnKXFat1iraaCuVRZs3R9pH7ZdKxCXeCSN9h2 X-Received: by 2002:a05:622a:180d:b0:42e:6f56:c358 with SMTP id t13-20020a05622a180d00b0042e6f56c358mr932692qtc.42.1709921823345; Fri, 08 Mar 2024 10:17:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709921823; cv=pass; d=google.com; s=arc-20160816; b=FnA+FGUFZK25Uk+bVexzo4F/c0m9J+UORH6pUEMgstmb5b5MddLPtJ/RkQM/lnmKey +HL8QfQbUTD/d1eJHNUIpxzyPRZxKSQ3m/2QlErA7NWzbPJu+cF+HF/Ih+iwyWCzvIAY Uzf4YNoOQBXXgIJI5cAEXOiaOhy80dHe+6tbRt2udE5Qa7iXWEJkjwlB6/RyobEiEiXv FBk7POr9ltwTpK7JwKGSyByF9XZgJXOjtiQeb1Ia3UZ1WOUnwltgaAqfe5qbWtIRGTm5 Z2D6iw+VDZnoITTWPDxzB0KFlYf1KAo8pKtI2Fgw9KSr4h9EqO1LQhhSSTNUxaGFfmPd c4+A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=Don58ETJLu3MMttJk2TjQgvjt5Qt3lhRQAH5cABWwSI=; fh=IvJDhn2XbJ55zxf0p/e9A+SWoPpre/ymwh9Q/MPTdCg=; b=AmoxpnPxFLl/bcuBgSYA91GOI53xwcCxhjrWxem4cnJFjolCP6FPstKwYyyOlg9G7V tQb2Vgsl6J07Krkw8nAquYcrgHOrfGuXXxx1b9k3ZfyYoMF0IaU9eJzYh1wgn8PhhEDf /t2mC9WUxoEQ9+lWOhSvrerYOtpmcsqdA0fWHp7PtTyuAvAYPGXY5S9Ay6RV51AhaAxB I2rrSdQF60vyeIRr8LDYWnqc4tqrVxKRr5Pg1KKbamXnEWq7561DysOrhrErLSt+Nxc3 FB2YPEanzO3BWWoqYQAIodXmLzGEk0YUsN0PK6/fpLSgSKDVur7yGdgapOWr4/nREq8Z xoTA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FFVXWACm; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-97446-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97446-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id pj1-20020a05620a1d8100b00788018837casi18108827qkn.322.2024.03.08.10.17.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 10:17:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-97446-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FFVXWACm; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-97446-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97446-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 12B591C21617 for ; Fri, 8 Mar 2024 18:17:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 01F1256473; Fri, 8 Mar 2024 18:16:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FFVXWACm" Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C462D17745 for ; Fri, 8 Mar 2024 18:16:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709921813; cv=none; b=kff1UQJKYoHpr1pqLGlzpuOvjoVfBovyaP2cWADPzvQ5aOEYXymxYUXXJk9OMGiMb2Bpnbd9VLPB5qW37h8G8LEAZTTeqDH3/E7yBNvbMGz0bCa0sQO8+l3VUlwJWpUTodUeIV93Cei5l7l9uI+Lyp1bm7CVZaTXJS1Jf3nHjmw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709921813; c=relaxed/simple; bh=BsmKqwy1cXQm1JnmElhH7wdLTmEhSTAibqWkTFXf/HE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=dMkcO+qGRqDAoyGJjgAl3jZNfBAfhkuiBNX8blgVPkJbjT+/fwxAoQX1NkfuGhHvFYfQXjC4q3+XcX0ZJNFVq81n3QM3Qoa/pC9rIlnsaQsFhgn7kJuuy1oZDkycqKVTPzWEN5n9aJroGpWDUFUHK9o+RX+BFseJOETvVifdw9E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FFVXWACm; arc=none smtp.client-ip=209.85.210.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-6e46dcd8feaso1595456b3a.2 for ; Fri, 08 Mar 2024 10:16:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709921811; x=1710526611; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Don58ETJLu3MMttJk2TjQgvjt5Qt3lhRQAH5cABWwSI=; b=FFVXWACmn1S+CWgzws0aZ3Yea9Y/jB7bmBautWdQMraT2fpk0FuQD94HPrTCAZ3wgu AisZGSldmWLTcc9jXKORPM0eSl4VtOKhIYyvviKka0wLiD/ItBFVaqRmdMReP2jLiLSh 4hFUHiP/t3+22hoyJoaRClk45NNR4xJxqfPb6HfHdhGLwzB5XjesyUp6rMD+zzERG/A6 0peYOh6nmcIVC19d2T+x/mpQdb409GBlxX55y+9RalalrzAfeyrT31lLTsuCArxQgTZS EM6r4PdiqsGUA6RHffr3QX5luM+/omfpNBurbZiGtTtaBMFiQhnfeFg7MJn2pdPv893o kJMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709921811; x=1710526611; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Don58ETJLu3MMttJk2TjQgvjt5Qt3lhRQAH5cABWwSI=; b=TG1rZqI1AXHUjnSznziKhgNbHS10uPrPF6A2jZkR4cbbhh0smuWNKqx3Vt4pCqIPos BCgsbV2W3PFVzWDycEvk1vqwikEYgUHv3psIDBZNjnPrc9Gc2GLDPJ32H0qdCniAb0e0 uGqcE6S++06JWzzUf2WawHG2umNQ454WkquVDLwn75VrAuoSoGLH+9qeE4pki9agW0iZ vvXjV1xte8mEsnMM8IoMjSW2PyaBwhZwc5SMF8PZhE9sEf90RYD30Dju3FGYhJVjAwHP ewwmZI4kKdVwuu6EcEiwpYqlfppDXSIOaNO4jxmZNKNu/ylk+zHRVGosFPLzqSSv+RKV dabg== X-Gm-Message-State: AOJu0YzDPBjp2nr7ymsM9ArPmUYvN7AGzjZVtJJNLTekEGLIbasqPtkd ys6ysJzEbNJ5bveQwQ/2aPrLMYjp869bX6hf/XGI8/LCLPrATDOjDVW70lok X-Received: by 2002:a05:6a00:4f96:b0:6e5:3b8e:bb6b with SMTP id ld22-20020a056a004f9600b006e53b8ebb6bmr24314668pfb.7.1709921810644; Fri, 08 Mar 2024 10:16:50 -0800 (PST) Received: from daehojeong-desktop.mtv.corp.google.com ([2620:0:1000:8411:b29d:b799:71f5:b0e6]) by smtp.gmail.com with ESMTPSA id g26-20020aa79f1a000000b006e6660588dasm2123737pfr.128.2024.03.08.10.16.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 10:16:50 -0800 (PST) From: Daeho Jeong To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com Cc: Daeho Jeong Subject: [PATCH] f2fs-tools: reset only current zones Date: Fri, 8 Mar 2024 10:16:46 -0800 Message-ID: <20240308181646.70959-1-daeho43@gmail.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Daeho Jeong Send reset commands to only current zones and finish the others. Signed-off-by: Daeho Jeong --- fsck/fsck.c | 53 +++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/fsck/fsck.c b/fsck/fsck.c index 3461a52..5b32d1f 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -3288,38 +3288,39 @@ static int chk_and_fix_wp_with_sit(int UNUSED(i), void *blkzone, void *opaque) last_valid_blkoff = last_vblk_off_in_zone(sbi, zone_segno); - /* - * When there is no valid block in the zone, check write pointer is - * at zone start. If not, reset the write pointer. - */ - if (last_valid_blkoff < 0 && - blk_zone_wp_sector(blkz) != blk_zone_sector(blkz)) { - if (!c.fix_on) { - MSG(0, "Inconsistent write pointer: wp[0x%x,0x%x]\n", - wp_segno, wp_blkoff); - fsck->chk.wp_inconsistent_zones++; - return 0; - } - - FIX_MSG("Reset write pointer of zone at segment 0x%x", - zone_segno); - ret = f2fs_reset_zone(wpd->dev_index, blkz); - if (ret) { - printf("[FSCK] Write pointer reset failed: %s\n", - dev->path); - return ret; - } - fsck->chk.wp_fixed = 1; - return 0; - } - /* if a curseg points to the zone, do not finishing zone */ for (i = 0; i < NO_CHECK_TYPE; i++) { struct curseg_info *cs = CURSEG_I(sbi, i); if (zone_segno <= cs->segno && - cs->segno < zone_segno + segs_per_zone) + cs->segno < zone_segno + segs_per_zone) { + /* + * When there is no valid block in the zone, check + * write pointer is at zone start. If not, reset + * the write pointer. + */ + if (last_valid_blkoff < 0 && + blk_zone_wp_sector(blkz) != blk_zone_sector(blkz)) { + if (!c.fix_on) { + MSG(0, "Inconsistent write pointer: " + "wp[0x%x,0x%x]\n", + wp_segno, wp_blkoff); + fsck->chk.wp_inconsistent_zones++; + return 0; + } + + FIX_MSG("Reset write pointer of zone at " + "segment 0x%x", zone_segno); + ret = f2fs_reset_zone(wpd->dev_index, blkz); + if (ret) { + printf("[FSCK] Write pointer reset " + "failed: %s\n", dev->path); + return ret; + } + fsck->chk.wp_fixed = 1; + } return 0; + } } /* -- 2.44.0.278.ge034bb2e1d-goog