From patchwork Tue May 3 19:28:14 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mitch Harder X-Patchwork-Id: 751182 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p43JSUK8005123 for ; Tue, 3 May 2011 19:28:30 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754657Ab1ECT22 (ORCPT ); Tue, 3 May 2011 15:28:28 -0400 Received: from mail-gw0-f46.google.com ([74.125.83.46]:60792 "EHLO mail-gw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754501Ab1ECT21 (ORCPT ); Tue, 3 May 2011 15:28:27 -0400 Received: by gwaa18 with SMTP id a18so158251gwa.19 for ; Tue, 03 May 2011 12:28:27 -0700 (PDT) Received: by 10.90.139.17 with SMTP id m17mr345450agd.51.1304450906797; Tue, 03 May 2011 12:28:26 -0700 (PDT) Received: from localhost.localdomain (adsl-70-146-208-159.mob.bellsouth.net [70.146.208.159]) by mx.google.com with ESMTPS id z2sm353963anj.11.2011.05.03.12.28.25 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 03 May 2011 12:28:26 -0700 (PDT) From: Mitch Harder To: linux-btrfs@vger.kernel.org Cc: Mitch Harder Subject: [PATCH 1/2] [RFC] Btrfs: Increase limit on size of compressed extent Date: Tue, 3 May 2011 14:28:14 -0500 Message-Id: <1304450895-15586-2-git-send-email-mitch.harder@sabayonlinux.org> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1304450895-15586-1-git-send-email-mitch.harder@sabayonlinux.org> References: <1304450895-15586-1-git-send-email-mitch.harder@sabayonlinux.org> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 03 May 2011 19:28:30 +0000 (UTC) The size of compressed extents was limited to 128K, which leads to fragmentation of the extents (although the extents themselves may still be located contiguously). This limit is put in place to ease the RAM required when spreading compression across several CPUs, and to make sure the amount of IO required to do a random read is reasonably small. Increase this limit to 512K. --- fs/btrfs/inode.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 870869a..7ef2b34 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -333,8 +333,8 @@ static noinline int compress_file_range(struct inode *inode, unsigned long nr_pages_ret = 0; unsigned long total_compressed = 0; unsigned long total_in = 0; - unsigned long max_compressed = 128 * 1024; - unsigned long max_uncompressed = 128 * 1024; + unsigned long max_compressed = 512 * 1024; + unsigned long max_uncompressed = 512 * 1024; int i; int will_compress; int compress_type = root->fs_info->compress_type; @@ -343,7 +343,7 @@ static noinline int compress_file_range(struct inode *inode, again: will_compress = 0; nr_pages = (end >> PAGE_CACHE_SHIFT) - (start >> PAGE_CACHE_SHIFT) + 1; - nr_pages = min(nr_pages, (128 * 1024UL) / PAGE_CACHE_SIZE); + nr_pages = min(nr_pages, (512 * 1024UL) / PAGE_CACHE_SIZE); /* * we don't want to send crud past the end of i_size through @@ -368,7 +368,7 @@ again: * * We also want to make sure the amount of IO required to do * a random read is reasonably small, so we limit the size of - * a compressed extent to 128k. + * a compressed extent to 512k (was 128k). */ total_compressed = min(total_compressed, max_uncompressed); num_bytes = (end - start + blocksize) & ~(blocksize - 1);