From: Robin Dong <hao.bigrat@gmail.com>
To: linux-ext4@vger.kernel.org
Cc: Robin Dong <sanbai@taobao.com>, "Theodore Ts'o" <tytso@mit.edu>
Subject: [PATCH] ext4: s_dirtyclusters_counter should tranform to unit of cluster before assigning to "dirty_clusters" in ext4_has_free_clusters()
Date: Wed, 1 Feb 2012 11:17:50 +0800 [thread overview]
Message-ID: <1328066270-4461-1-git-send-email-hao.bigrat@gmail.com> (raw)
From: Robin Dong <sanbai@taobao.com>
Creating 4-byte files until ENOSPC in a delay-allocation and bigalloc ext4 fs and then sync it, the dmseg will report like:
[ 482.154538] EXT4-fs (sdb6): delayed block allocation failed for inode 1664 at logical offset 0 with max blocks 1 with error -28
[ 482.154540] EXT4-fs (sdb6): This should not happen!! Data will be lost
The reason is ext4_has_free_clusters reporting wrong result. Actually, the unit of sbi->s_dirtyclusters_counter is block, so we should tranform it to cluster for argument "dirty_clusters", just like "free_clusters".
Cc: "Theodore Ts'o" <tytso@mit.edu>
Reported-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Robin Dong <sanbai@taobao.com>
---
fs/ext4/balloc.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index f9e2cd8..8ff10c4 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -427,7 +427,7 @@ static int ext4_has_free_clusters(struct ext4_sb_info *sbi,
if (free_clusters - (nclusters + root_clusters + dirty_clusters) <
EXT4_FREECLUSTERS_WATERMARK) {
free_clusters = EXT4_C2B(sbi, percpu_counter_sum_positive(fcc));
- dirty_clusters = percpu_counter_sum_positive(dcc);
+ dirty_clusters = EXT4_C2B(sbi, percpu_counter_sum_positive(dcc));
}
/* Check whether we have space after accounting for current
* dirty clusters & root reserved clusters.
--
1.7.4.1
next reply other threads:[~2012-02-01 3:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-01 3:17 Robin Dong [this message]
2012-02-02 7:48 ` [PATCH] ext4: s_dirtyclusters_counter should tranform to unit of cluster before assigning to "dirty_clusters" in ext4_has_free_clusters() Robin Dong
2012-02-10 2:55 ` Ted Ts'o
2012-02-14 8:01 ` Robin Dong
2012-02-14 21:24 ` Aditya Kali
2012-02-15 3:19 ` Robin Dong
2012-02-16 20:12 ` Aditya Kali
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=1328066270-4461-1-git-send-email-hao.bigrat@gmail.com \
--to=hao.bigrat@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=sanbai@taobao.com \
--cc=tytso@mit.edu \
/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).