diff options
author | Krishna Srinivas <ksriniva@redhat.com> | 2012-02-20 14:34:39 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-02-20 07:26:51 -0800 |
commit | ed2036979499cb272336187c06955aa5e484023d (patch) | |
tree | a2173280ad5753aa4d674e86e6ed66bcdcd6f973 /libglusterfs/src | |
parent | db20a0f8a99f715a77366e518720612f043d5c9e (diff) |
NLM - Network Lock Manger V4
Change-Id: Ic31b8bb10a28408da2a623f4ecc0c60af01c64af
BUG: 795421
Signed-off-by: Krishna Srinivas <ksriniva@redhat.com>
Reviewed-on: http://review.gluster.com/2711
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'libglusterfs/src')
-rw-r--r-- | libglusterfs/src/fd.c | 45 | ||||
-rw-r--r-- | libglusterfs/src/fd.h | 6 |
2 files changed, 44 insertions, 7 deletions
diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c index d4cc3464a93..ff956ec2cff 100644 --- a/libglusterfs/src/fd.c +++ b/libglusterfs/src/fd.c @@ -489,7 +489,7 @@ fd_bind (fd_t *fd) static fd_t * -__fd_create (inode_t *inode, pid_t pid) +__fd_create (inode_t *inode, uint64_t pid) { fd_t *fd = NULL; @@ -535,6 +535,21 @@ fd_create (inode_t *inode, pid_t pid) { fd_t *fd = NULL; + fd = __fd_create (inode, (uint64_t)pid); + if (!fd) + goto out; + + fd = fd_ref (fd); + +out: + return fd; +} + +fd_t * +fd_create_uint64 (inode_t *inode, uint64_t pid) +{ + fd_t *fd = NULL; + fd = __fd_create (inode, pid); if (!fd) goto out; @@ -547,7 +562,7 @@ out: static fd_t * -__fd_lookup (inode_t *inode, pid_t pid) +__fd_lookup (inode_t *inode, uint64_t pid) { fd_t *iter_fd = NULL; fd_t *fd = NULL; @@ -579,13 +594,31 @@ fd_lookup (inode_t *inode, pid_t pid) LOCK (&inode->lock); { - fd = __fd_lookup (inode, pid); + fd = __fd_lookup (inode, (uint64_t)pid); } UNLOCK (&inode->lock); return fd; } +fd_t * +fd_lookup_uint64 (inode_t *inode, uint64_t pid) +{ + fd_t *fd = NULL; + + if (!inode) { + gf_log_callingfn ("fd", GF_LOG_WARNING, "!inode"); + return NULL; + } + + LOCK (&inode->lock); + { + fd = __fd_lookup (inode, pid); + } + UNLOCK (&inode->lock); + + return fd; +} fd_t * @@ -593,10 +626,10 @@ __fd_anonymous (inode_t *inode) { fd_t *fd = NULL; - fd = __fd_lookup (inode, -1); + fd = __fd_lookup (inode, (uint64_t)-1); if (!fd) { - fd = __fd_create (inode, -1); + fd = __fd_create (inode, (uint64_t)-1); if (!fd) return NULL; @@ -806,7 +839,7 @@ fd_dump (fd_t *fd, char *prefix) return; memset(key, 0, sizeof(key)); - gf_proc_dump_write("pid", "%d", fd->pid); + gf_proc_dump_write("pid", "%llu", fd->pid); gf_proc_dump_write("refcount", "%d", fd->refcount); gf_proc_dump_write("flags", "%d", fd->flags); } diff --git a/libglusterfs/src/fd.h b/libglusterfs/src/fd.h index 6b0ed891ff0..531dd44f2a2 100644 --- a/libglusterfs/src/fd.h +++ b/libglusterfs/src/fd.h @@ -52,7 +52,7 @@ struct _fd_ctx { * See the comment there to know why. */ struct _fd { - pid_t pid; + uint64_t pid; int32_t flags; int32_t refcount; struct list_head inode_list; @@ -130,10 +130,14 @@ fd_unref (fd_t *fd); fd_t * fd_create (struct _inode *inode, pid_t pid); +fd_t * +fd_create_uint64 (struct _inode *inode, uint64_t pid); fd_t * fd_lookup (struct _inode *inode, pid_t pid); +fd_t * +fd_lookup_uint64 (struct _inode *inode, uint64_t pid); fd_t * fd_anonymous (inode_t *inode); |