2007-08-03 02:22:33

by Yan Zheng

[permalink] [raw]
Subject: How to insure ext4_alloc_blocks always returns blocks below 0xffffffff when using indirect index.

Hi all.

Druing reading the source codes of indirect index, there is a doubt
in my mind. When using indirect index, physical block number must not
exceed 0xffffffff, but I cann' t find any clue about how
ext4_alloc_blocks insure that. Codes that check 64bit_feature is only
in ext4_fill_super and they do nothing affects block allocation
algorithm. Maybe ext4_alloc_blocks should check whether inode has
EXT4_EXTENTS_FL flags and only search block groups that have blocks
below 0xffffffff when not.

The source codes I read is 2.6.22.

Thanks in advance.
YZ


2007-08-03 18:09:17

by Andreas Dilger

[permalink] [raw]
Subject: Re: How to insure ext4_alloc_blocks always returns blocks below 0xffffffff when using indirect index.

On Aug 03, 2007 10:22 +0800, Yan Zheng wrote:
> Druing reading the source codes of indirect index, there is a doubt
> in my mind. When using indirect index, physical block number must not
> exceed 0xffffffff, but I cann' t find any clue about how
> ext4_alloc_blocks insure that. Codes that check 64bit_feature is only
> in ext4_fill_super and they do nothing affects block allocation
> algorithm. Maybe ext4_alloc_blocks should check whether inode has
> EXT4_EXTENTS_FL flags and only search block groups that have blocks
> below 0xffffffff when not.
>
> The source codes I read is 2.6.22.

Good question. It is intended that extents be used for filesystems
larger than 2^32 blocks, but there is no guarantee that existing
block-mapped files will not still exist.

I think the check you propose makes sense. The code should return
EFBIG or maybe EOVERFLOW in this case (not ENOSPC I think).

Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.