Re: [PATCH] ext4: fix suboptimal seek_{data,hole} extents traversial

From: Dmitry Monakhov
Date: Mon Dec 01 2014 - 06:26:19 EST

Theodore Ts'o <tytso@xxxxxxx> writes:

> On Fri, Nov 28, 2014 at 06:02:02PM +0300, Dmitry Monakhov wrote:
>> FYI: inline_data feature is fatally broken
> Thanks for finding the bugs!
>> 2) ext4_inline_data_fiemap(0 ignores start and len arguments from ext4_filemap()
>> which obviously result in endless loop for anyone who want to use
>> fiemap for inline files (which my patch try to do)
> Would this have been triggered using filefrag? I just checked and
> noticed we don't have a filefrag test in xfstests; of course it would
> be impossible to test other than the filefrag -v command successfully
> completed, but maybe it might be worth adding such a test.
This works only because filefrag use big buffer. If one want to call
fiemap with start != 0 it will loop. So we definitely need a regression
test for fiemap. I'll do it.

BTW bug can be spotted even in case of filefrag -v:
#### Create small file with inlined data
# echo test > /mnt/f1
#### Now boost it's i_size
# truncate --size 4096000 /mnt/f1
# filefrag -v /mnt/f1
Filesystem cylinder groups approximately 39
File size of /mnt/f1 is 4096000 (1000 blocks of 4096 bytes)
ext: logical_offset: physical_offset: length: expected:
0: 0.. 4095999: 2762792.. 6858791: 4096000:last,not_aligned,inline,eof
/mnt/f1: 1 extent found
###According to fiemap we are inlined 4Mb data. :)

At this moment I'm testing my patches, I'll send it today.
> - Ted

Attachment: signature.asc
Description: PGP signature