From dc00a94df4a06764d822b29cbf35b532343821c8 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Tue, 6 May 2014 18:58:10 +0200 Subject: libdiskfs: lock-less reference counting for peropen objects * libdiskfs/diskfs.h (struct peropen): Use refcount_t for field refcnt. * libdiskfs/peropen-make.c (diskfs_make_peropen): Initialize refcnt. * libdiskfs/peropen-rele.c (diskfs_release_peropen): Adjust accordingly. * libdiskfs/protid-make.c (diskfs_start_protid): Likewise. Also, the node must no longer be locked, adjust comment accordingly. (diskfs_create_protid): Likewise. --- libdiskfs/protid-make.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libdiskfs/protid-make.c') diff --git a/libdiskfs/protid-make.c b/libdiskfs/protid-make.c index b39b92af..22aaa2e1 100644 --- a/libdiskfs/protid-make.c +++ b/libdiskfs/protid-make.c @@ -20,7 +20,7 @@ #include /* Build and return in CRED a protid which has no user identification, for - peropen PO. The node PO->np must be locked. */ + peropen PO. */ error_t diskfs_start_protid (struct peropen *po, struct protid **cred) { @@ -29,7 +29,7 @@ diskfs_start_protid (struct peropen *po, struct protid **cred) sizeof (struct protid), cred); if (! err) { - po->refcnt++; + refcount_ref (&po->refcnt); (*cred)->po = po; (*cred)->shared_object = MACH_PORT_NULL; (*cred)->mapped = 0; @@ -55,8 +55,8 @@ diskfs_finish_protid (struct protid *cred, struct iouser *user) assert_perror (err); } -/* Create and return a protid for an existing peropen PO in CRED for USER. - The node PO->np must be locked. */ +/* Create and return a protid for an existing peropen PO in CRED for + USER. */ error_t diskfs_create_protid (struct peropen *po, struct iouser *user, struct protid **cred) -- cgit v1.2.3