* [PATCH 2/4]percpu_counter: use correct API
@ 2011-04-12 8:04 Shaohua Li
2011-04-12 18:52 ` Tejun Heo
0 siblings, 1 reply; 2+ messages in thread
From: Shaohua Li @ 2011-04-12 8:04 UTC (permalink / raw)
To: lkml; +Cc: Andrew Morton, cl, tj
percpu_counter_sum_positive never returns negative, since there
is a negative check, I changed it to percpu_counter_sum.
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
---
fs/ext4/balloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux/fs/ext4/balloc.c
===================================================================
--- linux.orig/fs/ext4/balloc.c 2011-04-12 15:48:42.000000000 +0800
+++ linux/fs/ext4/balloc.c 2011-04-12 15:48:50.000000000 +0800
@@ -506,7 +506,7 @@ static int ext4_has_free_blocks(struct e
if (free_blocks - (nblocks + root_blocks + dirty_blocks) <
EXT4_FREEBLOCKS_WATERMARK) {
free_blocks = percpu_counter_sum_positive(fbc);
- dirty_blocks = percpu_counter_sum_positive(dbc);
+ dirty_blocks = percpu_counter_sum(dbc);
if (dirty_blocks < 0) {
printk(KERN_CRIT "Dirty block accounting "
"went wrong %lld\n",
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 2/4]percpu_counter: use correct API
2011-04-12 8:04 [PATCH 2/4]percpu_counter: use correct API Shaohua Li
@ 2011-04-12 18:52 ` Tejun Heo
0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2011-04-12 18:52 UTC (permalink / raw)
To: Shaohua Li; +Cc: lkml, Andrew Morton, cl
On Tue, Apr 12, 2011 at 04:04:01PM +0800, Shaohua Li wrote:
> percpu_counter_sum_positive never returns negative, since there
> is a negative check, I changed it to percpu_counter_sum.
>
> Signed-off-by: Shaohua Li <shaohua.li@intel.com>
>
> ---
> fs/ext4/balloc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: linux/fs/ext4/balloc.c
> ===================================================================
> --- linux.orig/fs/ext4/balloc.c 2011-04-12 15:48:42.000000000 +0800
> +++ linux/fs/ext4/balloc.c 2011-04-12 15:48:50.000000000 +0800
> @@ -506,7 +506,7 @@ static int ext4_has_free_blocks(struct e
> if (free_blocks - (nblocks + root_blocks + dirty_blocks) <
> EXT4_FREEBLOCKS_WATERMARK) {
> free_blocks = percpu_counter_sum_positive(fbc);
> - dirty_blocks = percpu_counter_sum_positive(dbc);
> + dirty_blocks = percpu_counter_sum(dbc);
> if (dirty_blocks < 0) {
> printk(KERN_CRIT "Dirty block accounting "
> "went wrong %lld\n",
The right thing to do would be removing if (dirty_blocks < 0) and keep
using _positive. perpcu_counter_sum() may return a negative number
spuriously (that's the whole point of _positive functions) and may
trigger the critial error path when nothing is really wrong.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-04-12 18:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-12 8:04 [PATCH 2/4]percpu_counter: use correct API Shaohua Li
2011-04-12 18:52 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®