Re: [RFC] [PATCH 3/3] Recursive mtime for ext3

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jan Kara
Date: Thursday, November 8, 2007 - 3:56 am

On Wed 07-11-07 19:20:38, Theodore Tso wrote:
  Yes, that's actually what I'm doing - sorry if I didn't make it clear
earlier.

  Exactly.

  I already gave some thought to this but there seemed to be some
drawbacks. Query I want to support is: given a directory, tell me which of
its subdirectories (arbitrarily deep below) have been modified since time
T.  That is what you need to support faster rsync, updatedb and similar
loads.  Also I want to allow a reboot to happen inbetween the modification
and a query (handling a crash correctly would be nice too but honestly my
current implementation is not completely reliable in this regard either) so
some pernament storage is needed in any case. What I can imagine we could
do is to report all modifications to userspace - that has a problem that
there are *many* possible modifications but we are interested only whether
there happened some since time T. We could improve this by an in-memory
inode flag "I'm not interested in modifications any further" and reporting
the change only if the parent directory does not have this flag set (note
that this flag gets lost when we evict the inode from memory). But I would
say that in the end all this message passing, climbing the tree from
userspace and maintaining data structure in memory and on disk would cost
use more than the current implementation... Also it has the disadvantage
that we miss the modifications which happen before we start the userspace
daemon catching the events.
  Doing this in kernel memory has a problem how to solve the persistency
across reboots (dumping mod's to userspace on request?) and also on my
system you'd have roughly a few MB of pinned memory for these purposes...
Plausible but I don't really like it...

  Yes, that is the advantage. On the other hand we could allow setting that
particular flag even without being an owner of the inode. In fact, I
don't currently see use case where you won't be either root (rsync,
updatedb) or an owner of the files (watching config file trees) but I guess
people would find some :).

  Yes, here the impact is hardly measurable as I've written in the previous
email.

  As I wrote above, the flag is only set on directories so yes a scan
modifies 2k directory inodes. But such scan happens only when you run rsync
- I don't aim at something like 'trackerd' which would watch the filesystem
all the time. My idea is that those applications that currently do "scan
the tree, stat all files, check mtimes if something changed" would in
future do "scan those directories that have rtime newer than T". So the
overall balance is:
  Currently: scan and stat all files in the tree, compare mtimes
  With rtime: scan those directories in whose subtree has something changed
- stat all files in them, modify directory inodes

So you trade a lot of reading for some writes... I can actually try to measure
how much it will improve rsync scan on my computer :)

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC] [PATCH 0/3] Recursive mtime for ext3, Jan Kara, (Tue Nov 6, 10:15 am)
[RFC] [PATCH 1/3] Recursive mtime for ext3, Jan Kara, (Tue Nov 6, 10:18 am)
[RFC] [PATCH 2/3] Recursive mtime for ext3, Jan Kara, (Tue Nov 6, 10:19 am)
[RFC] [PATCH 3/3] Recursive mtime for ext3, Jan Kara, (Tue Nov 6, 10:19 am)
Re: [RFC] [PATCH 3/3] Recursive mtime for ext3, Arjan van de Ven, (Tue Nov 6, 10:40 am)
Re: [RFC] [PATCH 3/3] Recursive mtime for ext3, Al Viro, (Tue Nov 6, 11:01 am)
Re: [RFC] [PATCH 3/3] Recursive mtime for ext3, H. Peter Anvin, (Tue Nov 6, 11:04 am)
Re: [RFC] [PATCH 3/3] Recursive mtime for ext3, Theodore Tso, (Tue Nov 6, 12:40 pm)
Re: [RFC] [PATCH 3/3] Recursive mtime for ext3, Jan Kara, (Wed Nov 7, 4:51 am)
Re: [RFC] [PATCH 3/3] Recursive mtime for ext3, Jan Kara, (Wed Nov 7, 7:36 am)
Re: [RFC] [PATCH 3/3] Recursive mtime for ext3, Jan Kara, (Wed Nov 7, 7:54 am)
Re: [RFC] [PATCH 3/3] Recursive mtime for ext3, Theodore Tso, (Wed Nov 7, 5:20 pm)
Re: [RFC] [PATCH 3/3] Recursive mtime for ext3, Jan Kara, (Thu Nov 8, 3:56 am)
Re: [RFC] [PATCH 3/3] Recursive mtime for ext3, Theodore Tso, (Thu Nov 8, 7:37 am)
Re: [RFC] [PATCH 3/3] Recursive mtime for ext3, Jan Kara, (Thu Nov 8, 8:28 am)