linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: let getattr report the right blocks in delalloc+bigalloc.
@ 2012-01-31 15:58 Tao Ma
  2012-05-31 17:08 ` Eric Sandeen
  0 siblings, 1 reply; 4+ messages in thread
From: Tao Ma @ 2012-01-31 15:58 UTC (permalink / raw)
  To: linux-ext4; +Cc: sandeen, Theodore Ts'o

From: Tao Ma <boyu.mt@taobao.com>

In delayed allocation, i_reserved_data_blocks now indicates
clusters, not blocks. So report it in the right number.

This can be easily exposed by the following command:
echo foo > blah; du -hc blah; sync; du -hc blah

Cc: "Theodore Ts'o" <tytso@mit.edu>
Reported-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Tao Ma <boyu.mt@taobao.com>
---
 fs/ext4/inode.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index feaa82f..a5eb8c6 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4200,7 +4200,8 @@ int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry,
 	 * will return the blocks that include the delayed allocation
 	 * blocks for this file.
 	 */
-	delalloc_blocks = EXT4_I(inode)->i_reserved_data_blocks;
+	delalloc_blocks = EXT4_C2B(EXT4_SB(inode->i_sb),
+				EXT4_I(inode)->i_reserved_data_blocks);
 
 	stat->blocks += (delalloc_blocks << inode->i_sb->s_blocksize_bits)>>9;
 	return 0;
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ext4: let getattr report the right blocks in delalloc+bigalloc.
  2012-01-31 15:58 [PATCH] ext4: let getattr report the right blocks in delalloc+bigalloc Tao Ma
@ 2012-05-31 17:08 ` Eric Sandeen
  2012-06-01  0:43   ` Ted Ts'o
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Sandeen @ 2012-05-31 17:08 UTC (permalink / raw)
  To: Tao Ma; +Cc: linux-ext4, Theodore Ts'o

On 1/31/12 9:58 AM, Tao Ma wrote:
> From: Tao Ma <boyu.mt@taobao.com>
> 
> In delayed allocation, i_reserved_data_blocks now indicates
> clusters, not blocks. So report it in the right number.
> 
> This can be easily exposed by the following command:
> echo foo > blah; du -hc blah; sync; du -hc blah
> 
> Cc: "Theodore Ts'o" <tytso@mit.edu>
> Reported-by: Eric Sandeen <sandeen@redhat.com>
> Signed-off-by: Tao Ma <boyu.mt@taobao.com>

Reviewed-by: Eric Sandeen <sandeen2redhat.com>

It'd be great to get this one merged.

Thanks,
-Eric

> ---
>  fs/ext4/inode.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index feaa82f..a5eb8c6 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -4200,7 +4200,8 @@ int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry,
>  	 * will return the blocks that include the delayed allocation
>  	 * blocks for this file.
>  	 */
> -	delalloc_blocks = EXT4_I(inode)->i_reserved_data_blocks;
> +	delalloc_blocks = EXT4_C2B(EXT4_SB(inode->i_sb),
> +				EXT4_I(inode)->i_reserved_data_blocks);
>  
>  	stat->blocks += (delalloc_blocks << inode->i_sb->s_blocksize_bits)>>9;
>  	return 0;


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ext4: let getattr report the right blocks in delalloc+bigalloc.
  2012-05-31 17:08 ` Eric Sandeen
@ 2012-06-01  0:43   ` Ted Ts'o
  2012-06-01  3:52     ` Eric Sandeen
  0 siblings, 1 reply; 4+ messages in thread
From: Ted Ts'o @ 2012-06-01  0:43 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Tao Ma, linux-ext4

On Thu, May 31, 2012 at 12:08:50PM -0500, Eric Sandeen wrote:
> On 1/31/12 9:58 AM, Tao Ma wrote:
> > From: Tao Ma <boyu.mt@taobao.com>
> > 
> > In delayed allocation, i_reserved_data_blocks now indicates
> > clusters, not blocks. So report it in the right number.
> > 
> > This can be easily exposed by the following command:
> > echo foo > blah; du -hc blah; sync; du -hc blah
> > 
> > Cc: "Theodore Ts'o" <tytso@mit.edu>
> > Reported-by: Eric Sandeen <sandeen@redhat.com>
> > Signed-off-by: Tao Ma <boyu.mt@taobao.com>
> 
> Reviewed-by: Eric Sandeen <sandeen2redhat.com>
> 
> It'd be great to get this one merged.

I'll merge this, but delalloc and bigalloc is still pretty badly
busted.  But this will make stat return something that is closer to
being correct...

						- Ted

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ext4: let getattr report the right blocks in delalloc+bigalloc.
  2012-06-01  0:43   ` Ted Ts'o
@ 2012-06-01  3:52     ` Eric Sandeen
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Sandeen @ 2012-06-01  3:52 UTC (permalink / raw)
  To: Ted Ts'o; +Cc: Tao Ma, linux-ext4

On 5/31/12 7:43 PM, Ted Ts'o wrote:
> On Thu, May 31, 2012 at 12:08:50PM -0500, Eric Sandeen wrote:
>> On 1/31/12 9:58 AM, Tao Ma wrote:
>>> From: Tao Ma <boyu.mt@taobao.com>
>>>
>>> In delayed allocation, i_reserved_data_blocks now indicates
>>> clusters, not blocks. So report it in the right number.
>>>
>>> This can be easily exposed by the following command:
>>> echo foo > blah; du -hc blah; sync; du -hc blah
>>>
>>> Cc: "Theodore Ts'o" <tytso@mit.edu>
>>> Reported-by: Eric Sandeen <sandeen@redhat.com>
>>> Signed-off-by: Tao Ma <boyu.mt@taobao.com>
>>
>> Reviewed-by: Eric Sandeen <sandeen2redhat.com>
>>
>> It'd be great to get this one merged.
> 
> I'll merge this, but delalloc and bigalloc is still pretty badly
> busted.  But this will make stat return something that is closer to
> being correct...

Hm what else is busted?  Is there a testcase written?

How much else do you know of that's busted with bigalloc?  :)

(Is this bustedness the reason for not yet having it in the man page?)

-Eric
 
> 						- Ted


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-06-01  3:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-31 15:58 [PATCH] ext4: let getattr report the right blocks in delalloc+bigalloc Tao Ma
2012-05-31 17:08 ` Eric Sandeen
2012-06-01  0:43   ` Ted Ts'o
2012-06-01  3:52     ` Eric Sandeen

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).