Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Issue 2308413002: Only update watches when directories change. (Closed)

Created:
4 years, 3 months ago by dspaid
Modified:
4 years, 3 months ago
CC:
chromium-reviews
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Only update watches when directories changed. Because updating all watches for a recursively watched directory is an expensive operation (requires scanning the entire directory tree below a recursive watch target) the code normally only performs this if a directory is modified or some component of |target_| changes. Because the target path is not present in |recursive_paths_by_watch_|, the current implementation treats all inotify events in the target directory as changes that require an expensive update to all recursive watches, even if the event is only related to a non-directory file. This patch addresses the issue by only forcing a global update if the fired watch is both not in |recursive_paths_by_watch_| as well as not the |target_| watch. BUG=628223 TEST=base_unittests continues to pass Manual testing confirms performance changes from O(n) to O(1) for touching a file in a watched directory. Committed: https://crrev.com/842221d3c80f2afd6fe3f6723b0b06d56fc6e541 Cr-Commit-Position: refs/heads/master@{#417872}

Patch Set 1 #

Total comments: 2

Patch Set 2 : Fix logic in UpdateRecursiveWatches instead of adding new logic #

Patch Set 3 : Remove unnecessary test changes #

Patch Set 4 : formatting #

Patch Set 5 : rebase #

Total comments: 4

Patch Set 6 : Addressed comments #

Patch Set 7 : commit message updated #

Patch Set 8 : Correctly set changed_dir #

Unified diffs Side-by-side diffs Delta from patch set Stats (+8 lines, -2 lines) Patch
M base/files/file_path_watcher_linux.cc View 1 2 3 4 5 6 7 3 chunks +8 lines, -2 lines 0 comments Download

Messages

Total messages: 37 (19 generated)
dspaid
+nya, Here's an initial draft of one of the CLs to fix the performance issue ...
4 years, 3 months ago (2016-09-05 07:38:43 UTC) #2
Shuhei Takahashi
https://codereview.chromium.org/2308413002/diff/1/base/files/file_path_watcher_linux.cc File base/files/file_path_watcher_linux.cc (right): https://codereview.chromium.org/2308413002/diff/1/base/files/file_path_watcher_linux.cc#newcode537 base/files/file_path_watcher_linux.cc:537: if (!is_dir) Hmm, is this check insufficient?
4 years, 3 months ago (2016-09-05 10:48:09 UTC) #3
dspaid
https://codereview.chromium.org/2308413002/diff/1/base/files/file_path_watcher_linux.cc File base/files/file_path_watcher_linux.cc (right): https://codereview.chromium.org/2308413002/diff/1/base/files/file_path_watcher_linux.cc#newcode537 base/files/file_path_watcher_linux.cc:537: if (!is_dir) On 2016/09/05 10:48:09, Shuhei Takahashi wrote: > ...
4 years, 3 months ago (2016-09-05 12:57:23 UTC) #4
dspaid
On 2016/09/05 12:57:23, dspaid wrote: > https://codereview.chromium.org/2308413002/diff/1/base/files/file_path_watcher_linux.cc > File base/files/file_path_watcher_linux.cc (right): > > https://codereview.chromium.org/2308413002/diff/1/base/files/file_path_watcher_linux.cc#newcode537 > ...
4 years, 3 months ago (2016-09-06 07:33:03 UTC) #5
Shuhei Takahashi
https://codereview.chromium.org/2308413002/diff/80001/base/files/file_path_watcher_linux.cc File base/files/file_path_watcher_linux.cc (right): https://codereview.chromium.org/2308413002/diff/80001/base/files/file_path_watcher_linux.cc#newcode515 base/files/file_path_watcher_linux.cc:515: bool is_dir) { Could you insert DCHECK(HasValidWatchVector()); here? https://codereview.chromium.org/2308413002/diff/80001/base/files/file_path_watcher_linux.cc#newcode530 ...
4 years, 3 months ago (2016-09-08 05:10:52 UTC) #11
dspaid
https://codereview.chromium.org/2308413002/diff/80001/base/files/file_path_watcher_linux.cc File base/files/file_path_watcher_linux.cc (right): https://codereview.chromium.org/2308413002/diff/80001/base/files/file_path_watcher_linux.cc#newcode515 base/files/file_path_watcher_linux.cc:515: bool is_dir) { On 2016/09/08 05:10:52, Shuhei Takahashi wrote: ...
4 years, 3 months ago (2016-09-09 02:00:55 UTC) #12
Shuhei Takahashi
lgtm, thanks!
4 years, 3 months ago (2016-09-09 03:15:11 UTC) #13
dspaid
4 years, 3 months ago (2016-09-09 04:57:28 UTC) #15
dcheng
LGTM but please format the CL description to follow the usual conventions, with a short ...
4 years, 3 months ago (2016-09-09 06:10:57 UTC) #16
dspaid
On 2016/09/09 06:10:57, dcheng wrote: > LGTM but please format the CL description to follow ...
4 years, 3 months ago (2016-09-09 07:37:28 UTC) #18
dcheng
LGTM, thanks!
4 years, 3 months ago (2016-09-09 07:49:04 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2308413002/120001
4 years, 3 months ago (2016-09-11 23:25:42 UTC) #22
commit-bot: I haz the power
Try jobs failed on following builders: cast_shell_linux on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/cast_shell_linux/builds/222604)
4 years, 3 months ago (2016-09-11 23:55:51 UTC) #24
dspaid
PTAL Tests caught a minor regression.
4 years, 3 months ago (2016-09-12 01:35:25 UTC) #29
dcheng
lgtm
4 years, 3 months ago (2016-09-12 05:37:04 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2308413002/140001
4 years, 3 months ago (2016-09-12 05:44:57 UTC) #33
commit-bot: I haz the power
Committed patchset #8 (id:140001)
4 years, 3 months ago (2016-09-12 05:48:12 UTC) #35
commit-bot: I haz the power
4 years, 3 months ago (2016-09-12 05:50:28 UTC) #37
Message was sent while issue was closed.
Patchset 8 (id:??) landed as
https://crrev.com/842221d3c80f2afd6fe3f6723b0b06d56fc6e541
Cr-Commit-Position: refs/heads/master@{#417872}

Powered by Google App Engine
This is Rietveld 408576698