From: Josef Bacik <josef@redhat.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 4/4] Btrfs: try not to sleep as much when doing slow caching
Date: Wed, 11 May 2011 17:35:55 -0400 [thread overview]
Message-ID: <1305149755-4413-4-git-send-email-josef@redhat.com> (raw)
In-Reply-To: <1305149755-4413-1-git-send-email-josef@redhat.com>
When the fs is super full and we unmount the fs, we could get stuck in this
thing where unmount is waiting for the caching kthread to make progress and the
caching kthread keeps scheduling because we're in the middle of a commit. So
instead just let the caching kthread keep going and only yeild if
need_resched(). This makes my horrible umount case go from taking up to 10
minutes to taking less than 20 seconds. Thanks,
Signed-off-by: Josef Bacik <josef@redhat.com>
---
fs/btrfs/extent-tree.c | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 0d24414..edc1880 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -359,15 +359,18 @@ again:
if (ret)
break;
- caching_ctl->progress = last;
- btrfs_release_path(extent_root, path);
- up_read(&fs_info->extent_commit_sem);
- mutex_unlock(&caching_ctl->mutex);
- if (btrfs_transaction_in_commit(fs_info))
- schedule_timeout(1);
- else
+ if (need_resched() ||
+ btrfs_next_leaf(extent_root, path)) {
+ caching_ctl->progress = last;
+ btrfs_release_path(extent_root, path);
+ up_read(&fs_info->extent_commit_sem);
+ mutex_unlock(&caching_ctl->mutex);
cond_resched();
- goto again;
+ goto again;
+ }
+ leaf = path->nodes[0];
+ nritems = btrfs_header_nritems(leaf);
+ continue;
}
if (key.objectid < block_group->key.objectid) {
--
1.7.2.3
next prev parent reply other threads:[~2011-05-11 21:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-11 21:35 [PATCH 1/4] Btrfs: map the node block when looking for readahead targets Josef Bacik
2011-05-11 21:35 ` [PATCH 2/4] Btrfs: don't look at the extent buffer level 3 times in a row Josef Bacik
2011-05-12 15:42 ` David Sterba
2011-05-12 19:36 ` Josef Bacik
2011-05-11 21:35 ` [PATCH 3/4] Btrfs: kill BTRFS_I(inode)->block_group Josef Bacik
2011-05-11 21:35 ` Josef Bacik [this message]
2011-06-08 8:21 ` [PATCH 1/4] Btrfs: map the node block when looking for readahead targets Arne Jansen
2011-06-08 13:51 ` Josef Bacik
2011-06-08 14:24 ` Arne Jansen
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=1305149755-4413-4-git-send-email-josef@redhat.com \
--to=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).