1
0
mirror of https://git.savannah.gnu.org/git/coreutils.git synced 2026-10-24 02:08:57 +03:00
Files
coreutils/src
Iván Ezequiel Rodriguez 6ab90e2010 tail: improve scalability of follow-by-name directory events
Replace the O(N) scan of watched names on each directory inotify event
with a Hash_table keyed by (parent_wd, basename), addressing the
long-standing FIXME in tail_forever_inotify.

Keep ownership consistent with wd_to_name: parent_by_name is created
only for Follow_name and returned to the caller, so fallback paths can
return without local hash cleanup.

Hash basenames with hash_string() and mix in parent_wd, matching the
existing gnulib helper rather than a hand-rolled string hash.

Matching cost for N directory events that each compare against N names
(illustrative host timings of the scan vs hash lookup alone):

  N=1000:  ~0.018s -> ~0.000s
  N=5000:  ~0.39s  -> ~0.000s
  N=10000: ~1.5s   -> ~0.000s

End-to-end recreate storms remain largely file-system bound on this
host; the hash removes the quadratic name-matching CPU from that path.

* src/tail.c (parent_name_hasher, parent_name_comparator): New.
(tail_forever_inotify): Build and use parent_by_name; return it to the
caller.
(main): Free parent_ht when non-NULL.
* tests/tail/inotify-parent-hash.sh: Require notification mode; cover
multiple names in one directory and the same basename in two
directories.
* tests/local.mk: Reference the new test.
* NEWS: Mention the improvement.
2026-10-13 14:33:22 +01:00
..
2026-01-18 15:55:38 +00:00
2026-01-18 15:55:38 +00:00
2026-02-27 16:18:32 -08:00
2026-02-27 16:18:32 -08:00
2026-04-22 19:12:44 -07:00
2026-05-10 23:42:26 -07:00
2026-01-21 13:51:58 +00:00
2026-01-01 10:56:16 -08:00
2026-06-20 13:30:34 -07:00
2026-05-10 23:42:26 -07:00
2026-01-01 10:56:16 -08:00
2026-08-01 12:38:28 +01:00
2026-10-07 12:33:44 +01:00
2026-01-18 15:55:38 +00:00
2026-01-18 15:55:38 +00:00
2026-02-27 16:18:32 -08:00
2026-01-01 10:56:16 -08:00
2026-01-18 15:55:38 +00:00
2026-02-19 20:36:47 -08:00
2025-05-12 01:28:48 -07:00
2026-10-13 11:35:40 +01:00
2026-02-19 20:36:40 -08:00
2026-06-07 16:43:50 -07:00
2026-01-01 10:56:16 -08:00
2026-01-01 10:56:16 -08:00
2026-01-18 15:55:38 +00:00
2026-01-01 10:56:16 -08:00
2026-01-18 15:55:38 +00:00
2026-01-01 10:56:16 -08:00
2026-02-19 20:53:20 -08:00
2025-07-09 17:12:40 -07:00
2026-04-16 22:05:13 +01:00
2026-04-09 21:36:43 +01:00
2026-01-01 10:56:16 -08:00
2026-02-27 16:18:32 -08:00
2026-02-27 16:18:32 -08:00
2026-01-18 15:55:38 +00:00
2026-01-18 15:55:38 +00:00
2026-01-01 10:56:16 -08:00
2026-07-26 12:44:01 -07:00
2026-04-08 22:34:13 -07:00
2026-02-19 20:35:19 -08:00
2026-07-20 19:46:41 +01:00
2026-01-01 10:56:16 -08:00
2026-01-01 10:56:16 -08:00
2026-10-07 23:26:45 -07:00