From: Simon Kirby <sim@hostway.ca>
To: linux-btrfs <linux-btrfs@vger.kernel.org>
Cc: Josef Bacik <josef@redhat.com>
Subject: Re: Hot rb_next, setup_cluster_no_bitmap
Date: Wed, 3 Aug 2011 15:39:49 -0700 [thread overview]
Message-ID: <20110803223949.GA20056@hostway.ca> (raw)
In-Reply-To: <20110803220655.GE20966@hostway.ca>
[-- Attachment #1: Type: text/plain, Size: 345 bytes --]
On Wed, Aug 03, 2011 at 03:06:55PM -0700, Simon Kirby wrote:
> I see Josef's 86d4a77ba3dc4ace238a0556541a41df2bd71d49 introduced the
> bitmaps list. I could try temporarily reverting this (some fixups needed)
> if anybody thinks my cache bouncing idea might be slightly possible.
I'll try the attached and see how the profile changes.
Simon-
[-- Attachment #2: btrfs+setup_cluster_no_bitmap_no_bitmaps_list.patch --]
[-- Type: text/x-diff, Size: 3730 bytes --]
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 6377713..99582f9 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -2148,7 +2148,7 @@ again:
static noinline int
setup_cluster_no_bitmap(struct btrfs_block_group_cache *block_group,
struct btrfs_free_cluster *cluster,
- struct list_head *bitmaps, u64 offset, u64 bytes,
+ u64 offset, u64 bytes,
u64 min_bytes)
{
struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl;
@@ -2171,8 +2171,6 @@ setup_cluster_no_bitmap(struct btrfs_block_group_cache *block_group,
* extent entry.
*/
while (entry->bitmap) {
- if (list_empty(&entry->list))
- list_add_tail(&entry->list, bitmaps);
node = rb_next(&entry->offset_index);
if (!node)
return -ENOSPC;
@@ -2192,11 +2190,8 @@ setup_cluster_no_bitmap(struct btrfs_block_group_cache *block_group,
return -ENOSPC;
entry = rb_entry(node, struct btrfs_free_space, offset_index);
- if (entry->bitmap) {
- if (list_empty(&entry->list))
- list_add_tail(&entry->list, bitmaps);
+ if (entry->bitmap)
continue;
- }
/*
* we haven't filled the empty size and the window is
@@ -2252,7 +2247,7 @@ setup_cluster_no_bitmap(struct btrfs_block_group_cache *block_group,
static noinline int
setup_cluster_bitmap(struct btrfs_block_group_cache *block_group,
struct btrfs_free_cluster *cluster,
- struct list_head *bitmaps, u64 offset, u64 bytes,
+ u64 offset, u64 bytes,
u64 min_bytes)
{
struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl;
@@ -2263,39 +2258,10 @@ setup_cluster_bitmap(struct btrfs_block_group_cache *block_group,
if (ctl->total_bitmaps == 0)
return -ENOSPC;
- /*
- * First check our cached list of bitmaps and see if there is an entry
- * here that will work.
- */
- list_for_each_entry(entry, bitmaps, list) {
- if (entry->bytes < min_bytes)
- continue;
- ret = btrfs_bitmap_cluster(block_group, entry, cluster, offset,
- bytes, min_bytes);
- if (!ret)
- return 0;
- }
-
- /*
- * If we do have entries on our list and we are here then we didn't find
- * anything, so go ahead and get the next entry after the last entry in
- * this list and start the search from there.
- */
- if (!list_empty(bitmaps)) {
- entry = list_entry(bitmaps->prev, struct btrfs_free_space,
- list);
- node = rb_next(&entry->offset_index);
- if (!node)
- return -ENOSPC;
- entry = rb_entry(node, struct btrfs_free_space, offset_index);
- goto search;
- }
-
entry = tree_search_offset(ctl, offset_to_bitmap(ctl, offset), 0, 1);
if (!entry)
return -ENOSPC;
-search:
node = &entry->offset_index;
do {
entry = rb_entry(node, struct btrfs_free_space, offset_index);
@@ -2326,8 +2292,6 @@ int btrfs_find_space_cluster(struct btrfs_trans_handle *trans,
u64 offset, u64 bytes, u64 empty_size)
{
struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl;
- struct list_head bitmaps;
- struct btrfs_free_space *entry, *tmp;
u64 min_bytes;
int ret;
@@ -2366,17 +2330,12 @@ int btrfs_find_space_cluster(struct btrfs_trans_handle *trans,
goto out;
}
- INIT_LIST_HEAD(&bitmaps);
- ret = setup_cluster_no_bitmap(block_group, cluster, &bitmaps, offset,
+ ret = setup_cluster_no_bitmap(block_group, cluster, offset,
bytes, min_bytes);
if (ret)
- ret = setup_cluster_bitmap(block_group, cluster, &bitmaps,
+ ret = setup_cluster_bitmap(block_group, cluster,
offset, bytes, min_bytes);
- /* Clear our temporary list */
- list_for_each_entry_safe(entry, tmp, &bitmaps, list)
- list_del_init(&entry->list);
-
if (!ret) {
atomic_inc(&block_group->count);
list_add_tail(&cluster->block_group_list,
next prev parent reply other threads:[~2011-08-03 22:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-03 22:06 Hot rb_next, setup_cluster_no_bitmap Simon Kirby
2011-08-03 22:39 ` Simon Kirby [this message]
2011-08-03 23:10 ` Simon Kirby
2011-08-04 1:13 ` Chris Mason
2011-08-04 1:32 ` Simon Kirby
2011-08-04 14:04 ` Chris Mason
2011-08-04 17:28 ` Simon Kirby
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110803223949.GA20056@hostway.ca \
--to=sim@hostway.ca \
--cc=josef@redhat.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.