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/diskfs.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'libdiskfs/diskfs.h') diff --git a/libdiskfs/diskfs.h b/libdiskfs/diskfs.h index 8151ddc1..ae1a1502 100644 --- a/libdiskfs/diskfs.h +++ b/libdiskfs/diskfs.h @@ -28,6 +28,7 @@ #include #include #include +#include #ifdef DISKFS_DEFINE_EXTERN_INLINE #define DISKFS_EXTERN_INLINE @@ -57,7 +58,7 @@ struct peropen { int filepointer; int lock_status; - int refcnt; + refcount_t refcnt; int openstat; struct node *np; @@ -792,12 +793,12 @@ diskfs_create_node (struct node *dir, const char *name, mode_t mode, struct dirstat *ds); /* Create and return a protid for an existing peropen PO in CRED, - referring to user USER. The node PO->np must be locked. */ + referring to user USER. */ error_t diskfs_create_protid (struct peropen *po, struct iouser *user, struct protid **cred); /* 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); /* Finish building protid CRED started with diskfs_start_protid; -- cgit v1.2.3