- When we drop an exclude pattern, we need to recrawl the entire FS tree to pick up those files that we previously ignored - DirectoryPrivate.SetAllToUnknown_Unlocked needs to consider the situation where there are no children - When examining directory children, if ScanOne_Unlocked finds that we already know about the child, it should check the state of the child to see if it needs a scan anyway. - FSM.SetAllToUnknown should fire off a scan request so that everything gets rescanned/recrawled The end result of this is that FSM.SetAllToUnknown now does the right thing, rather than not doing much at all - this means that inotify queue overflows will now be handled correctly. Index: FileSystemQueryable/FileNameFilter.cs =================================================================== RCS file: /cvs/gnome/beagle/beagled/FileSystemQueryable/FileNameFilter.cs,v retrieving revision 1.18 diff -u -B -p -r1.18 FileNameFilter.cs --- FileSystemQueryable/FileNameFilter.cs 5 Jul 2005 21:12:05 -0000 1.18 +++ FileSystemQueryable/FileNameFilter.cs 17 Jul 2005 23:36:02 -0000 @@ -165,17 +165,28 @@ namespace Beagle.Daemon.FileSystemQuerya private void OnConfigurationChanged (Conf.Section section) { IList excludes_to_add, excludes_to_remove; + bool clear_fs_state = false; ArrayFu.IntersectListChanges (Conf.Indexing.Excludes, excludes, out excludes_to_add, out excludes_to_remove); - foreach (ExcludeItem exclude in excludes_to_remove) + foreach (ExcludeItem exclude in excludes_to_remove) { + if (exclude.Type == ExcludeType.Pattern) + clear_fs_state = true; RemoveExclude (exclude); + } foreach (ExcludeItem exclude in excludes_to_add) AddExclude (exclude); - // FIXME: Send a re-scan event here when ignore patterns are updated - // and do a model.Remove/Add on the directories in question + // If an exclude pattern is removed, we need to recrawl everything + // so that we can index those files which were previously ignored. + if (clear_fs_state) + model.SetAllToUnknown (); + + // FIXME: When an exclude path/pattern is added, we need to deindex + // the files in question. + // FIXME: When an exclude path is removed, we need to recrawl that + // particular path. } ///////////////////////////////////////////////////////////// Index: FileSystemQueryable/FileSystemModel.cs =================================================================== RCS file: /cvs/gnome/beagle/beagled/FileSystemQueryable/FileSystemModel.cs,v retrieving revision 1.23 diff -u -B -p -r1.23 FileSystemModel.cs --- FileSystemQueryable/FileSystemModel.cs 5 Jul 2005 21:12:05 -0000 1.23 +++ FileSystemQueryable/FileSystemModel.cs 17 Jul 2005 23:36:03 -0000 @@ -397,6 +397,8 @@ namespace Beagle.Daemon.FileSystemQuerya { if (state == State.Clean) state = State.Unknown; + if (this.children == null) + return; foreach (DirectoryPrivate subdir in this.children.Values) subdir.SetAllToUnknown_Unlocked (); } @@ -832,8 +834,16 @@ namespace Beagle.Daemon.FileSystemQuerya try { foreach (System.IO.DirectoryInfo subinfo in DirectoryWalker.GetDirectoryInfos (info)) { if (! Ignore (subinfo.FullName)) { - if (! priv.HasChildWithName (subinfo.Name)) + Directory child = priv.GetChildByName (subinfo.Name); + + // We don't know about the child, in which case we need to add it + // (AddChild_Unlocked adds it to to_be_scanned) + if (child == null) AddChild_Unlocked (priv, subinfo.Name); + + // Or, we already know about the child, but we might want to scan it anyway + else if (child.NeedsCrawl) + to_be_scanned.Enqueue (child); } if (known_children != null) known_children.Remove (subinfo.Name); @@ -1010,12 +1020,17 @@ namespace Beagle.Daemon.FileSystemQuerya } } + // Set entire filesystem state to unknown, and fire a recrawl operation public void SetAllToUnknown () { lock (big_lock) { - foreach (DirectoryPrivate root in roots) + foreach (DirectoryPrivate root in roots) { root.SetAllToUnknown_Unlocked (); + to_be_scanned.Enqueue (root); + } } + + ScanAll (); } ///////////////////////////////////////////////////////////////////////////