From mboxrd@z Thu Jan 1 00:00:00 1970 From: Felipe Contreras Subject: Re: Horrible btrfs performance due to fragmentation Date: Mon, 1 Nov 2010 00:36:58 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Cc: Calvin Walton , Linux Kernel Mailing List , linux-btrfs@vger.kernel.org, Chris Mason To: cwillu Return-path: In-Reply-To: List-ID: On Mon, Nov 1, 2010 at 12:25 AM, cwillu wrote: > On Sun, Oct 31, 2010 at 1:58 PM, Felipe Contreras > wrote: >> On Mon, Oct 11, 2010 at 6:46 PM, Calvin Walton wrote: >>> On Mon, 2010-10-11 at 03:30 +0300, Felipe Contreras wrote: >>>> I use btrfs on most of my volumes on my laptop, and I've always fe= lt >>>> booting was very slow, but definitely sure is slow, is starting up >>>> Google Chrome: >>>> >>>> encrypted ext4: ~20s >>>> btrfs: ~2:11s >>>> >>>> I have tried different things to find out exactly what is the issu= e, >>>> but haven't quite found it yet. >>> >>> If you've been using this volume for a while, it could just have be= come >>> badly fragmented. You could try btrfs's fancy online defragmentatio= n >>> abilities to see if that'll give you an improvement: >>> >>> # btrfs filesystem defragment /mountpoint/of/volume >>> >>> Let us know if that helps, of course :) >> >> I finally managed to track down this issue. Indeed the fragmentation >> is horrible, and 'btrfs filesystem defragment' doesn't help: >> >> % cat History-old > History >> % btrfs filesystem defragment /home >> % echo 3 > /proc/sys/vm/drop_caches >> >> % time dd if=3DHistory of=3D/dev/null && time dd if=3DHistory-old of= =3D/dev/null >> 109664+0 records in >> 109664+0 records out >> 56147968 bytes (56 MB) copied, 1.90015 s, 29.5 MB/s >> dd if=3DHistory of=3D/dev/null =C2=A00.08s user 0.29s system 15% cpu= 2.458 total >> 109664+0 records in >> 109664+0 records out >> 56147968 bytes (56 MB) copied, 97.772 s, 574 kB/s >> dd if=3DHistory-old of=3D/dev/null =C2=A00.07s user 0.80s system 0% = cpu 1:37.79 total >> >> I think this is a serious issue that *must* be fixed for 1.0. I file= d >> a bug for this: >> https://bugzilla.kernel.org/show_bug.cgi?id=3D21562 > > btrfs fi defrag isn't recursive. =C2=A0"btrfs filesystem defrag /home= " will > defragment the space used to store the folder, without touching the > space used to store files in that folder. Yes, that came up on the IRC, but: 1) It doesn't make sense: "btrfs filesystem" doesn't allow a fileystem as argument? Why would anyone want it to be _non_ recursive? 2) The filesystem should not degrade performance so horribly no matter how long the it has been used. Even git has automatic garbage collection. --=20 =46elipe Contreras From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756863Ab0JaWhG (ORCPT ); Sun, 31 Oct 2010 18:37:06 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:38251 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753280Ab0JaWhC convert rfc822-to-8bit (ORCPT ); Sun, 31 Oct 2010 18:37:02 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=JS876t2CBq3TViDtcqMrcox2ekPsmElD04KserWV1D4lObtiDF2KWzHsVdo6llZ522 Ce0PNAPvjHMG1SEAeZ2I82l5UkJ2DfS2be2BPZ8ZNQZWZfldMiMnEmJPCkshdMTEvnh1 yW18EBp9l3/3Gh7GJN6/LTF7p9InORjtx9j/Y= MIME-Version: 1.0 In-Reply-To: References: Date: Mon, 1 Nov 2010 00:36:58 +0200 Message-ID: Subject: Re: Horrible btrfs performance due to fragmentation From: Felipe Contreras To: cwillu Cc: Calvin Walton , Linux Kernel Mailing List , linux-btrfs@vger.kernel.org, Chris Mason Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 1, 2010 at 12:25 AM, cwillu wrote: > On Sun, Oct 31, 2010 at 1:58 PM, Felipe Contreras > wrote: >> On Mon, Oct 11, 2010 at 6:46 PM, Calvin Walton wrote: >>> On Mon, 2010-10-11 at 03:30 +0300, Felipe Contreras wrote: >>>> I use btrfs on most of my volumes on my laptop, and I've always felt >>>> booting was very slow, but definitely sure is slow, is starting up >>>> Google Chrome: >>>> >>>> encrypted ext4: ~20s >>>> btrfs: ~2:11s >>>> >>>> I have tried different things to find out exactly what is the issue, >>>> but haven't quite found it yet. >>> >>> If you've been using this volume for a while, it could just have become >>> badly fragmented. You could try btrfs's fancy online defragmentation >>> abilities to see if that'll give you an improvement: >>> >>> # btrfs filesystem defragment /mountpoint/of/volume >>> >>> Let us know if that helps, of course :) >> >> I finally managed to track down this issue. Indeed the fragmentation >> is horrible, and 'btrfs filesystem defragment' doesn't help: >> >> % cat History-old > History >> % btrfs filesystem defragment /home >> % echo 3 > /proc/sys/vm/drop_caches >> >> % time dd if=History of=/dev/null && time dd if=History-old of=/dev/null >> 109664+0 records in >> 109664+0 records out >> 56147968 bytes (56 MB) copied, 1.90015 s, 29.5 MB/s >> dd if=History of=/dev/null  0.08s user 0.29s system 15% cpu 2.458 total >> 109664+0 records in >> 109664+0 records out >> 56147968 bytes (56 MB) copied, 97.772 s, 574 kB/s >> dd if=History-old of=/dev/null  0.07s user 0.80s system 0% cpu 1:37.79 total >> >> I think this is a serious issue that *must* be fixed for 1.0. I filed >> a bug for this: >> https://bugzilla.kernel.org/show_bug.cgi?id=21562 > > btrfs fi defrag isn't recursive.  "btrfs filesystem defrag /home" will > defragment the space used to store the folder, without touching the > space used to store files in that folder. Yes, that came up on the IRC, but: 1) It doesn't make sense: "btrfs filesystem" doesn't allow a fileystem as argument? Why would anyone want it to be _non_ recursive? 2) The filesystem should not degrade performance so horribly no matter how long the it has been used. Even git has automatic garbage collection. -- Felipe Contreras