From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BF0DC5ACD6 for ; Wed, 18 Mar 2020 14:44:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E1CE020777 for ; Wed, 18 Mar 2020 14:44:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726756AbgCROov (ORCPT ); Wed, 18 Mar 2020 10:44:51 -0400 Received: from mx2.suse.de ([195.135.220.15]:49432 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726647AbgCROov (ORCPT ); Wed, 18 Mar 2020 10:44:51 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 20880ACAE; Wed, 18 Mar 2020 14:44:50 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id D2D61DA70E; Wed, 18 Mar 2020 15:44:21 +0100 (CET) Date: Wed, 18 Mar 2020 15:44:21 +0100 From: David Sterba To: Qu Wenruo Cc: Josef Bacik , linux-btrfs@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH 0/2] Drop some mis-uses of READA Message-ID: <20200318144421.GZ12659@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Qu Wenruo , Josef Bacik , linux-btrfs@vger.kernel.org, kernel-team@fb.com References: <20200313210954.148686-1-josef@toxicpanda.com> <91bf00f3-a851-2e84-4213-761b0d776af2@gmx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <91bf00f3-a851-2e84-4213-761b0d776af2@gmx.com> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Sat, Mar 14, 2020 at 10:56:06AM +0800, Qu Wenruo wrote: > > > On 2020/3/14 上午5:09, Josef Bacik wrote: > > In debugging Zygo's huge commit delays I noticed we were burning a bunch of time > > doing READA in cases where we don't need to. The way READA works in btrfs is > > we'll load up adjacent nodes and leaves as we walk down. This is useful for > > operations where we're going to be reading sequentially across the tree. > > > > But for delayed refs we're looking up one bytenr, and then another one which > > could be elsewhere in the tree. With large enough extent trees this results in > > a lot of unneeded latency. > > > > The same applies to build_backref_tree, but that's even worse because we're > > looking up backrefs, which are essentially randomly spread out across the extent > > root. Thanks, > > There are quite some other locations abusing READA. > > E.g. btrfs_read_block_groups(), where we're just searching for block > group items. There is no guarantee that next block group item is in next > a few leaves. > > I guess it's a good time to review all READA abuse. Or would you mind me > to do that? If you find some clear example where the items are scattered over the tree then yes. For the rest it would be good to put a comment that the readahead really helps. Thanks.