Hello,

> I am looking at ext4_max_size and was confused how the
> number upper_limit = 0x1ff7fffd000LL is arrived. 
> The comment says the value is arrived looking at 4K.
> So i tried the below program. 
> 
> main()
> {
>       unsigned long long upper_limit, meta_blocks;
>       int bits = 12;
> 
>       /* total blocks in 512 bytes */
>       upper_limit = (1LL << 32) - 1;
>       /* total blocks in file system block size */
>       upper_limit >>= (bits - 9);
> 
> 
>       meta_blocks = 1;
>       /* double indirect blocks */
>       meta_blocks += 1 + 1LL << (bits-2);
>       /* tripple indirect blocks */
>       meta_blocks += 1 + 1LL << (bits-2) + 1LL << (2*(bits-2));
> 
>       upper_limit -= meta_blocks;
>       upper_limit <<= bits;
> 
>       printf("%x\n", upper_limit);
> }
> 
> Can somebody help me to find out what is missing in the above ?
  You actually overestimate the number of triply indirect blocks in your
program above (you count all possible but since the limit is around 2TB
only roughly half of them is really needed).

> I also think hardcoding 4k block size is not correct. I have the below
> patch pending with large file size.
  It is incorrect for blocksize larger than 4096, that's right. Your
patch looks fine - we loose a bit of filesize limit but I don't think it
really matters.

                                                                Honza
-
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to