* [PATCH] ext4: fix overhead calculations in ext4_stats, again
@ 2012-10-25 16:59 Eric Sandeen
2012-10-25 17:14 ` [PATCH] ext4: fix overhead calculations in ext4_statfs, again Eric Sandeen
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Eric Sandeen @ 2012-10-25 16:59 UTC (permalink / raw)
To: ext4 development
"overhead" was a write-only variable in this function after commit
952fc18e; we set it to 0 for minixdf, or to sbi->s_overhead if !minixdf,
but never read it again after that.
We need to use it, not sbi->s_overhead, when subtracting out overhead
for f_blocks, or we get the wrong answer for minixdf.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
"Once more, with feeling!" ;)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index e44b233..2feaf78 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4758,7 +4758,7 @@ static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf)
buf->f_type = EXT4_SUPER_MAGIC;
buf->f_bsize = sb->s_blocksize;
- buf->f_blocks = ext4_blocks_count(es) - EXT4_C2B(sbi, sbi->s_overhead);
+ buf->f_blocks = ext4_blocks_count(es) - EXT4_C2B(sbi, overhead);
bfree = percpu_counter_sum_positive(&sbi->s_freeclusters_counter) -
percpu_counter_sum_positive(&sbi->s_dirtyclusters_counter);
/* prevent underflow in case that few free space is available */
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: fix overhead calculations in ext4_statfs, again
2012-10-25 16:59 [PATCH] ext4: fix overhead calculations in ext4_stats, again Eric Sandeen
@ 2012-10-25 17:14 ` Eric Sandeen
2012-10-29 17:13 ` [PATCH] ext4: fix overhead calculations in ext4_stats, again Jan Kara
2012-11-08 15:34 ` Theodore Ts'o
2 siblings, 0 replies; 4+ messages in thread
From: Eric Sandeen @ 2012-10-25 17:14 UTC (permalink / raw)
To: ext4 development
sorry that should be "ext4_statfs" in the subject.
On 10/25/12 11:59 AM, Eric Sandeen wrote:
> "overhead" was a write-only variable in this function after commit
> 952fc18e; we set it to 0 for minixdf, or to sbi->s_overhead if !minixdf,
> but never read it again after that.
>
> We need to use it, not sbi->s_overhead, when subtracting out overhead
> for f_blocks, or we get the wrong answer for minixdf.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
> "Once more, with feeling!" ;)
>
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index e44b233..2feaf78 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -4758,7 +4758,7 @@ static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf)
>
> buf->f_type = EXT4_SUPER_MAGIC;
> buf->f_bsize = sb->s_blocksize;
> - buf->f_blocks = ext4_blocks_count(es) - EXT4_C2B(sbi, sbi->s_overhead);
> + buf->f_blocks = ext4_blocks_count(es) - EXT4_C2B(sbi, overhead);
> bfree = percpu_counter_sum_positive(&sbi->s_freeclusters_counter) -
> percpu_counter_sum_positive(&sbi->s_dirtyclusters_counter);
> /* prevent underflow in case that few free space is available */
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: fix overhead calculations in ext4_stats, again
2012-10-25 16:59 [PATCH] ext4: fix overhead calculations in ext4_stats, again Eric Sandeen
2012-10-25 17:14 ` [PATCH] ext4: fix overhead calculations in ext4_statfs, again Eric Sandeen
@ 2012-10-29 17:13 ` Jan Kara
2012-11-08 15:34 ` Theodore Ts'o
2 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2012-10-29 17:13 UTC (permalink / raw)
To: Eric Sandeen; +Cc: ext4 development
On Thu 25-10-12 11:59:02, Eric Sandeen wrote:
> "overhead" was a write-only variable in this function after commit
> 952fc18e; we set it to 0 for minixdf, or to sbi->s_overhead if !minixdf,
> but never read it again after that.
>
> We need to use it, not sbi->s_overhead, when subtracting out overhead
> for f_blocks, or we get the wrong answer for minixdf.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Yeah, looks good. You can add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
>
> "Once more, with feeling!" ;)
>
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index e44b233..2feaf78 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -4758,7 +4758,7 @@ static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf)
>
> buf->f_type = EXT4_SUPER_MAGIC;
> buf->f_bsize = sb->s_blocksize;
> - buf->f_blocks = ext4_blocks_count(es) - EXT4_C2B(sbi, sbi->s_overhead);
> + buf->f_blocks = ext4_blocks_count(es) - EXT4_C2B(sbi, overhead);
> bfree = percpu_counter_sum_positive(&sbi->s_freeclusters_counter) -
> percpu_counter_sum_positive(&sbi->s_dirtyclusters_counter);
> /* prevent underflow in case that few free space is available */
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: fix overhead calculations in ext4_stats, again
2012-10-25 16:59 [PATCH] ext4: fix overhead calculations in ext4_stats, again Eric Sandeen
2012-10-25 17:14 ` [PATCH] ext4: fix overhead calculations in ext4_statfs, again Eric Sandeen
2012-10-29 17:13 ` [PATCH] ext4: fix overhead calculations in ext4_stats, again Jan Kara
@ 2012-11-08 15:34 ` Theodore Ts'o
2 siblings, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2012-11-08 15:34 UTC (permalink / raw)
To: Eric Sandeen; +Cc: ext4 development
On Thu, Oct 25, 2012 at 11:59:02AM -0500, Eric Sandeen wrote:
> "overhead" was a write-only variable in this function after commit
> 952fc18e; we set it to 0 for minixdf, or to sbi->s_overhead if !minixdf,
> but never read it again after that.
>
> We need to use it, not sbi->s_overhead, when subtracting out overhead
> for f_blocks, or we get the wrong answer for minixdf.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Thanks, applied.
- Ted
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-11-08 22:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-25 16:59 [PATCH] ext4: fix overhead calculations in ext4_stats, again Eric Sandeen
2012-10-25 17:14 ` [PATCH] ext4: fix overhead calculations in ext4_statfs, again Eric Sandeen
2012-10-29 17:13 ` [PATCH] ext4: fix overhead calculations in ext4_stats, again Jan Kara
2012-11-08 15:34 ` Theodore Ts'o
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).