Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1101235pxa; Thu, 20 Aug 2020 02:28:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztUSvdxWfW8YfR09gK3Nffy5LGZxQu8JavhJjbwNL7T6+RN4bvaS5Y/O0Cz4MaRfsiDCyi X-Received: by 2002:a05:6402:2212:: with SMTP id cq18mr2051166edb.34.1597915722080; Thu, 20 Aug 2020 02:28:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597915722; cv=none; d=google.com; s=arc-20160816; b=gpMvPS2u2nUg8r3zExuqHIQFVOl1lA0pclZkUA4v/Px3nfmzhnaaIlt0yBHOXL3gjS oavHCWXl/YqA1eJ87tLng5TafYpGUIsHnyCVyfcEtUNjDUMp7DfB/CgKcmscLXmGtsnS gc+jOTUTmyQIuEQGPnexQxm97CE0NKMClew9vasL5oYKa/2xQkgP8Och8/9JAMOGN/Hd MpwNU9L/hTUMaBBPyv8BotoEiGK6iO9QBh5Xzl+Cbq4dMtUZZLc5QtQb0uN9DNndmWr0 l+SlnN3Gsh2HWkrcdh5YgWCnMVn9QQUrrphYfosn1+jBXirRT6oKQupp68Njozzww92T Eniw== 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=6SSDqOy2MSTCH43eshwjnrGOk0jg/kJ/zFIKTHQG7CY=; b=IEeFN/0hCbDcDnMhv4O6TMF7PHIGwmerR6sKuaZ+OwidHcXF0YjpKiLach7vMR7RvU eMHucF3P05V1Du8ZBkhVttt6wu2gbBm6Gi/ysp4POlrWya9FYY2Cz3kbSmoJESXk2XxC 0Uv7eA1LwpkEOxNwRcUH/cBY3lIzPN2HbS/SOPQ8DuWQBwh180NTrjcRiU1lxZIHof8z wahd1G5jxV2wuOwTSEy8hO4pY+FqNda5I7vEl6+pyT43IqGqYe+Bz0rE7shsSJMso6yM ZtfAdXVK0+lKjn2JOB5ZHEV6g6SuLsQ4CCUiKlE46fEQ0qBtub7HtoeF1tuojmYyvTUo zVsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZnR4dO3y; 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 qk16si902727ejb.532.2020.08.20.02.28.18; Thu, 20 Aug 2020 02:28:42 -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=ZnR4dO3y; 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 S1726995AbgHTJYl (ORCPT + 99 others); Thu, 20 Aug 2020 05:24:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:60060 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726905AbgHTJYN (ORCPT ); Thu, 20 Aug 2020 05:24:13 -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 AF6D822CB2; Thu, 20 Aug 2020 09:24:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597915453; bh=79vjTGqCALhCjjQuXM0iFlKNzKmobrwLY9mfAF9im6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZnR4dO3yLd2snCkBRdrCgOhj3puXP0xu1iVZkZBNAanVg9xZVsJZcOwtqSkPOHHLi AMB1NOxrh6RgkLCAUZI/T0CBB2mIJnr5ro00JwcMpwSclUlH8v7iGZGvmNRDKn+VOX Y6pu+hT8Cau8ynVtY3M6DqWErq9ZeT/P6cWG+7qM= 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.8 019/232] btrfs: stop incremening log_batch for the log root tree when syncing log Date: Thu, 20 Aug 2020 11:17:50 +0200 Message-Id: <20200820091613.667356588@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091612.692383444@linuxfoundation.org> References: <20200820091612.692383444@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 @@ -1061,6 +1061,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 @@ -3116,7 +3116,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;