diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-05-14 11:19:35 +0200 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-04-17 14:06:46 +0200 |
commit | c16eed2cb64089bf7d958db0fe85352f4ceefb4d (patch) | |
tree | 3240f6e025fa4c4fb47d7d270f285a7f0f9612e4 /libdiskfs/diskfs.h | |
parent | 8c050fb080c6e1981dc8e5a97a2313cd24e9b4b4 (diff) |
libdiskfs: lock-less reference counting of nodes
* libdiskfs/diskfs.h (struct node): Use refcounts_t for reference counting.
(diskfs_node_refcnt_lock): Remove.
(diskfs_node_norefs,diskfs_drop_node): Change comments accordingly.
* libdiskfs/init-init.c: Adjust accordingly.
* libdiskfs/node-drop.c: Likewise.
* libdiskfs/node-make.c: Likewise.
* libdiskfs/node-nput.c: Likewise.
* libdiskfs/node-nputl.c: Likewise.
* libdiskfs/node-nref.c: Likewise.
* libdiskfs/node-nrefl.c: Likewise.
* libdiskfs/node-nrele.c: Likewise.
* libdiskfs/node-nrelel.c: Likewise.
* ext2fs/inode.c: Likewise.
* fatfs/inode.c: Likewise.
* isofs/inode.c: Likewise.
* tmpfs/node.c: Likewise.
* doc/hurd.texi: Likewise.
Diffstat (limited to 'libdiskfs/diskfs.h')
-rw-r--r-- | libdiskfs/diskfs.h | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/libdiskfs/diskfs.h b/libdiskfs/diskfs.h index 28182254..535fb399 100644 --- a/libdiskfs/diskfs.h +++ b/libdiskfs/diskfs.h @@ -96,8 +96,7 @@ struct node pthread_mutex_t lock; - int references; /* hard references */ - int light_references; /* light references */ + refcounts_t refcounts; mach_port_t sockaddr; /* address for S_IFSOCK shortcut */ @@ -198,8 +197,6 @@ extern volatile struct mapped_time_value *diskfs_mtime; be done by format independent code. */ extern int diskfs_synchronous; -extern pthread_spinlock_t diskfs_node_refcnt_lock; - extern int pager_port_type; /* Whether the filesystem is currently writable or not. */ @@ -448,14 +445,15 @@ error_t diskfs_alloc_node (struct node *dp, mode_t mode, struct node **np); void diskfs_free_node (struct node *np, mode_t mode); /* Node NP has no more references; free local state, including *NP - if it isn't to be retained. diskfs_node_refcnt_lock is held. */ + if it isn't to be retained. */ void diskfs_node_norefs (struct node *np); /* The user must define this function. Node NP has some light references, but has just lost its last hard references. Take steps so that if any light references can be freed, they are. NP is locked as is the pager refcount lock. This function will be called after - diskfs_lost_hardrefs. */ + diskfs_lost_hardrefs. An additional light reference is acquired by + libdiskfs across calls to this function. */ void diskfs_try_dropping_softrefs (struct node *np); /* The user must define this funcction. Node NP has some light @@ -611,9 +609,8 @@ void diskfs_spawn_first_thread (ports_demuxer_type demuxer); diskfs_init_completed once it has a valid proc and auth port. */ void diskfs_start_bootstrap (); -/* Node NP now has no more references; clean all state. The - _diskfs_node_refcnt_lock must be held, and will be released - upon return. NP must be locked. */ +/* Node NP now has no more references; clean all state. NP must be + locked. */ void diskfs_drop_node (struct node *np); /* Set on disk fields from NP->dn_stat; update ctime, atime, and mtime |