From 7a99dacc0eb5c31ba2d95615f4fe787c03a311df Mon Sep 17 00:00:00 2001 From: Krutika Dhananjay Date: Wed, 24 Jun 2015 08:02:51 +0530 Subject: cluster/afr: Pick gfid from poststat during fresh lookup for read child calculation Backport of: http://review.gluster.org/11373 Change-Id: I3ddc70cb0e7dbd1ef8adb352393b5ec16464fc94 BUG: 1212842 Signed-off-by: Krutika Dhananjay Reviewed-on: http://review.gluster.org/11391 Tested-by: NetBSD Build System Tested-by: Gluster Build System Reviewed-by: Pranith Kumar Karampuri --- libglusterfs/src/inode.c | 22 ++++++++++++++++++++++ libglusterfs/src/inode.h | 3 +++ 2 files changed, 25 insertions(+) (limited to 'libglusterfs/src') diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c index 7c548653ebf..7d3215ed16e 100644 --- a/libglusterfs/src/inode.c +++ b/libglusterfs/src/inode.c @@ -2126,6 +2126,28 @@ inode_ctx_reset0 (inode_t *inode, xlator_t *xlator, uint64_t *value1_p) return ret; } +int +inode_is_linked (inode_t *inode) +{ + int ret = 0; + inode_table_t *table = NULL; + + if (!inode) { + gf_log_callingfn (THIS->name, GF_LOG_WARNING, + "inode not found"); + return 0; + } + + table = inode->table; + + pthread_mutex_lock (&table->lock); + { + ret = __is_inode_hashed (inode); + } + pthread_mutex_unlock (&table->lock); + + return ret; +} void inode_dump (inode_t *inode, char *prefix) diff --git a/libglusterfs/src/inode.h b/libglusterfs/src/inode.h index 50815599347..474dc3992fc 100644 --- a/libglusterfs/src/inode.h +++ b/libglusterfs/src/inode.h @@ -269,4 +269,7 @@ inode_table_set_lru_limit (inode_table_t *table, uint32_t lru_limit); void inode_ctx_merge (fd_t *fd, inode_t *inode, inode_t *linked_inode); +int +inode_is_linked (inode_t *inode); + #endif /* _INODE_H */ -- cgit