From patchwork Fri Oct 15 18:25:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: harshad shirwadkar X-Patchwork-Id: 1541864 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=KV7UtXkC; dkim-atps=neutral Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee2:21ea]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HWF7b6VCBz9sR4 for ; Sat, 16 Oct 2021 05:25:31 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4HWF7b5dXPz4xb9 for ; Sat, 16 Oct 2021 05:25:31 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4HWF7b5bHkz4xbY; Sat, 16 Oct 2021 05:25:31 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=KV7UtXkC; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4HWF7b3CLKz4xb9 for ; Sat, 16 Oct 2021 05:25:31 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230286AbhJOS1h (ORCPT ); Fri, 15 Oct 2021 14:27:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238099AbhJOS1d (ORCPT ); Fri, 15 Oct 2021 14:27:33 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17A0BC061570 for ; Fri, 15 Oct 2021 11:25:27 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id gn3so2238737pjb.0 for ; Fri, 15 Oct 2021 11:25:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=gSViEy3eFcyxQ5IJwI4bvvDTv8dgwN2jD7Tp4pBQcW0=; b=KV7UtXkCRNNyLAAYjOWnG28hPe7uFCq6FX9JnvwE26MtAtZuECUe4NJVF8IqQ59Ayp b5I8n6LrdE9Pd5KNVuu5oXBGk9BvNEqXhjyRuBGc19bLg61gRzuaX8aeJAP5xRtywpNF DN/r4PtisWK+JPT1/DVuJmgRvIZAEl5vSsSTDV8UaimjNytKv2CNmYL4VDVfAHhhTxAe BKUYqCHkx0lpOdb6/JdfUREIE0GfarFTx1Sh3DP3PW3ozyxq6cvB5c7a2j5OUhKo+p4P jI2iJLub9hHmhQnPtXPKLhauc1cqfXqcnar+1A6m5N4d6Hdj34tkoUgNfvHAlNy7Ii6x OQiw== 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:mime-version :content-transfer-encoding; bh=gSViEy3eFcyxQ5IJwI4bvvDTv8dgwN2jD7Tp4pBQcW0=; b=DxQ6+HHwRAUzzXwpmsBNeP3Ng+utkXq6hdUY1PpONX0O/zkV23aRzxGUae+oFRANBK /nDzUzgwL2ZzUKDZL8h9ND/smopieE570ZTnl1KTJR3NbK5UOr+0O4vvr+HLD6AypZol XIomQiUErY7snDG/yQBsZRWetCHnrUIKG/qFEmjjisDK4+rhMcwDn/9+GsFIaqI9uN3J rGRjNpiinAH2RN4P72ebGtQVkq3PRn3B4IuJtn3P/n97WEGIPdR7O1jDUwm6RPKaEajj 8kAVR2rc1WysyG5Vdh6Widsf9MWGGTFXluIDYIyqQzGpPsgi93i3+HCPpIonf/xU5yok ZNxA== X-Gm-Message-State: AOAM531Amv/wU55aK4ankBU98AlhiWBXJTkoueF9M1lNIfozQ0J4lNRq IyN+4QcwfIAWg9tZUYa4xwqe+80I3Bo= X-Google-Smtp-Source: ABdhPJwVetrMWd7UPN1P10KZH20u2gSMsN+bgKQL7bLeD2zJl2q4VulVZ1LpykLuEKV7ryCz4gs0Mg== X-Received: by 2002:a17:90a:b382:: with SMTP id e2mr15552050pjr.119.1634322326039; Fri, 15 Oct 2021 11:25:26 -0700 (PDT) Received: from harshads-520.kir.corp.google.com ([2620:15c:17:10:908e:77f9:869:b859]) by smtp.googlemail.com with ESMTPSA id n14sm5215574pgd.68.2021.10.15.11.25.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 11:25:25 -0700 (PDT) From: Harshad Shirwadkar X-Google-Original-From: Harshad Shirwadkar To: linux-ext4@vger.kernel.org Cc: Harshad Shirwadkar Subject: [PATCH 1/2] ext4: commit inline data during fast commit Date: Fri, 15 Oct 2021 11:25:12 -0700 Message-Id: <20211015182513.395917-1-harshads@google.com> X-Mailer: git-send-email 2.33.0.1079.g6e70778dc9-goog MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Harshad Shirwadkar During the commit phase in fast commits if an inode with inline data is being committed, also commit the inline data along with inode. Since recovery code just blindly copies entire content found in inode TLV, there is no change needed on the recovery path. Thus, this change is backward compatiable. Signed-off-by: Harshad Shirwadkar --- fs/ext4/fast_commit.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c index 8ea5a81e6554..744b000d9756 100644 --- a/fs/ext4/fast_commit.c +++ b/fs/ext4/fast_commit.c @@ -819,7 +819,9 @@ static int ext4_fc_write_inode(struct inode *inode, u32 *crc) if (ret) return ret; - if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) + if (ext4_test_inode_flag(inode, EXT4_INODE_INLINE_DATA)) + inode_len = EXT4_INODE_SIZE(inode->i_sb); + else if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) inode_len += ei->i_extra_isize; fc_inode.fc_ino = cpu_to_le32(inode->i_ino); From patchwork Fri Oct 15 18:25:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: harshad shirwadkar X-Patchwork-Id: 1541863 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=SQmsCyfh; dkim-atps=neutral Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee2:21ea]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HWF7c29brz9sRR for ; Sat, 16 Oct 2021 05:25:32 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4HWF7c0TYtz4xbY for ; Sat, 16 Oct 2021 05:25:32 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4HWF7c0Rp0z4xbZ; Sat, 16 Oct 2021 05:25:32 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=SQmsCyfh; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4HWF7c0NS2z4xbY for ; Sat, 16 Oct 2021 05:25:32 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242541AbhJOS1h (ORCPT ); Fri, 15 Oct 2021 14:27:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242502AbhJOS1f (ORCPT ); Fri, 15 Oct 2021 14:27:35 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADAC5C061762 for ; Fri, 15 Oct 2021 11:25:28 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id e10so2014860plh.8 for ; Fri, 15 Oct 2021 11:25:28 -0700 (PDT) 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=/zML258PTe3cKA7ecvxnSQ7xvyxACM1IYLBF+ivpPU8=; b=SQmsCyfhs5Uz6GrjJX/K050hCPC/ZpkAqeBcXb0UmRElngz1EqzqGtX5V+th9dp6Ks 51hLM+1G4w5AvMQtxKMiJKcfwS9TxQXe2bq4T2M+1UgxX+BUaTwFESbiWiii8KNh94Ua i47SI0g8OZTzOCqoYtn9ytixEFVS2JbDlJEfx0wccC3OeA0Rf3s1LUkY/ZqPr5F2x1fe lxD1djflrMlapfTzhruD6kcK580XP+Kz0pnB1kXjmjQ7APUgoY8OAiBDvjgpurHfWukf KJig2t5KBkb9tG0oiByYpijTdRe7EHYfmeoAorkmfdALoJLh7Iaok7yVmXIrr+4shDhT iBkw== 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=/zML258PTe3cKA7ecvxnSQ7xvyxACM1IYLBF+ivpPU8=; b=VD6E5igZy18CV2fg95GkWWYNHaLPSm3LptoNkq43kRBXPJiKxpCERTiMl1OHyklzed l4nP8fD3ZljwA3Rk7Dq07erqLcDlF7B8aUAxkK+CPsvZNr0PbZ9ZXG2wQxA7+uAqTGGh MPSm1KbkzrZlmv/0d6Dr8oLhjZIrsxCeWW7Dqkl+x3vi4VwPFm66XYedlI1DI0ChG1ld ddDg47AmuLhct3zS8ajSsYrjyFRoG3RBf325yGKxSaaVXZIL7o3P04HN3leg11pyWk4w Rt7wNXFZomB7fkIqpOuI5pH4+eNtsGBHIlvynDQfXYLKpkjULaqOBa+3PRrUsErzCqyp wWcQ== X-Gm-Message-State: AOAM532XWf9fCTXUA1qPTNhfsSNUhkmMoMw1nGM5qmkXBO1MnKD+zx2L r53oXuZyDjfVfwn+yHaGDioZngWE/Rc= X-Google-Smtp-Source: ABdhPJy73MXJRbOze1bWaUoojEn4L0x50q2+Ie3Hn3RkpNj7k+iBJb0gcd2nyiYGlxkBPn5zSNnvtg== X-Received: by 2002:a17:90a:9403:: with SMTP id r3mr29319227pjo.220.1634322327810; Fri, 15 Oct 2021 11:25:27 -0700 (PDT) Received: from harshads-520.kir.corp.google.com ([2620:15c:17:10:908e:77f9:869:b859]) by smtp.googlemail.com with ESMTPSA id n14sm5215574pgd.68.2021.10.15.11.25.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 11:25:26 -0700 (PDT) From: Harshad Shirwadkar X-Google-Original-From: Harshad Shirwadkar To: linux-ext4@vger.kernel.org Cc: Harshad Shirwadkar Subject: [PATCH 2/2] ext4: inline data inode fast commit replay fixes Date: Fri, 15 Oct 2021 11:25:13 -0700 Message-Id: <20211015182513.395917-2-harshads@google.com> X-Mailer: git-send-email 2.33.0.1079.g6e70778dc9-goog In-Reply-To: <20211015182513.395917-1-harshads@google.com> References: <20211015182513.395917-1-harshads@google.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Harshad Shirwadkar Since there are no blocks in an inline data inode, there's no point in fixing iblocks field in fast commit replay path for this inode. Similarly, there's no point in fixing any block bitmaps / global block counters with respect to such an inode. Just bail out from these functions if an inline data inode is encountered. Signed-off-by: Harshad Shirwadkar --- fs/ext4/extents.c | 3 +++ fs/ext4/fast_commit.c | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 09f56e04f4b2..0ecf819bf189 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -6071,6 +6071,9 @@ int ext4_ext_clear_bb(struct inode *inode) int j, ret = 0; struct ext4_map_blocks map; + if (ext4_test_inode_flag(inode, EXT4_INODE_INLINE_DATA)) + return 0; + /* Determin the size of the file first */ path = ext4_find_extent(inode, EXT_MAX_BLOCKS - 1, NULL, EXT4_EX_NOCACHE); diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c index 744b000d9756..0f32b445582a 100644 --- a/fs/ext4/fast_commit.c +++ b/fs/ext4/fast_commit.c @@ -1526,7 +1526,8 @@ static int ext4_fc_replay_inode(struct super_block *sb, struct ext4_fc_tl *tl, * crashing. This should be fixed but until then, we calculate * the number of blocks the inode. */ - ext4_ext_replay_set_iblocks(inode); + if (!ext4_test_inode_flag(inode, EXT4_INODE_INLINE_DATA)) + ext4_ext_replay_set_iblocks(inode); inode->i_generation = le32_to_cpu(ext4_raw_inode(&iloc)->i_generation); ext4_reset_inode_seed(inode); @@ -1844,6 +1845,10 @@ static void ext4_fc_set_bitmaps_and_counters(struct super_block *sb) } cur = 0; end = EXT_MAX_BLOCKS; + if (ext4_test_inode_flag(inode, EXT4_INODE_INLINE_DATA)) { + iput(inode); + continue; + } while (cur < end) { map.m_lblk = cur; map.m_len = end - cur;