Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | bfstd: New {error,errno}_is_like() functions | Tavian Barnes | 2024-01-13 | 1 | -15/+3 |
| | | | | | | | We used to have is_nonexistence_error() to consistently treat ENOENT and ENOTDIR the same. Recently, we started considering EFAULT the same as ENAMETOOLONG on DragonFly BSD to work around a kernel bug. Unify both of these behind a more generic interface. | ||||
* | Work around DragonFly BSD kernel bug | Tavian Barnes | 2024-01-04 | 1 | -1/+13 |
| | | | | | | | | | DragonFly's x86_64 assembly implementation of copyinstr() checks the wrong pointer when deciding whether to return EFAULT or ENAMETOOLONG, causing it to always return EFAULT for overlong paths. Work around it by treating EFAULT the same as ENAMETOOLONG on DragonFly. Link: https://twitter.com/tavianator/status/1742991411203485713 | ||||
* | ioq: Implement a better non-blocking pop | Tavian Barnes | 2023-11-09 | 1 | -1/+1 |
| | |||||
* | bftw: Improve ioq balancing logic | Tavian Barnes | 2023-11-01 | 1 | -13/+22 |
| | |||||
* | bftw: Leave work for the main thread if profitable | Tavian Barnes | 2023-10-31 | 1 | -4/+13 |
| | |||||
* | bftw: New flag to control whiteout visibility | Tavian Barnes | 2023-10-17 | 1 | -2/+16 |
| | |||||
* | dir: Add a flags parameter to bfs_opendir() | Tavian Barnes | 2023-10-17 | 1 | -2/+2 |
| | |||||
* | bftw: Make sure we don't close a directory while we unwrap it | Tavian Barnes | 2023-10-12 | 1 | -2/+6 |
| | | | | | | | bftw_cache_reserve() can lead to bftw_cache_pop(), which could close the directory we're trying to unwrap! If that happened, we would try dup_cloexec(-1), which would fail with EBADF, so there was no observable bug. But it's better to avoid the whole situation. | ||||
* | bftw: Fix to_close list corruption with !BFS_USE_UNWRAPDIR | Tavian Barnes | 2023-10-12 | 1 | -6/+13 |
| | | | | | | | | | | It's possible for pincount to drop to zero, then get incremented and drop back to zero again. If this happens, we shouldn't add it to the to_close list twice. This should fix the intermittent hang on the macOS CI. Fixes: 815798e1eea7fc8dacd5acab40202ec4d251d517 | ||||
* | bftw: Don't force buffering for parallel dfs | Tavian Barnes | 2023-10-12 | 1 | -5/+30 |
| | |||||
* | bftw: Fix unbuffered depth-first searches | Tavian Barnes | 2023-10-12 | 1 | -15/+41 |
| | | | | | | | | | | | | | | | bftw() implements depth-first search by appending files to a batch, then prepending the batch to the queue. When we switched to separate file/ directory queues, this was only implemented for the file queue. Unbuffered searches don't use the file queue, so they were all breadth- first in practice. This meant that iterative deepening (-S ids) was actually "iterative deepening *breadth*-first search," a horrible strategy with no advantage over regular breadth-first search. Now it performs iterative deepening *depth*-first search, which at least limits its memory consumption. Fixes: c1b16b49988ecff17ae30978ea14798d95b80018 | ||||
* | bftw: Let iterative deepening work depth-first when sorting | Tavian Barnes | 2023-10-12 | 1 | -1/+1 |
| | |||||
* | ioq: Use io_uring | Tavian Barnes | 2023-10-02 | 1 | -5/+18 |
| | | | | Closes #65. | ||||
* | dstring: New dchar typedef for dynamic strings | Tavian Barnes | 2023-09-26 | 1 | -1/+1 |
| | |||||
* | Use the new list macros | Tavian Barnes | 2023-09-25 | 1 | -13/+11 |
| | |||||
* | bftw: Share the bftw_state between iterations of ids/eds | Tavian Barnes | 2023-09-13 | 1 | -72/+71 |
| | |||||
* | bftw: Enforce the dirlimit strictly | Tavian Barnes | 2023-09-06 | 1 | -19/+17 |
| | | | | | | The previous accounting didn't fully control the number of allocated bfs_dirs, as the dirlimit was incremented once we popped the directory, not when we freed it. | ||||
* | bftw: Use bftw_file->next for multiple lists | Tavian Barnes | 2023-07-18 | 1 | -29/+21 |
| | | | | | A file can be on the to_open and to_read lists at the same time, but otherwise only one list, so we can save memory by sharing the pointers. | ||||
* | bftw: Use a larger ioq depth | Tavian Barnes | 2023-07-18 | 1 | -22/+12 |
| | | | | | | | Now that the dirlimit provides backpressure on the number of open directories, we can use a uniformly larger queue depth for increased performance. The current parameters were tuned with a small grid search on my workstation. | ||||
* | bftw: Add a queue of directories to unwrap | Tavian Barnes | 2023-07-18 | 1 | -7/+22 |
| | | | | | | | | For !BFS_USE_UNWRAPDIR, if a file is still pinned in bftw_closedir(), it has to stay open until its pincount drops to zero. Since this happens in bftw_ioq_pop(), we can't immediately call bftw_unwrapdir() as that adds to the ioq. Instead, add it to a list that gets drained by the next bftw_gc(). | ||||
* | bftw: Add dirs to the end of the queue in bftw_ioq_pop() | Tavian Barnes | 2023-07-18 | 1 | -11/+25 |
| | | | | | | I tried this before in #105 but it led to performance regressions. The key to avoiding those regressions is to put some backpressure on how many bfs_dir's can be allocated simultaneously. | ||||
* | bftw: Use separate queues for open and closed directories | Tavian Barnes | 2023-07-17 | 1 | -89/+115 |
| | |||||
* | bftw: Check that file->fd == bfs_dirfd(file->dir) earlier | Tavian Barnes | 2023-07-17 | 1 | -2/+3 |
| | | | | | | | This has the potential to fail on at least one known platform: macports with the legacysupport implementation of fdopendir(). Link: https://github.com/macports/macports-ports/pull/19047#issuecomment-1636059809 | ||||
* | bftw: Reserve space in the cache before opening files | Tavian Barnes | 2023-07-17 | 1 | -3/+15 |
| | | | | | | | This fixes a storm of EMFILE retries observed with -j1 on a very large directory tree. Fixes: 7888fbababd22190e9f919fc272957426a27969e | ||||
* | bftw: Pass the whole bftw_state to bftw_openat() | Tavian Barnes | 2023-07-17 | 1 | -510/+451 |
| | | | | | This required shuffling a lot of code around. Hopefully the new order makes more sense. | ||||
* | bftw: Add bfs_dir allocation wrappers | Tavian Barnes | 2023-07-17 | 1 | -9/+19 |
| | |||||
* | bftw: Try to close files asynchronously | Tavian Barnes | 2023-07-10 | 1 | -36/+139 |
| | |||||
* | ioq: Implement async close() and closedir() | Tavian Barnes | 2023-07-10 | 1 | -18/+23 |
| | |||||
* | bftw: If the ioq is full, try to pop before ioq_opendir() | Tavian Barnes | 2023-07-07 | 1 | -49/+82 |
| | |||||
* | ioq: New ioq_cancel() function | Tavian Barnes | 2023-06-26 | 1 | -0/+4 |
| | |||||
* | dir: Arena-allocate directories | Tavian Barnes | 2023-06-20 | 1 | -8/+29 |
| | |||||
* | bftw: Arena-allocate struct bftw_file | Tavian Barnes | 2023-06-20 | 1 | -5/+11 |
| | |||||
* | alloc: New header for memory allocation utilities | Tavian Barnes | 2023-06-20 | 1 | -3/+2 |
| | |||||
* | bftw: Use an I/O queue to open directories | Tavian Barnes | 2023-06-13 | 1 | -7/+147 |
| | | | | Parallelism is controlled by the new -j flag. | ||||
* | bftw: Implement open file pinning | Tavian Barnes | 2023-06-12 | 1 | -32/+100 |
| | |||||
* | dir: Add a flag to bfs_freedir() to force the fd to stay the same | Tavian Barnes | 2023-06-12 | 1 | -2/+2 |
| | |||||
* | list: Allow popping from an empty list | Tavian Barnes | 2023-05-24 | 1 | -16/+3 |
| | |||||
* | list: Return the removed item from SLIST_POP() | Tavian Barnes | 2023-05-20 | 1 | -4/+2 |
| | |||||
* | Switch from assert() to bfs_assert()/bfs_verify() | Tavian Barnes | 2023-05-18 | 1 | -14/+14 |
| | |||||
* | config: Provide <stdalign.h> and <stdbool.h> | Tavian Barnes | 2023-05-11 | 1 | -1/+0 |
| | | | | In anticipation of C23, since those headers won't be necessary any more. | ||||
* | config: s/BFS_FALLTHROUGH/fallthru/ | Tavian Barnes | 2023-05-10 | 1 | -1/+1 |
| | |||||
* | config: s/BFS_FLEX_SIZEOF/flex_sizeof/ | Tavian Barnes | 2023-05-10 | 1 | -1/+1 |
| | |||||
* | bftw: Use separate dir/file queues | Tavian Barnes | 2023-05-05 | 1 | -218/+176 |
| | |||||
* | bftw: Merge bftw_closedir() into bftw_gc() | Tavian Barnes | 2023-04-12 | 1 | -59/+47 |
| | |||||
* | list: Use macros instead of type-erased lists | Tavian Barnes | 2023-03-31 | 1 | -42/+94 |
| | |||||
* | list: New helper macros for converting entries to items | Tavian Barnes | 2023-03-29 | 1 | -13/+5 |
| | |||||
* | bftw: Use list.h for the queue and LRU lists | Tavian Barnes | 2023-03-29 | 1 | -218/+93 |
| | |||||
* | bftw: Refactor bftw_queue | Tavian Barnes | 2023-03-28 | 1 | -88/+55 |
| | |||||
* | Replace license boilerplate with SPDX tags | Tavian Barnes | 2023-01-25 | 1 | -15/+2 |
| | | | | | | | And while I'm at it, remove years from copyright declarations. Link: https://spdx.dev/about/ Link: https://daniel.haxx.se/blog/2023/01/08/copyright-without-years/ | ||||
* | bfstd: New wrappers for dirname()/basename() | Tavian Barnes | 2023-01-19 | 1 | -1/+1 |
| |