Re: [PATCH 3/9] support >32 bit ext4 filesystem block type in kernel

Andrew Morton <[email protected]> Wed, 9 Aug 2006 23:40:33 -0700
Newsgroups gmane.comp.file-systems.ext2.devel,gmane.linux.file-systems,gmane.linux.kernel
Message-ID <[email protected]>
On Wed, 09 Aug 2006 18:21:00 -0700
Mingming Cao <[email protected]> wrote:

> 
> Redefine ext4 in-kernel filesystem block type (ext4_fsblk_t) from unsigned
> long to sector_t, to allow kernel to handle  >32 bit ext4 blocks.
> 

I don't get it.

Randomly-chosen snippet:

> @@ -274,7 +274,8 @@ static int find_group_orlov(struct super
>  	freei = percpu_counter_read_positive(&sbi->s_freeinodes_counter);
>  	avefreei = freei / ngroups;
>  	freeb = percpu_counter_read_positive(&sbi->s_freeblocks_counter);
> -	avefreeb = freeb / ngroups;
> +	avefreeb = freeb;
> +	sector_div(avefreeb, ngroups);
>  	ndirs = percpu_counter_read_positive(&sbi->s_dirs_counter);
>  
>  	if ((parent == sb->s_root->d_inode) ||

Here, `avefreeb' is still a 32-bit type.  Why feed it into sector_div()?

> @@ -303,13 +304,15 @@ static int find_group_orlov(struct super
>  		goto fallback;
>  	}
>  
> -	blocks_per_dir = (le32_to_cpu(es->s_blocks_count) - freeb) / ndirs;
> +	blocks_per_dir = le32_to_cpu(es->s_blocks_count) - freeb;
> +	sector_div(blocks_per_dir, ndirs);

And here le32_to_cpu() is very much a 32-bit type.  Why sector_div()?

And I agree with me: we want to get all the sector_t's out of this
filesystem.  unsigned long long, do_div()?


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642