Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2934683rdb; Wed, 4 Oct 2023 16:56:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGUzaYMPkVop219V+245zzNW68qPo44N3mNR2t623E4BQJ30L+gIh/aMe4jX0kfzTQ9sNqp X-Received: by 2002:a05:6a20:4418:b0:14d:16c:2d20 with SMTP id ce24-20020a056a20441800b0014d016c2d20mr4763826pzb.44.1696463765317; Wed, 04 Oct 2023 16:56:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696463765; cv=none; d=google.com; s=arc-20160816; b=UB/L0W72Fn2Fm+o8ue4EBViev08w4gsTIdfICWUaXXfnK7z21bXgvKpbW3OuYmaSM2 eUOfEmHleQO8eLwtRNvlCdWAKFTfXoumz2LMO2RB6zC6HBUoy2rnkoIFjbbOMuCpicgp jBt1vhQNGPwRAVj4igDQZUx9KPPxqvrXDR9MEbjwL5/6EJhyFVIH2AlIx02rMXThQnvP 46k30pEYNKFqsyFPz5VyPxJZSI0YGlidSmH1Ed8FTJcN3EvlKFfOOzFUWDykXCdTK7kd zZN9CW/X0keHK6DnqtTEzt3gJq/2ok/XtVBJgsfYjqDeUb/NfD1+qOshmIBuIsPR2yaE y2ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=wmPE5iob7bk3p1cKLkyfjcpW9xx2S3XtCsKr+fqVHHo=; fh=ZaK2vudNijy95H0GvyYVBWTmhTw8nJYwWXkLewFdkfY=; b=zPJzufiPV+vRpPYNTedzQFeAaDZClxhdZfhgImB+Gbf7VH4YHkh0273u1mj4wud9Vb OsJSwRfF74vV33DGw3aywsbo3N6gdx3wYyP5itgbZEwatXEymIHOzg+258ql3ByIxFku 5tVqBTWVKxLu6LcLhIOA0W9o4gzOvm4ddSWUafR0Ub3/ml2veRJhOsOvsWIIPxL6pGHy dVvjFc+HfloMcdWLBpO9LgwtZ81RUzwMbXfuHNqb6E2plBauv8EIOb+ibHCMGryqdyaP JCxJFZOEE62zSF6lYiLdEzWaJo0Je74ocNV4Qbt5jiOALgUyTN7+ewey9Su/Rv/u/CNQ wpQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WUQD1uhq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id b8-20020a056a000a8800b00690d55d630dsi203152pfl.274.2023.10.04.16.56.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 16:56:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WUQD1uhq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id B55F3805FD7C; Wed, 4 Oct 2023 16:55:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244088AbjJDXzT (ORCPT + 99 others); Wed, 4 Oct 2023 19:55:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240836AbjJDXzS (ORCPT ); Wed, 4 Oct 2023 19:55:18 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 780A0D7 for ; Wed, 4 Oct 2023 16:55:14 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 508CFC433C8; Wed, 4 Oct 2023 23:55:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696463713; bh=MleeiaAqgiqyp0slPvMHrGbe3LZ4PVPcbqFmsHInq1o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WUQD1uhqJdbp1DL+fDexe55XPnUwjMyjzExEYA+GaYLbjw6SHhgsFT9hnSPlkC/di YW8nF+JawSZvij+OiIl3fG7apa9tiD2+oLap4G/YTb1kGB5OuF52SiMjmCEr9+yJ74 FlC3c4aeglAI0kdXWXgeraz4irl450EfQiXIRaP6aStqvu+z9d89V+g2cdVhIP//T8 XgZYMOxd5q2NynxP8rtIlU65lCtktJloBTeNjsys+87aTFVVCvz+8IRWkc22Do8m0a 9c4Sl9g/n1znh91amC12ApHZKPsVu36L+M7NEb/okTXd4Fq+whtORudeKkWDO4Wihi cIoh9TZX7sBDA== Date: Wed, 4 Oct 2023 16:55:11 -0700 From: Jaegeuk Kim To: Daeho Jeong Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com, Daeho Jeong Subject: Re: [PATCH] f2fs-tools: use proper address entry count for direct nodes Message-ID: References: <20231003230155.355807-1-daeho43@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 04 Oct 2023 16:55:39 -0700 (PDT) X-Spam-Level: ** On 10/04, Daeho Jeong wrote: > On Wed, Oct 4, 2023 at 4:26 PM Jaegeuk Kim wrote: > > > > On 10/03, Daeho Jeong wrote: > > > From: Daeho Jeong > > > > > > For direct nodes, we have to use DEF_ADDRS_PER_BLOCK. > > > > > > Signed-off-by: Daeho Jeong > > > --- > > > fsck/fsck.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/fsck/fsck.c b/fsck/fsck.c > > > index 78ffdb6..56a7d31 100644 > > > --- a/fsck/fsck.c > > > +++ b/fsck/fsck.c > > > @@ -2894,7 +2894,7 @@ static void fsck_failed_reconnect_file_dnode(struct f2fs_sb_info *sbi, > > > fsck->chk.valid_blk_cnt--; > > > f2fs_clear_main_bitmap(sbi, ni.blk_addr); > > > > > > - for (i = 0; i < ADDRS_PER_BLOCK(&node->i); i++) { > > > + for (i = 0; i < DEF_ADDRS_PER_BLOCK; i++) { > > > > It seems we need to use the inode block passing by fsck_failed_reconnect_file(). > > This function is for direct nodes. Is it correct to use inode block here? 523 unsigned int addrs_per_block(struct f2fs_inode *i) 524 { 525 if (!LINUX_S_ISREG(le16_to_cpu(i->i_mode)) || 526 !(le32_to_cpu(i->i_flags) & F2FS_COMPR_FL)) 527 return DEF_ADDRS_PER_BLOCK; 528 return ALIGN_DOWN(DEF_ADDRS_PER_BLOCK, 1 << i->i_log_cluster_size); 529 } If the inode is compressed, it seems it has to be aligned to cluster size. > > > > > > addr = le32_to_cpu(node->dn.addr[i]); > > > if (!addr) > > > continue; > > > > 3012 fsck->chk.valid_blk_cnt--; > > 3013 if (addr == NEW_ADDR) > > > > And, we also need to skip if addr == COMPRESS_ADDR here? > > > > 3014 continue; > > 3015 f2fs_clear_main_bitmap(sbi, addr); > > 3016 } > > > > > -- > > > 2.42.0.582.g8ccd20d70d-goog