Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp1393963rwb; Fri, 5 Aug 2022 00:43:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR5UKbbqnBhGLuFGQKeAXQCeycJumD/9uS9/1QagYb7YF4z6i7cjfNWKGMqZ3v7lAdh1ZEi3 X-Received: by 2002:a17:90b:1b43:b0:1f5:4b1b:5e91 with SMTP id nv3-20020a17090b1b4300b001f54b1b5e91mr6484027pjb.204.1659685390670; Fri, 05 Aug 2022 00:43:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659685390; cv=none; d=google.com; s=arc-20160816; b=sJ4di66IOVP3YV6Ujjv9OmeMMNzSUjkN2beS37P2leL0VMGmrgL3AFRQMksHmopXgv Shn4TDQuQKvY9cAkejMgDVgSVX0UBaVWze50Ytz7nkqSNu2S0SlK9WG4yBtqQ1GwRz6v PODl8jSVcmolUUVHarPBRFAQWB/0dJG5N/ep4y/9/IyMSSgzsfwfJXLr1XIE07arU7rX 8OgfG1Gf8h3Yb5UA9aPLL2JPpt11IHsYCllaYduONNfUkLu82L10RHBX4HPXYpRBaS82 xfd6tgQWmZ6yKXk+6Z6h2EEQEjUebcB2lQrUvQOFcAFrIIxoG4D6Inwvkfqtd1HFSH9/ 4hKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date; bh=xWe27uqIT0fljSItrEI4Fqap+zCESH7NOXCw4w5ugfw=; b=pC/QRRKnrm1fyRcB0AqkzE8euT9h0VLiadtPlXJiNt8YyNUjCj5auqyhMln7nBZHLH XBFy1C5z1sHfUVopLsvEvZweLgEENbi0oRWzdQwyITBaoSSa7ZNhlYLz0b9m6mYvh8/W mUly8g+ZduCQF2MuIifk6fb8pW39JCceawbtOW6qMX3BSb7GN3BSrqzt3dMK6hxMCY4u RfYsQx3dfKU9bIG4YRkxo4BD/ucY03nxURqQujJnHTKbx3G2p9J0VGC/UUQfCP+KrYQh R/O+daxOBRj/73TWg1Oy5qRWcHxTNCF2hbIyeCky7AoTT0CumIqJUXPrZNdjeF+iPFgo 6fzA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id my18-20020a17090b4c9200b001f4ee4c5943si4090705pjb.101.2022.08.05.00.42.57; Fri, 05 Aug 2022 00:43:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237674AbiHEHii (ORCPT + 99 others); Fri, 5 Aug 2022 03:38:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231949AbiHEHif (ORCPT ); Fri, 5 Aug 2022 03:38:35 -0400 Received: from gw2.atmark-techno.com (gw2.atmark-techno.com [35.74.137.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5B39D1A06C for ; Fri, 5 Aug 2022 00:38:34 -0700 (PDT) Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by gw2.atmark-techno.com (Postfix) with ESMTPS id 7A81920CAB for ; Fri, 5 Aug 2022 16:38:33 +0900 (JST) Received: by mail-pl1-f199.google.com with SMTP id w18-20020a170902e89200b0016eff609594so1255556plg.11 for ; Fri, 05 Aug 2022 00:38:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:x-gm-message-state:from:to:cc; bh=xWe27uqIT0fljSItrEI4Fqap+zCESH7NOXCw4w5ugfw=; b=adxeSb0hiNJd6SGymJ6Afx3Yn0k878DcmID+pH2nGObChj6ksEC8UiuUB3kuqpGU+P /hCNi8ZDIzfQCO4wIQCw/qr8wKX1PUevKR06iPLfSnMZzUh85X0/JAkwAivRW8/ehGUd slRGDMNP7HXSxXifW/ZvpwA4z4C9FC0AzA0U/RfCtyVcrnoyN0Yhyxprin+g3OWgu7oV XwNhyexo+GdQFOSxvFuGfEWCZ3rb/vJhbWLPsYe1HeoyQXNF0UlnQCwERr1mNPNt/Jqd 534DFyKFIK3kqDMQ7jeUljB9mEdtNgNXgv1Rnd5Qe7aWEssPnfDdmg/IydS1T2zv+W1P UUGg== X-Gm-Message-State: ACgBeo0B9l2H/wrIzRnJeH8qvfhYhuSThiVKro7e+8B/yU1fy89/YO0Q rHAtXjeRGv1OU3ewLiSH1qGm7/p2nM35dB5twdO2MpUFnk/lZn81BX35mzfzoMTIPM/S4uWhtoX yHJNl0tHvuGXY9eegCIS3yWDzew== X-Received: by 2002:a17:90b:33c6:b0:1f4:f595:b0f1 with SMTP id lk6-20020a17090b33c600b001f4f595b0f1mr6431598pjb.230.1659685113094; Fri, 05 Aug 2022 00:38:33 -0700 (PDT) X-Received: by 2002:a17:90b:33c6:b0:1f4:f595:b0f1 with SMTP id lk6-20020a17090b33c600b001f4f595b0f1mr6431579pjb.230.1659685112798; Fri, 05 Aug 2022 00:38:32 -0700 (PDT) Received: from pc-zest.atmarktech (145.82.198.104.bc.googleusercontent.com. [104.198.82.145]) by smtp.gmail.com with ESMTPSA id q11-20020a170902dacb00b0016dcfedfe30sm2306749plx.90.2022.08.05.00.38.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Aug 2022 00:38:32 -0700 (PDT) Received: from martinet by pc-zest.atmarktech with local (Exim 4.96) (envelope-from ) id 1oJruh-007Pjr-1W; Fri, 05 Aug 2022 16:38:31 +0900 Date: Fri, 5 Aug 2022 16:38:21 +0900 From: Dominique MARTINET To: Pavel Tikhomirov , Josef Bacik Cc: Chris Mason , David Sterba , linux-btrfs@vger.kernel.org, lkml , Chen Liang-Chun , Alexander Mikhalitsyn , kernel@openvz.org, Yu Kuai , Theodore Ts'o Subject: Re: fiemap is slow on btrfs on files with multiple extents Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <21dd32c6-f1f9-f44a-466a-e18fdc6788a7@virtuozzo.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Pavel Tikhomirov wrote on Thu, Aug 04, 2022 at 07:30:52PM +0300: > I see a similar problem here > https://lore.kernel.org/linux-btrfs/Yr4nEoNLkXPKcOBi@atmark-techno.com/#r , > but in my case I have "5.18.6-200.fc36.x86_64" fedora kernel which does not > have 5ccc944dce3d ("filemap: Correct the conditions for marking a folio as > accessed") commit, so it should be something else. The root cause might be different but I guess they're related enough: if fiemap gets faster enough even when the whole file is in cache I guess that works for me :) Josef Bacik wrote on Thu, Aug 04, 2022 at 02:49:39PM -0400: > On Thu, Aug 04, 2022 at 07:30:52PM +0300, Pavel Tikhomirov wrote: > > I ran the below test on Fedora 36 (the test basically creates "very" sparse > > file, with 4k data followed by 4k hole again and again for the specified > > length and uses fiemap to count extents in this file) and face the problem > > that fiemap hangs for too long (for instance comparing to ext4 version). > > Fiemap with 32768 extents takes ~37264 us and with 65536 extents it takes > > ~34123954 us, which is x1000 times more when file only increased twice the > > size: > > > > Ah that was helpful, thank you. I think I've spotted the problem, please give > this a whirl to make sure we're seeing the same thing. Thanks, FWIW this patch does help a tiny bit, but I'm still seeing a huge slowdown: with patch cp goes from ~600MB/s (55s) to 136MB/s (3m55s) on the second run; and without the patch I'm getting 47s and 5m35 respectively so this has gotten a bit better but these must still be cases running through the whole list (e.g. when not hitting a hole?) My reproducer is just running 'cp file /dev/null' twice on a file with 194955 extents (same file with mixed compressed & non-compressed extents as last time), so should be close enough to what Pavel was describing in just much worse. -- Dominique