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=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 E5B00C64E69 for ; Thu, 19 Nov 2020 21:11:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9AF9F22259 for ; Thu, 19 Nov 2020 21:11:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727040AbgKSVL0 (ORCPT ); Thu, 19 Nov 2020 16:11:26 -0500 Received: from mx2.suse.de ([195.135.220.15]:36060 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726199AbgKSVLZ (ORCPT ); Thu, 19 Nov 2020 16:11:25 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 08A7FAFA7; Thu, 19 Nov 2020 21:11:24 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id C4001DA701; Thu, 19 Nov 2020 22:09:37 +0100 (CET) Date: Thu, 19 Nov 2020 22:09:37 +0100 From: David Sterba To: Qu Wenruo Cc: linux-btrfs@vger.kernel.org, Nikolay Borisov Subject: Re: [PATCH v2 16/24] btrfs: file-item: use nodesize to determine whether we need readahead for btrfs_lookup_bio_sums() Message-ID: <20201119210937.GQ20563@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Qu Wenruo , linux-btrfs@vger.kernel.org, Nikolay Borisov References: <20201113125149.140836-1-wqu@suse.com> <20201113125149.140836-17-wqu@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201113125149.140836-17-wqu@suse.com> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Fri, Nov 13, 2020 at 08:51:41PM +0800, Qu Wenruo wrote: > In btrfs_lookup_bio_sums() if the bio is pretty large, we want to > readahead the csum tree. > > However the threshold is an immediate number, (PAGE_SIZE * 8), from the > initial btrfs merge. > > The value itself is pretty hard to guess the meaning, especially when > the immediate number is from the age where 4K sectorsize is the default > and only CRC32 is supported. > > For the most common btrfs setup, CRC32 csum and 4K sectorsize, > it means just 32K read would kick readahead, while the csum itself is > only 32 bytes in size. > > Now let's be more reasonable by taking both csum size and node size into > consideration. > > If the csum size for the bio is larger than one leaf, then we kick the > readahead. > This means for current default btrfs, the threshold will be 16M. > > This change should not change performance observably, thus this is mostly > a readability enhancement. > > Reviewed-by: Nikolay Borisov > Signed-off-by: Qu Wenruo Added to misc-next.