Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2657174rdh; Wed, 27 Sep 2023 08:54:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGsenjNiQzoYoZ0c/MVT0YBXYjkGbTIcJa62J/KyU004BydKwBXsfrCwPhnSGpdtCFTgMt+ X-Received: by 2002:a17:903:2452:b0:1c5:a09e:170a with SMTP id l18-20020a170903245200b001c5a09e170amr2435429pls.54.1695830052147; Wed, 27 Sep 2023 08:54:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695830052; cv=none; d=google.com; s=arc-20160816; b=CgZIdKRk5tj0R4h1zfAXoXmYH+eT6SW5jziviQJ1fqDmt+YsjWjLoFA5EJdwVJbT4F NaLYtXdcLn2oOqOpVRCMQ7PczgPCWtQGAbNXipB485UIx0t/arT8YQuvyF49fDfpTOE4 +ys4sftL88oKJ8Jucne46QNtwCCx2fo7rVVjscocyqY05SabzH/LKFzQuKlGdiUoah7Y uLnOd+Ar4vjmLDtmSv3R35JtIk2STSjprioFI7PgcH90WQHCglaqKCdp0OurOT0e5nGI uCsF6abZuYbvZGsM2DJs7cNQxuG2lIlboZx+KWlYyVZD8mVxv21jtCRy5pEKv3lRIUub OnlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:subject:cc:to:from:message-id:date :dkim-signature; bh=3hPVi5a4oOzuPKosm3U0zhfS96+9QHisSYbM2I9FqZU=; fh=i7DQetGfDsfWYXohCb4E5ZTXE/R/ityVAbXNGIxurAo=; b=WbTtZC9vpG3MZiKad1ab+dATd55k8k/hjROzhZ11fPvP1tLiS1ijuoO2hPRINt7Y3h VSI9kUH/hxRs02qZDttZec07xCR9l9ODTflby9WWsGWGjFD0EANgG7cUMOyzSgMNrZDe JvdNqbztITWMGcLqEqVM/L82/3WT7jQ6RFuyLAMfEWyoIKsB1rgHpNfavh3Isj2k27rt mOFz0AVglK89oLRQM8wyEHoA/MU71eVfE/o7hZ02q2UfSZzNFS8DbIMc0+imjDSB+bTh mrdO32lsGbwLMR0/G9vzt7DDJNnPbhXpZG9N5B3SBDEB5HJG67KA0/dsE1VM6sFrrSip zqzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=nA6p4KXj; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id u7-20020a170902e5c700b001bdf6eb05f2si6702425plf.227.2023.09.27.08.54.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 08:54:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=nA6p4KXj; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-ext4-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 lipwig.vger.email (Postfix) with ESMTP id 101D68215796; Wed, 27 Sep 2023 02:58:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231153AbjI0J6n (ORCPT + 99 others); Wed, 27 Sep 2023 05:58:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230495AbjI0J6m (ORCPT ); Wed, 27 Sep 2023 05:58:42 -0400 Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54A191A7; Wed, 27 Sep 2023 02:58:40 -0700 (PDT) Received: by mail-ot1-x32f.google.com with SMTP id 46e09a7af769-6c4bf619b57so5293875a34.1; Wed, 27 Sep 2023 02:58:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695808719; x=1696413519; darn=vger.kernel.org; h=in-reply-to:subject:cc:to:from:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=3hPVi5a4oOzuPKosm3U0zhfS96+9QHisSYbM2I9FqZU=; b=nA6p4KXjIDpL6M/ke3LTf7wLwrXVYrsOMWT4W787KGHcsJ16dBvNXxSK9dMwJinms5 LRqWej37w8DLzsqlPTAoRSBoyHjpSbAyVDe6u0wkoyrJ8zPa5pSpqJpOrllM/xK5cR5k bPhm3NrH8I5xjvCijaBV3cuCJ4GpymI5iaiZiIymsgN0oLDkmNlQTjr0sye39Atz+dZC Zi3hsTHHz9xXJR8rcGsWJ1GkKAGmdmQK7SwgwuyD81mbMmEMf2ioV/z8N5N+NTwvt6gW j+nvCLsztb/FQBAvBb05zhE74c4SMis7lYKwREQyHrp3usF8ZRPwXNAkd4xxCH1C2T8b a8WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695808719; x=1696413519; h=in-reply-to:subject:cc:to:from:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=3hPVi5a4oOzuPKosm3U0zhfS96+9QHisSYbM2I9FqZU=; b=KU6QtYHMeQOMRN4IChWW0skQFzsmNgW0DLFnuM2F13BCL4J4vABvJtxhkc0UAia+J6 4yEgti1NctwhhwQZvdi0F/4AglDiWtMwRKS9VlcWAsWfeX8g3KPQ36GNqZ7itkOgDhpZ R4E3Q+fmdUqNTxxiohofNvkZg8J3zowsoUFVZ8Yj8/Pu9mQbH8UVT9J0HXPoPJbaKxbN O0GeRXbFFdhRFELPFs8hbDPBPnTg3xVw1m722U0pfyZhpr58dQD4cxBJ4pN+AaIV0oGn 2kDufGPbfd3RFkiTodSnroItgxqSAUmaw1HSVJal8sEdqhvx9LNmOGrQB6EkSOA+yanS ueHQ== X-Gm-Message-State: AOJu0YzVsi3RKHBUGhzphxAwziBqC5u6kUnFp1yV+L/asOf8A4diYe4m DQEnIyLa6ZvclRNIX7fIyhBomCSNSQk= X-Received: by 2002:a9d:734b:0:b0:6c4:e80d:5d8d with SMTP id l11-20020a9d734b000000b006c4e80d5d8dmr1649986otk.32.1695808718929; Wed, 27 Sep 2023 02:58:38 -0700 (PDT) Received: from dw-tp ([49.207.223.191]) by smtp.gmail.com with ESMTPSA id t14-20020a056a0021ce00b0068bc461b68fsm11134465pfj.204.2023.09.27.02.58.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 02:58:38 -0700 (PDT) Date: Wed, 27 Sep 2023 15:28:34 +0530 Message-Id: <87r0mkey45.fsf@doe.com> From: Ritesh Harjani (IBM) To: Kemeng Shi , tytso@mit.edu, adilger.kernel@dilger.ca Cc: ojaswin@linux.ibm.com, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v7 05/12] ext4: call ext4_mb_mark_context in ext4_mb_mark_diskspace_used In-Reply-To: <20230919201532.310085-6-shikemeng@huaweicloud.com> X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 27 Sep 2023 02:58:47 -0700 (PDT) Kemeng Shi writes: > call ext4_mb_mark_context in ext4_mb_mark_diskspace_used to: > 1. remove repeat code to normally update bitmap and group descriptor > on disk. > 2. call ext4_mb_mark_context instead of only setting bits in block bitmap > to fix the bitmap. Function ext4_mb_mark_context will also update > checksum of bitmap and other counter along with the bit change to keep > the cosistent with bit change or block bitmap will be marked corrupted as > checksum of bitmap is in inconsistent state. > Rewording point 2 to... Now that we have a common API for marking blocks inuse/free in block bitmap, use that instead of open coding it in function ext4_mb_mark_diskspace_used(). The current code was not updating checksum and other counters. ext4_mb_mark_context() should fix these consistency problems. Also I now see why you have used "int" (ext4_grpblk_t) for len in ext4_mb_mark_context(). The reason is because this is "cluster len" which is defined as ext4_grpblk_t in "struct ext4_free_extent" I think by default we anyway have 8192 blocks per block group. So it should be ok for now. I anyway think the usage of blocks and cluster (& their data type) is confusing at different places which needs an auditing/cleanup. This patch looks good to me. Feel free to add - Reviewed-by: Ritesh Harjani (IBM)