Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1234850pxa; Thu, 20 Aug 2020 06:22:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwnyM4DHZOjEmNccpn6AXBxG3cpAABnRkwDPBaG0jFXEtp90ae/ZFlaRxZHrn6PVgizDpG X-Received: by 2002:a17:906:4007:: with SMTP id v7mr3330741ejj.197.1597929736995; Thu, 20 Aug 2020 06:22:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597929736; cv=none; d=google.com; s=arc-20160816; b=CeKjM2Woc33TVdU5RQduqHVlOct0ctmycFtNNzg6zgRpz/Jv016td2DPgCvEHcj1fJ wLgG+ceoHm6RmW/QuGNXqaLwU3juUjy+SrhO6YhLFvvXEwBxqD+rJyHzBGSW59Hcz9Fn JMBfljB++KVYOijL8LjcdiAbQ1u0r6uXtsC2EDRm//LEIcgM/cupwe4jipBxZuvhPpd0 oJMom7EsQ5PnShOf0yXGkqMn2kO8QPQs2o0O39nGysr4czcMkNF1zZnN+xOF54nxCgdJ OnSBcLe1+gR2s9JwSb0mhfoLPh4DtDZTvV5cfBKii9E+JM5UooXGHOtDBK60senaZ4iY IB4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8MNhmLRQp9m02xjbwg/Sg7mps6CLXcK0LJ0Zs4+w7eg=; b=QvIpT/lHcu3T01c/p+M4qaa174XZ6I0YNw+AOeFIYHyj3+eFraj2eXAFFeGL2qneaJ DpbviTWxyHS0LMgruRkAUPqJEAYSZPX3iredxOR02yfgEvDq9pPZCj/HdLNo5dzuF5W9 LZTDJVxMW985YNDZWP63SB0Krz2XLKYzzlE1rwlXI7uKYLp5zGAqAwBs7MIWZm0UaeeZ h/8WOTy55tybbVMjCLVbdHNGIkuWarhcT4wQ1aSmj5yf/+bEIsl6YY3St8/st2J7C/z0 HmoXkFyVXctSvQ5XcrnXEICHkJ4KFFrCcX27hjuL//bqdf8GUfeFDkhhRpE/AW9+pmC4 WTIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GAnxio2R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a8si1257594ejx.387.2020.08.20.06.21.52; Thu, 20 Aug 2020 06:22:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GAnxio2R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728368AbgHTNRF (ORCPT + 99 others); Thu, 20 Aug 2020 09:17:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:48412 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728468AbgHTJfL (ORCPT ); Thu, 20 Aug 2020 05:35:11 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DE43421775; Thu, 20 Aug 2020 09:35:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597916110; bh=hXW5C5tg9bIADkGE/iPp51ZKHJBMTdAvYzZ8FvK89oc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GAnxio2RzbgvwL/CzWeq7cnayDrV5yFLOBiYbry7JP5lOdZedDWvz95aI4hg++5VA 7i0Q5VxM72/aeiwntp88P2p5LvuKH7Mx8EYZhs0GFIi6Ov9FnHmiMMZTPcr/s8bYP/ s17v9YBIBhXtnj9oXDabwSOqQnwWx95IcwvUvyho= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josef Bacik , Filipe Manana , David Sterba Subject: [PATCH 5.7 015/204] btrfs: stop incremening log_batch for the log root tree when syncing log Date: Thu, 20 Aug 2020 11:18:32 +0200 Message-Id: <20200820091606.978695084@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091606.194320503@linuxfoundation.org> References: <20200820091606.194320503@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Filipe Manana commit 28a9579561bcb9082715e720eac93012e708ab94 upstream. We are incrementing the log_batch atomic counter of the root log tree but we never use that counter, it's used only for the log trees of subvolume roots. We started doing it when we moved the log_batch and log_write counters from the global, per fs, btrfs_fs_info structure, into the btrfs_root structure in commit 7237f1833601dc ("Btrfs: fix tree logs parallel sync"). So just stop doing it for the log root tree and add a comment over the field declaration so inform it's used only for log trees of subvolume roots. This patch is part of a series that has the following patches: 1/4 btrfs: only commit the delayed inode when doing a full fsync 2/4 btrfs: only commit delayed items at fsync if we are logging a directory 3/4 btrfs: stop incremening log_batch for the log root tree when syncing log 4/4 btrfs: remove no longer needed use of log_writers for the log root tree After the entire patchset applied I saw about 12% decrease on max latency reported by dbench. The test was done on a qemu vm, with 8 cores, 16Gb of ram, using kvm and using a raw NVMe device directly (no intermediary fs on the host). The test was invoked like the following: mkfs.btrfs -f /dev/sdk mount -o ssd -o nospace_cache /dev/sdk /mnt/sdk dbench -D /mnt/sdk -t 300 8 umount /mnt/dsk CC: stable@vger.kernel.org # 5.4+ Reviewed-by: Josef Bacik Signed-off-by: Filipe Manana Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/ctree.h | 1 + fs/btrfs/tree-log.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -1040,6 +1040,7 @@ struct btrfs_root { struct list_head log_ctxs[2]; atomic_t log_writers; atomic_t log_commit[2]; + /* Used only for log trees of subvolumes, not for the log root tree */ atomic_t log_batch; int log_transid; /* No matter the commit succeeds or not*/ --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -3125,7 +3125,6 @@ int btrfs_sync_log(struct btrfs_trans_ha btrfs_init_log_ctx(&root_log_ctx, NULL); mutex_lock(&log_root_tree->log_mutex); - atomic_inc(&log_root_tree->log_batch); atomic_inc(&log_root_tree->log_writers); index2 = log_root_tree->log_transid % 2;