From patchwork Mon Oct 25 09:56:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 12581309 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1658DC433F5 for ; Mon, 25 Oct 2021 09:56:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E772060FDC for ; Mon, 25 Oct 2021 09:56:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232676AbhJYJ66 (ORCPT ); Mon, 25 Oct 2021 05:58:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:37334 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229764AbhJYJ6v (ORCPT ); Mon, 25 Oct 2021 05:58:51 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CF33960FDC for ; Mon, 25 Oct 2021 09:56:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635155789; bh=UZ/O6nGIVMOiiWc0tqxKDctxna+Jq0B0IjUkgivy2YQ=; h=From:To:Subject:Date:From; b=K/DkdMvIn+is3rIZupp6Pd2XOIPdlZHn/0RiWCAu0GlF4isVnou1Fsp+AtAI0+m0d Geb5VTZDIM1gv5JkaJjlh67fSAZXs+6IoTC/yzE9/pk6aA3245YkexPjELApCgQAuV KsckFnoBvZQy4p0dD9hcev2f3wZgHa0AuBFsWTlC3wKrRrL+RWUFPqwxwFtzAhtOkE 5+Lod+kNCTRYVL8Adc5po8yWILY//tDDJ6jld4GA2Sjq+X8s/iPnXmJHbWuIIbzO4y NUh6kF4Srzct1lfzlSQt8hDzJJtkjeaMogGAzK8/owzCFSkd9qEN1A74mXaKPPYQv4 77O2RguYGdSQg== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH 0/6] btrfs: speedup directory logging/fsync by copying index keys only Date: Mon, 25 Oct 2021 10:56:20 +0100 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Filipe Manana This patchset reworks directory logging to make it copy only the dir index keys, instead of copying both dir index keys and dir item keys, as both have the same type of information. This reduces the amount of logged metadata by about half, and therefore we do about half of the cpu bound work, half of the IO and use less log tree space (except for very small directories). This will allow other optimizations to build on top, some of which are only possible after this change, while others become easier and less cumbersome to implement after this change. Performance tests are in the changelog of patch 5/6. Patch 6/6 only removes code that deals with dir item keys when replaying directory deletions and it could have been squashed into patch 5/6, but since that one is already large and works without 6/6, I opted to make it separate to make it easier to review. Also, after this change we are still able to correctly replay a log tree generated by an old kernel, and an old kernel is also able to correctly replay a log tree generated by a kernel that has this patchset applied. I'm sending this close to the 5.16 merge window, but my intention is to have it only for the next merge window (5.17). Filipe Manana (6): btrfs: remove root argument from drop_one_dir_item() btrfs: remove root argument from btrfs_unlink_inode() btrfs: remove root argument from add_link() btrfs: remove root argument from check_item_in_log() btrfs: only copy dir index keys when logging a directory btrfs: remove no longer needed logic for replaying directory deletes fs/btrfs/btrfs_inode.h | 18 +- fs/btrfs/ctree.h | 1 - fs/btrfs/inode.c | 25 +- fs/btrfs/tree-log.c | 582 ++++++++++++++------------------ include/uapi/linux/btrfs_tree.h | 4 +- 5 files changed, 280 insertions(+), 350 deletions(-)