Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3475791pxp; Tue, 8 Mar 2022 15:25:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJzIEQejDaEnQKZOZUUPsx9bak0vEYiqBZlS2yTO7uO3DDCQJMsMtiXqt7e7h98byCUwIA43 X-Received: by 2002:a17:90a:2e0e:b0:1bc:dbe:2d04 with SMTP id q14-20020a17090a2e0e00b001bc0dbe2d04mr7387180pjd.74.1646781955562; Tue, 08 Mar 2022 15:25:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646781955; cv=none; d=google.com; s=arc-20160816; b=1DhqRD4s9JUIwfzuEbSktacEI5WmxFaizMwQwwJrLqheN+E1AgRxzExcs/BKuEw5XC iG5OSe73pt6OS4Quh8HtQra698HCR/TxJyQjkVhmlC5rJsJv+e2pUPGKkq6qZeJaQGAE LIkDPL1ESb3zfWra9K7pogkLAMG/Qupl4QRbBHk6c/k+TbVQbH22FJog2JZqpDZLir4A GEG9AdagsbQeLxfRtIyupT+MQz0zYztfaz0Hw4Ik3AVaJbpGN5/XB6HkFwOc7d1dALKu 9MoIbUk19kZqrd+jlW37s6QbcZLjIGYQJGNn+yQy3NN6tZbYebhjKunSZvXKEsFmVrxJ uDow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ksr2ssAIpAZ/GZjyqVmBOyXbfw3/aukQ2De9ZueXW/U=; b=pCJV+xRTTLL2qTDV5xfpAKg2QWS7oSY3449qBR4mNVlFvsTR1dff+MJ/jrZUPM5VZg 4j5DXxUw2XRvaQPYoVWFJpAW9Riz3y8sfiqOoSO1VssC+W107aNHKsaFaf+h0yOKeNUT 7JPtC4DAC1EVb4iVr6dosh+MchwADG84xw7sJlUD5/MFf9+RC6uu20G9ng22vXS78wK8 YeKc3YzuLrH4g+GrIQnNrh5njKVNqAxYNLrmH4btifG1AT2eXHeKmw/biMLKINJjV0hN VeAY8oHCBfidfmhxATbBvIDMMCDgxsrxNcM2Ht6aWUrID52lCuoIeVavmYmXnFcfarVo +yPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VQTvssZ9; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id k10-20020a63d10a000000b00373a2709f2bsi185405pgg.847.2022.03.08.15.25.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 15:25:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VQTvssZ9; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:18 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AF3D295A0C; Tue, 8 Mar 2022 15:16:58 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345980AbiCHKwg (ORCPT + 99 others); Tue, 8 Mar 2022 05:52:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345992AbiCHKw3 (ORCPT ); Tue, 8 Mar 2022 05:52:29 -0500 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91467433B1 for ; Tue, 8 Mar 2022 02:51:33 -0800 (PST) Received: by mail-pj1-x102b.google.com with SMTP id v4so16804318pjh.2 for ; Tue, 08 Mar 2022 02:51:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ksr2ssAIpAZ/GZjyqVmBOyXbfw3/aukQ2De9ZueXW/U=; b=VQTvssZ9izqd+4YdV+v1wU9lTmqK9s1NUCes6ic0Rj2NevAOItb9QaBdg5Amer9BIu Apjguw/yC7Uery9uRUeGI3/CRcbTSCU8LevjKOr1BIQAOXAZqWm7DCPFYUpeptguvmoU GhVS2UN3OmQyJCPX7XKTtQaCrRBeMrrV809eZ6LNmG5v23ITiFrOXEG0t6LnaVB+yV8V wxytAMMazgB2WxkUwk3RJ3nNBCWB3GnEMMjn4LUwgKUzDg4VJkfgM1Cf4cJMLx1sjz6J bWFLSAfxmC26MO1OVi3nSjZroCr/aEqV2cnK/tFgsqCPq6Fv91cg5Xd8rsL8A7+r0Mnk G8kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ksr2ssAIpAZ/GZjyqVmBOyXbfw3/aukQ2De9ZueXW/U=; b=PafikORGGtzSkZGfBSxLjI85BU/vabDTxxDV6GO3aOFMfRYrT2y+6I951kxKIKL34s PCsOQW9dbqubIHf1B4QaG1UpBzRnxVW8UUT7uMYlU4xI1aqdz5uoIc+obbDQYXFZ8NBH jfegwZp5nmU42FJNBQLE2fFSMH6ecKnfHMYFx9fLdDVYe/x0Vb5FsJahVnjvhrxJXUNq vc58IglY41TvgAVPrlHLQ/5c9hWJg2R3Z45nnEfRqpwCxpw1kws6pmWiqC4BJgN16llU se849uasNk1Y4qoH1GNSiU/iCtWU8uQ6CfOFVtFcDCYepHSkUH8iHJlnPEX+DfgnsWfZ 1a9A== X-Gm-Message-State: AOAM5321lX1nRY9ZOQvDXrX+NGLrfosRu7CaWDfUbaoSX/ZUU1akXB7H h9r3YPt8DrcFn/FnYjESqPHPnVylcepRtgc+ X-Received: by 2002:a17:90a:a887:b0:1bc:388a:329f with SMTP id h7-20020a17090aa88700b001bc388a329fmr3973457pjq.17.1646736692463; Tue, 08 Mar 2022 02:51:32 -0800 (PST) Received: from harshads-520.kir.corp.google.com ([2620:15c:17:10:c24c:d8e5:a9be:227]) by smtp.googlemail.com with ESMTPSA id f6-20020a056a00228600b004f709f5f3c1sm6282040pfe.28.2022.03.08.02.51.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 02:51:31 -0800 (PST) From: Harshad Shirwadkar X-Google-Original-From: Harshad Shirwadkar To: linux-ext4@vger.kernel.org Cc: riteshh@linux.ibm.com, jack@suse.cz, tytso@mit.edu, Harshad Shirwadkar Subject: [PATCH 5/5] ext4: update code documentation Date: Tue, 8 Mar 2022 02:51:12 -0800 Message-Id: <20220308105112.404498-6-harshads@google.com> X-Mailer: git-send-email 2.35.1.616.g0bdcbb4464-goog In-Reply-To: <20220308105112.404498-1-harshads@google.com> References: <20220308105112.404498-1-harshads@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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-ext4@vger.kernel.org From: Harshad Shirwadkar This patch updates code documentation to reflect the commit path changes made in this series. Signed-off-by: Harshad Shirwadkar --- fs/ext4/fast_commit.c | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c index 831bb21dcb4f..c4e15898fbd4 100644 --- a/fs/ext4/fast_commit.c +++ b/fs/ext4/fast_commit.c @@ -49,14 +49,21 @@ * that need to be committed during a fast commit in another in memory queue of * inodes. During the commit operation, we commit in the following order: * - * [1] Lock inodes for any further data updates by setting COMMITTING state - * [2] Submit data buffers of all the inodes - * [3] Wait for [2] to complete - * [4] Commit all the directory entry updates in the fast commit space - * [5] Commit all the changed inode structures - * [6] Write tail tag (this tag ensures the atomicity, please read the following + * [1] Lock the journal by calling jbd2_journal_lock_updates. This ensures that + * all the exsiting handles finish and no new handles can start. + * [2] Mark all the fast commit eligible inodes as undergoing fast commit + * by setting "EXT4_STATE_FC_COMMITTING" state. + * [3] Unlock the journal by calling jbd2_journal_unlock_updates. This allows + * starting of new handles. If new handles try to start an update on + * any of the inodes that are being committed, ext4_fc_track_inode() + * will block until those inodes have finished the fast commit. + * [4] Submit data buffers of all the committing inodes. + * [5] Wait for [4] to complete. + * [6] Commit all the directory entry updates in the fast commit space. + * [7] Commit all the changed inodes in the fast commit space and clear + * "EXT4_STATE_FC_COMMITTING" for these inodes. + * [8] Write tail tag (this tag ensures the atomicity, please read the following * section for more details). - * [7] Wait for [4], [5] and [6] to complete. * * All the inode updates must call ext4_fc_start_update() before starting an * update. If such an ongoing update is present, fast commit waits for it to @@ -142,6 +149,13 @@ * similarly. Thus, by converting a non-idempotent procedure into a series of * idempotent outcomes, fast commits ensured idempotence during the replay. * + * Locking + * ------- + * sbi->s_fc_lock protects the fast commit inodes queue and the fast commit + * dentry queue. ei->i_fc_lock protects the fast commit related info in a given + * inode. Most of the code avoids acquiring both the locks, but if one must do + * that then sbi->s_fc_lock must be acquired before ei->i_fc_lock. + * * TODOs * ----- * @@ -156,13 +170,7 @@ * fast commit recovery even if that area is invalidated by later full * commits. * - * 1) Fast commit's commit path locks the entire file system during fast - * commit. This has significant performance penalty. Instead of that, we - * should use ext4_fc_start/stop_update functions to start inode level - * updates from ext4_journal_start/stop. Once we do that we can drop file - * system locking during commit path. - * - * 2) Handle more ineligible cases. + * 1) Handle more ineligible cases. */ #include -- 2.35.1.616.g0bdcbb4464-goog