public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexander Larsson <alexl@redhat.com>
To: Jan Kara <jack@suse.cz>
Cc: eparis@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: Issues with using fanotify for a filesystem indexer
Date: Thu, 02 Apr 2009 18:29:04 +0200	[thread overview]
Message-ID: <1238689744.5704.1.camel@localhost.localdomain> (raw)
In-Reply-To: <20090402145457.GA17275@atrey.karlin.mff.cuni.cz>

On Thu, 2009-04-02 at 16:54 +0200, Jan Kara wrote:

>   Some time ago I was trying to solve a similar problem and I've come up
> with a solution which I've called recursive mtime. The general idea is
> that with each directory, kernel additionally keeps a flag and a
> timestamp. When a directory is modified, we do:
>   dir = changed dir;
>   while dir has flag set do
>     update timestamp to current time
>     clear flag
>     dir = parent dir
> 
>   When a file is modified, you just start with a parent directory of
> that file. With this scheme, you are able to find reasonably quickly
> (without looking at unchanged directories) what has changed since
> you've looked last time (you look for timestamps newer than the time
> when you started last scan and you set flags as you go). Also the scheme
> is quite cheap to maintain and has no problems with overflowing event
> queues etc. (observe that the scheme works perfectly fine for several
> independent scanners in parallel). As a bonus, if you store the flag +
> timestamp persistently on disk, you can use this scheme to speedup things
> like rsync.
>   What gets nasty (but solvable) are hardlinks and bind mounts. I was
> writing a library to handle these last summer but then had to work on
> something else and didn't get back to it yet.

Another potential issue with this is that every change bubbles up to the
top, modifying the recursive mtime of that. This will become very
contented, and may imply a partial serialization of fs activity, which
is kinda costly.


  reply	other threads:[~2009-04-02 16:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-27 12:47 Issues with using fanotify for a filesystem indexer Alexander Larsson
2009-03-27 13:02 ` Al Viro
2009-03-27 13:47   ` Alexander Larsson
2009-03-28 20:38   ` Alexander Larsson
2009-04-02 14:54 ` Jan Kara
2009-04-02 16:29   ` Alexander Larsson [this message]
2009-04-02 16:50     ` Jan Kara
2009-04-02 17:15       ` Alexander Larsson
2009-04-02 19:52         ` Jan Kara
2009-04-03  6:44           ` Alexander Larsson
2009-04-03  9:33             ` Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1238689744.5704.1.camel@localhost.localdomain \
    --to=alexl@redhat.com \
    --cc=eparis@redhat.com \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox