Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2938738rdb; Wed, 4 Oct 2023 17:04:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHfykO2klKEgO+fiyndjQ7I7Cml/1rXcZoS4NP41MOFXTphh3DFPLsOQmSPGcIyByuIQaIc X-Received: by 2002:a17:90b:1213:b0:279:12e4:eab6 with SMTP id gl19-20020a17090b121300b0027912e4eab6mr1736585pjb.7.1696464298430; Wed, 04 Oct 2023 17:04:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696464298; cv=none; d=google.com; s=arc-20160816; b=z/shvag9OvX0AKZUWBQ42L6PxBXiO7nr5HfzeQtmhwRtR9tWy5D492FUusGE4SaxX8 kjftI28DgYRz7NWpSISX6gks9t4uNOqOhGW4zF7dcTzikQQDtyHrdiVnNJ0kyhUh4OEP UMB2DkS0eVa05V2fpssbWCcEa3CHWUOENLUb5W7ZbfYne7XWhuLU9GJq694zAJzK9Lol oUisPu3suaOEVps0/q2HPt5x/2YUjBlHgO1ifo9h6UhaVHJqJL28ueUyOQaQwnz5FPjl cpoMey0xITWKapQfINISo/fUUXclL4J/3H7JBvvEMV5o9AykgBNrkKwWd1FCpx4gId68 oTBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=xkg7+rczDvEf5vw76+FGOEqy3G1WsJgAGbY3dy46WG0=; fh=IuWhY7lUs8mn5eodWQHdP5czjrMrErk6TQ15b+TtD1w=; b=p7x/fEjYMdG0DUAO5LxnRi0+RTzpY58TQq/QFohgS7kPdPd6+XCLzLMeAV2rl4fL+S pjiR8ELEjekQW3jaFELgY0JDX2K7hrkRXqyUtVlCwDjX3L+Rw5xlpYLxQ4RZFa/3OWNk iPQ+vUo9IksQS7oSgQHHqYFcbsQJE5SQa0TKVtWYEQkNliMT2a9r94IXUnRjd8wgNMs7 Z0qhuJYoSBs6WGg7KZrCubIkTQG991mG3IQY52pYJYmd8Rp6oN5NUJ+dcw0s9864guYJ lxoeINLCH7aTzaAyHYjLkbOoVbbDVJR6B5C0j6eXcxOUahrnd3NLTTbu6q9nDdueAKci zqmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=jAZHMGfs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id t14-20020a17090a950e00b0027367e0c931si2483726pjo.129.2023.10.04.17.04.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 17:04:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=jAZHMGfs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 2661C8535F18; Wed, 4 Oct 2023 17:04:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244181AbjJEAE0 (ORCPT + 99 others); Wed, 4 Oct 2023 20:04:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243808AbjJEAEZ (ORCPT ); Wed, 4 Oct 2023 20:04:25 -0400 Received: from mail-ua1-x935.google.com (mail-ua1-x935.google.com [IPv6:2607:f8b0:4864:20::935]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AD17EE for ; Wed, 4 Oct 2023 17:04:19 -0700 (PDT) Received: by mail-ua1-x935.google.com with SMTP id a1e0cc1a2514c-7b07719089aso293831241.0 for ; Wed, 04 Oct 2023 17:04:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696464258; x=1697069058; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=xkg7+rczDvEf5vw76+FGOEqy3G1WsJgAGbY3dy46WG0=; b=jAZHMGfs/vH7lfRwrjyBz6oaFuz3C1bSEuf49kmnnmaN/1p7tImxjkU6o/4c4dx1lJ UoFjuCuejMcHBt4wsCfpZPDfSaDGGqjVZAnl8GK0MQrbtU59b/wblW26/+QIURRWu8IC Xio2N+850dp1vJW3AG5TSrezoIFRUrQa3FPEqgsvrHV+w3BnEagnkdYW5o8SrnwkEvEm 0zmlRLvc4wAGVbV0qHEBLA33A9cLqU5wlFC8HawtQ1gglZzssIN2nIOzdONFQrBspr4p JJyzYKY1bQRRmjJlBLLAez9rp9mi0TMmc1Pv3F3O4fcKwZCO0I5Zie5I6lKcVxONeaWK B+DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696464258; x=1697069058; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xkg7+rczDvEf5vw76+FGOEqy3G1WsJgAGbY3dy46WG0=; b=XVxFIe/jJBdTpTFfXRUptxXATBjQP63LbsRJouyiZjKUQlG4PwQ+9keci43geS9GwT BYMN3OUFGtw5UzvT4bs9QOj2RjmihbZ/RkX/1petw6Xhe8BhxXYLEQft2tqIs3mJ4ppR ty7BbAwMG9bIdadkU9djQVFRJAOk6yjgAHe4m5+REzyxAeq/FNj57KWISrDIBCjnmcY8 Mr26DvMR68t2Lk7Y0ECTaTdF6g/WGj3OLkD6eu1RKaGBtf2SfmTK0WncEFCtOLg1kKtw VonR2Udy8dR4TbYjoSB0IeJc1kpupGasQpibYhiLXjKmM5J5zBndqZWygppZBXfgE/OS bmEw== X-Gm-Message-State: AOJu0YzcgHJBlckCjelyTHeiAiPC78XFIteGIMBIkzrPmwbToa/xVHih kD0W3J76F2LStVbA1kznHoCRwrEBXw/+htEbiZQ= X-Received: by 2002:a05:6102:53c9:b0:455:dd1c:9653 with SMTP id bs9-20020a05610253c900b00455dd1c9653mr487841vsb.1.1696464258319; Wed, 04 Oct 2023 17:04:18 -0700 (PDT) MIME-Version: 1.0 References: <20231003230155.355807-1-daeho43@gmail.com> In-Reply-To: From: Daeho Jeong Date: Wed, 4 Oct 2023 17:04:07 -0700 Message-ID: Subject: Re: [PATCH] f2fs-tools: use proper address entry count for direct nodes To: Jaegeuk Kim Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com, Daeho Jeong Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (howler.vger.email [0.0.0.0]); Wed, 04 Oct 2023 17:04:34 -0700 (PDT) On Wed, Oct 4, 2023 at 4:55=E2=80=AFPM Jaegeuk Kim wro= te: > > On 10/04, Daeho Jeong wrote: > > On Wed, Oct 4, 2023 at 4:26=E2=80=AFPM 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 =3D 0; i < ADDRS_PER_BLOCK(&node->i); i++) { > > > > + for (i =3D 0; i < DEF_ADDRS_PER_BLOCK; i++) { > > > > > > It seems we need to use the inode block passing by fsck_failed_reconn= ect_file(). > > > > This function is for direct nodes. Is it correct to use inode block her= e? > > 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= . makes sense. Thanks~! > > > > > > > > > > addr =3D le32_to_cpu(node->dn.addr[i]); > > > > if (!addr) > > > > continue; > > > > > > 3012 fsck->chk.valid_blk_cnt--; > > > 3013 if (addr =3D=3D NEW_ADDR) > > > > > > And, we also need to skip if addr =3D=3D COMPRESS_ADDR here? > > > > > > 3014 continue; > > > 3015 f2fs_clear_main_bitmap(sbi, addr); > > > 3016 } > > > > > > > -- > > > > 2.42.0.582.g8ccd20d70d-goog