From patchwork Fri Mar 18 19:30:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 644661 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 p2IJfgc0022287 for ; Fri, 18 Mar 2011 19:41:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932486Ab1CRTlQ (ORCPT ); Fri, 18 Mar 2011 15:41:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:27094 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932199Ab1CRTlE (ORCPT ); Fri, 18 Mar 2011 15:41:04 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p2IJf3hx029646 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 18 Mar 2011 15:41:03 -0400 Received: from test1244.test.redhat.com (test1244.test.redhat.com [10.10.10.244]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p2IJf3wG017044 for ; Fri, 18 Mar 2011 15:41:03 -0400 From: Josef Bacik To: linux-btrfs@vger.kernel.org Subject: [PATCH] Btrfs: deal with min_bytes appropriately when looking for a cluster Date: Fri, 18 Mar 2011 15:30:17 -0400 Message-Id: <1300476617-2183-1-git-send-email-josef@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 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]); Fri, 18 Mar 2011 19:41:43 +0000 (UTC) difference when we have > page size blocks) and then only search for min_bytes amount of free space. Thanks, Signed-off-by: Josef Bacik --- fs/btrfs/free-space-cache.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index f631df8..63776ae 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c @@ -1910,8 +1910,8 @@ static int btrfs_bitmap_cluster(struct btrfs_block_group_cache *block_group, i = offset_to_bit(entry->offset, block_group->sectorsize, max_t(u64, offset, entry->offset)); - search_bits = bytes_to_bits(min_bytes, block_group->sectorsize); - total_bits = bytes_to_bits(bytes, block_group->sectorsize); + search_bits = bytes_to_bits(bytes, block_group->sectorsize); + total_bits = bytes_to_bits(min_bytes, block_group->sectorsize); again: found_bits = 0; @@ -2034,8 +2034,7 @@ again: if (entry->bitmap && entry->bytes > bytes + empty_size) { ret = btrfs_bitmap_cluster(block_group, entry, cluster, - offset, bytes + empty_size, - min_bytes); + offset, bytes, min_bytes); if (!ret) goto got_it; } @@ -2065,7 +2064,7 @@ again: while (1) { /* out window is just right, lets fill it */ - if (window_free >= bytes + empty_size) + if (window_free >= min_bytes) break; node = rb_next(&last->offset_index);