All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext4: fix freespace accounting with mballoc on 32bit machines
@ 2007-10-25 20:08 Eric Sandeen
  0 siblings, 0 replies; only message in thread
From: Eric Sandeen @ 2007-10-25 20:08 UTC (permalink / raw)
  To: ext4 development; +Cc: Alex Tomas, Mingming Cao, Andrew Morton

On a 32bit machine, passing the negative unsigned long fe_len
into percpu_counter_add (which expects s64) messes up the counters:

[root@bear-05 linux-2.6.23-rc7]# df -h

Filesystem            Size  Used Avail Use% Mounted on
/dev/sdb7              97G -149P  149P   -  /mnt/test

Patch below fixes this.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>

--- linux.orig/fs/ext4/mballoc.c	2007-10-25 14:47:25.048435451 -0500
+++ linux/fs/ext4/mballoc.c	2007-10-25 14:47:35.815160682 -0500
@@ -3005,7 +3005,7 @@
 				- ac->ac_b_ex.fe_len);
 	gdp->bg_checksum = ext4_group_desc_csum(sbi, ac->ac_b_ex.fe_group, gdp);
 	spin_unlock(sb_bgl_lock(sbi, ac->ac_b_ex.fe_group));
-	percpu_counter_add(&sbi->s_freeblocks_counter, - ac->ac_b_ex.fe_len);
+	percpu_counter_sub(&sbi->s_freeblocks_counter, ac->ac_b_ex.fe_len);
 
 	err = ext4_journal_dirty_metadata(handle, bitmap_bh);
 	if (err)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-10-25 20:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-25 20:08 [PATCH] ext4: fix freespace accounting with mballoc on 32bit machines Eric Sandeen

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.