Ludovic Courtès <[EMAIL PROTECTED]> writes: > In libnetfs, the netfs_nref, netfs_nput, etc. functions use a global spin > lock that they acquire before changing the reference count of a node. > First of all, it is not clear to me why the lock needs to be global.
A global is harmless, because the lock is only held for tiny amounts of time. No serious contention issues can arise. Another reason is where to put the lock, if it's not a global. It cannot be allocated inside the node structure, or there can be a race between deallocation and acquiring the lock. Note that users of the netfs library are allowed to keep nodes cached somewhere (just like diskfs nodes), and so netfs_node_norefs is not actually required to free anything. > Secondly, I have a race condition in tarfs which I believe could be avoided > if the lock was a mutex. mutexes and spin locks behave identically. The only significant difference is the respective performance costs of contention and blocking. _______________________________________________ Help-hurd mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/help-hurd