From: Wu Fengguang <fengguang.wu@intel.com>
To: Chris Mason <chris.mason@oracle.com>
Cc: linux-fsdevel@vger.kernel.org
Subject: btrfs: possible unit mismatch on the async_delalloc_pages limit
Date: Wed, 18 Nov 2009 16:51:32 +0800 [thread overview]
Message-ID: <20091118085132.GA9049@localhost> (raw)
Hi Chris,
I suspect the async_delalloc_pages limit checking in btrfs/inode.c
atomic_read(&root->fs_info->async_delalloc_pages) < 5 * 1042 * 1024
never evaluate to FALSE because 5M pages are 20GB which is super
large. I tried to fix it with the following patch. I increased the
limit a bit, however still worry that the "corrected" limit is too
small to create some regressions.
What do you think?
Thanks,
Fengguang
---
fs/btrfs/inode.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
--- linux.orig/fs/btrfs/inode.c 2009-11-07 19:28:07.000000000 +0800
+++ linux/fs/btrfs/inode.c 2009-11-07 19:28:08.000000000 +0800
@@ -50,6 +50,8 @@
#include "compression.h"
#include "locking.h"
+#define BTRFS_ASYNC_DELALLOC_PAGES_LIMIT (64 << (20-PAGE_CACHE_SHIFT))
+
struct btrfs_iget_args {
u64 ino;
struct btrfs_root *root;
@@ -856,7 +858,7 @@ static noinline void async_cow_submit(st
atomic_sub(nr_pages, &root->fs_info->async_delalloc_pages);
if (atomic_read(&root->fs_info->async_delalloc_pages) <
- 5 * 1042 * 1024 &&
+ BTRFS_ASYNC_DELALLOC_PAGES_LIMIT / 2 &&
waitqueue_active(&root->fs_info->async_submit_wait))
wake_up(&root->fs_info->async_submit_wait);
@@ -879,7 +881,6 @@ static int cow_file_range_async(struct i
struct btrfs_root *root = BTRFS_I(inode)->root;
unsigned long nr_pages;
u64 cur_end;
- int limit = 10 * 1024 * 1042;
clear_extent_bit(&BTRFS_I(inode)->io_tree, start, end, EXTENT_LOCKED,
1, 0, NULL, GFP_NOFS);
@@ -910,10 +911,11 @@ static int cow_file_range_async(struct i
btrfs_queue_worker(&root->fs_info->delalloc_workers,
&async_cow->work);
- if (atomic_read(&root->fs_info->async_delalloc_pages) > limit) {
+ if (atomic_read(&root->fs_info->async_delalloc_pages) >
+ BTRFS_ASYNC_DELALLOC_PAGES_LIMIT) {
wait_event(root->fs_info->async_submit_wait,
(atomic_read(&root->fs_info->async_delalloc_pages) <
- limit));
+ BTRFS_ASYNC_DELALLOC_PAGES_LIMIT));
}
while (atomic_read(&root->fs_info->async_submit_draining) &&
next reply other threads:[~2009-11-18 8:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-18 8:51 Wu Fengguang [this message]
2009-11-18 22:04 ` btrfs: possible unit mismatch on the async_delalloc_pages limit Chris Mason
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=20091118085132.GA9049@localhost \
--to=fengguang.wu@intel.com \
--cc=chris.mason@oracle.com \
--cc=linux-fsdevel@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).