aboutsummaryrefslogtreecommitdiff
path: root/libdiskfs/node-cache.c
Commit message (Collapse)AuthorAgeFilesLines
* libdiskfs: Flush node to disk before removing it from the cacheSamuel Thibault2021-08-111-0/+4
| | | | | | libdiskfs' dosync goes through the cache to flush nodes to the disk. We thus have to flush a node to the disk before removing it from the cache in diskfs_try_dropping_softrefs.
* Use our own variant of 'assert' and 'assert_perror'.Justus Winter2017-08-051-5/+5
| | | | | Our variants print stack traces on failures. This will make locating errors much easier.
* libdiskfs: use ihash for the node cacheJustus Winter2015-12-011-56/+51
| | | | | | | | | | | | | | | | Replace the hand-written hash table in the node cache with libihash. Libihash is a self-tuning hash table, whereas the previous code used a fixed number of buckets. * libdiskfs/Makefile (HURDLIBS): Link to `ihash'. * libdiskfs/diskfs.h (struct node): Remove bucket list, add slot pointer. * libdiskfs/node-cache.c (nodecache): New ihash table replacing the old `nodehash'. (lookup): Drop function. (diskfs_cached_lookup_context): Adapt accordingly. (diskfs_cached_ifind): Likewise. (diskfs_try_dropping_softrefs): Likewise. (diskfs_node_iterate): Likewise.
* libdiskfs: do not print a message on ENOMEMJustus Winter2015-06-051-1/+0
| | | | | * libdiskfs/node-cache.c (diskfs_node_iterate): Do not print a message on ENOMEM.
* libdiskfs: implement a node cacheJustus Winter2015-04-171-0/+260
Previously, all users of libdiskfs implemented a node cache on their own. Move the node cache from ext2fs into libdiskfs. We preserve the previous API by marking all functions that we pull from ext2fs as weak, so that users like tmpfs can still implement their own node cache. * ext2fs/dir.c (diskfs_lookup_hard): Adjust accordingly. * ext2fs/ext2fs.c (main): Don't call `inode_init'. * ext2fs/ext2fs.h (struct disknode): Drop `hnext', `hprevp'. * ext2fs/inode.c: Move the node cache into diskfs. (diskfs_user_make_node): New function. (diskfs_try_dropping_softrefs): Rename to `diskfs_user_try_dropping_softrefs'. (read_node): Rename to `diskfs_user_read_node'. Also move a chunk of code dealing with generations from `diskfs_cached_lookup' here. * libdiskfs/Makefile (OTHERSRCS): Add `node-cache.c'. * libdiskfs/diskfs.h (struct node): Add `hnext', `hprevp'. Amend existing comments, add forward declarations. * libdiskfs/node-cache.c: New file.