Re: structure dentry help...

Theodore Y. Ts'o (tytso@mit.edu)
Tue, 2 Nov 1999 16:37:03 -0500


Date: Tue, 2 Nov 1999 18:00:14 +0100
From: Jamie Lokier <lkd@tantalophile.demon.co.uk>

My long standing pet peeve is that there's no efficient way to ask "has
this directory / file changed since I last asked?".

Define "efficient". More efficient that fstat() and checing the mtime
field? That would be rather difficult, since by keeping the file
descriptor open, you'll be pinning the inode in memory.

Until d_type is implemented and I have a large, realistic ext2
filesystem with the TYPE feature enabled I can't give you data...

Last time I check, enabling the TYPE feature requires a change hack to
mke2fs, and you can't do it later (say in tune2fs). I do not have any
spare disks to try this on ATM.

In e2fsprogs 1.17, you can turn it on as follows:

tune2fs -O filetype /dev/XXX

... and then running e2fsck. The 1.17 e2fsck will populate the d_type
information if it's not set.

Of course, until the kernel is patched to provide a new readdir() system
call passes that information to userland, and glibc is updated to use
the new system call, it's not all that useful, but the support is there.

Note that once you turn on the filetype filesystem feature, the
filesystem will not be compatible with Linux 2.0 kernels! (I do have a
patch which will allow 2.0 kernel to support newer ext2 features;
contact me if you're interested). This is why the Linux 2.2 ext2fs
actually had d_type implemented (minus the user-space VFS interface),
but earler e2fsprogs didn't turn it on or have any support for it. The
original plan was to wait until Linux 2.4 to turn on d_type support.
(It's now a little bit late given the feature freeze, but maybe Linus
could be pursuaded to slip it in.)

- Ted

P.S. You can also turn off the filetype information by using the
command "tune2fs -O ^filetype", and then re-running e2fsck. This will
allow the filesystem to be mounted by an unpatched Linux 2.0 kernel.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/