e2find: new ext2/3/4 tool for fast directory entry iterations

Bodo Thiesen bothie at gmx.de
Sun Aug 21 11:31:12 UTC 2016

* Vincent Caron <vcaron at bearstech.com> hat geschrieben:

> Since I'm in userland and not locking
> any on-disk data structure I'm reading, I wonder what kind of suprises I
> should expect in the retrieved data.

Exactly that kind of surprises, you're expecting anyways: Old data
where committed data exist that has not been written to it's
target location yet or data, that has been overwritten in mean time. Since
there is almost no restriction on the "wrong" data (could be mp3, could be
part of a ext2 image file looking exactly like the data you're expecting
to see - no way to know for sure) you can see *anything*.

For an ext2 fs with journal, you could try interpreting the journal and
fixup your cache to bring it up to date like this:

1. Get a copy of the journal
2. Read the blocks you're interested in (i.e. do the normal traversing
	-> from time to time, get a new copy of the journal, check what
	changed, process the changes. This also means, you need to keep
	some meta data about when and where you got your data from, so you
	can actually fixup stuff. Remember: While traversing, you can read
	any kind of trash.
3. Upon completion of 2. get a final copy of the journal to bring
   your cache up-to-date.

The funny thing about this aproach: By repeating step 3 you could keep
your cache up to date without any need of retraversing the file system at
any time again as long as your check interval is short enough so you don't
miss any journal updates.

I leave the details to you're implementation skills, since I don't know
what your strategies in e2find are.

Regards, Bodo

More information about the Ext3-users mailing list