(updated) ext2 directories in pagecache
This patch updates ext2_getblk and ext2_bread to use the ERR_PTR style of error return. As Al Viro pointed out, this is a better way of doing things for a function returning a pointer. This approach would have prevented the bug I fixed with the previous patch. 20 20 hindsight, and I can only plead that I was following the interface of the old ext2_getblk. But since these functions are only used only by the ext2 directory code - which in turn is the only part of ext2 that is interested in file data - there was no problem changing the interface.
The patch is at:
http://nl.linux.org/~phillips/htree/dx.pcache-2.4.4-4
This is lightly tested and apparently stable. I wish I could say the same for kernel 2.4.4 - cache performance sucks horribly. (Nontechnical evaluation.) So it is probably not a good idea to take benchmarks too seriously this month. The previous stable kernels, 2.4.2 and 2.4.3, had their problems too, fixable via patching. Maybe next month...
This patch requires Al Viro's directory-in-page-cache patch to be applied first, available from:
ftp://ftp.math.psu.edu/pub/viro/ext2-dir-patch-S4.gz
The other flavor of indexing patch, dx.testme..., also does directory-in-page-cache, using the good old ext2 directory code. This works fine and is stable, but IMHO Al's patches constitute a pretty major cleanup.
To apply:
cd source/tree
zcat ext2-dir-patch-S4.gz | patch -p1
cat dx.pcache-2.4.4-4 | patch -p0
To create an indexed directory:
mount /dev/hdxxx /test -o index
mkdir /test/foo
--
Daniel
Daniel writes [re index directories]:
Quoted 1 line
This is lightly tested and apparently stable.
I was looking at the new patch, and I saw something that puzzles me. Why do you set the EXT2_INDEX_FL on a new (empty) directory, rather than only setting it when the dx_root index is created?
Setting the flag earlier than that makes it mostly useless, since it will be set on basically every directory. Not setting it would also make your is_dx() check simply a check for the EXT2_INDEX_FL bit (no need to also check size).
Also no need to set EXT2_COMPAT_DIR_INDEX until such a time that we have a (real) directory with an index, to avoid gratuitous incompatibility with e2fsck.
Cheers, Andreas
Signature · 3 lines
Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto,
\ would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/ -- DogbertQuoted 6 lines · you
Daniel writes [re index directories]:
Quoted 1 line
This is lightly tested and apparently stable.
I was looking at the new patch, and I saw something that puzzles me. Why do you set the
EXT2_INDEX_FLon a new (empty) directory, rather than only setting it when thedx_rootindex is created?
This makes it follow the rule: new directories will be created with an index. (Never mind that the index creation is deferred.) Now, if you think it's ok to add an index to any directory that grows past one block that's fine with me. I was looking for a little more predictable behavriour.
A couple of lines of code will go away and the is_dx(dir) tests will get a little faster if we just use 'dir grew past a block' as the rule.
Quoted 4 lines
Setting the flag earlier than that makes it mostly useless, since it will be set on basically every directory. Not setting it would also make your
is_dx()check simply a check for theEXT2_INDEX_FLbit (no need to also check size).
Yep.
Quoted 5 lines
Also no need to set
EXT2_COMPAT_DIR_INDEXuntil such a time that we have a (real) directory with an index, to avoid gratuitous incompatibility with e2fsck.Cheers, Andreas
Again yep, you decide, I will fix, or I see a few posts down you have changed the patch, also fine.
--
Daniel