On Tue, Jan 02, 2007 at 12:25:21PM +0300, Alex Tomas (AT) wrote: > >>>>> Amit K Arora (AKA) writes: > > AKA> The ext4_ext_get_blocks() and ext4_ext_insert_extent() routines do not > AKA> check for extent overlap, when a new extent needs to be inserted in an > AKA> inode. An overlap is possible when the new extent being inserted has > AKA> ee_block that is not part of any of the existing extents, but the > AKA> tail/center portion of this new extent _is_. This is possible only when > AKA> we are writing/preallocating blocks across a hole. > > AT> not sure I understand ... you shouldn't insert an extent that overlap > AT> any existing extent. when you write block(s), you first check is > AT> it already allocated and insert new extent only if it's not. You are right. That is what this patch does. The current ext4 code is inserting an overlapped extent in a particular scenario (explained above). The suggested patch fixes this by having a check in get_blocks() for _not_ inserting an extent that may overlap with an existing one. > AT> for preallocated block(s), you should adapt existing extent(s) so that > AT> they don't overlap new extent you're inserting. am I missing something? The patch makes the new extent being inserted adjust its length based on any existing extent that may overlap, so that the overlap does not happen at all. > AT> also, I think that modification of existing extent(s) (not merging) > AT> isn't safe. The existing extent(s) are not being modified in any way here. We check if there is an overlap between the new extent being inserted by get_blocks(), with an existing one. If there is, we update the new extent (being inserted) accordingly. The existing extent is not touched (unless the insert_extent() does a merge, if possible). Please let me know if the intentions are still not clear here. Thanks! Regards, Amit Arora - To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html