From dca4b2a23cb55e1e15fb393e7cbfd39b59280c9c Mon Sep 17 00:00:00 2001 From: Pavan Sondur Date: Wed, 30 Sep 2009 05:48:22 +0000 Subject: Changes to use this->name while using logging instead of explicitly mentioning posix-locks. Signed-off-by: Anand V. Avati BUG: 290 (Clean up a calls to gf_log in locks' code) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=290 --- xlators/features/locks/src/common.c | 2 +- xlators/features/locks/src/common.h | 2 +- xlators/features/locks/src/entrylk.c | 2 +- xlators/features/locks/src/inodelk.c | 32 ++++++++++++++++---------------- xlators/features/locks/src/posix.c | 2 +- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/xlators/features/locks/src/common.c b/xlators/features/locks/src/common.c index 9b7cdac4d4d..973f6303e6d 100644 --- a/xlators/features/locks/src/common.c +++ b/xlators/features/locks/src/common.c @@ -115,7 +115,7 @@ pl_inode_get (xlator_t *this, inode_t *inode) goto out; } - gf_log ("posix-locks", GF_LOG_TRACE, + gf_log (this->name, GF_LOG_TRACE, "Allocating new pl inode"); st_mode = inode->st_mode; diff --git a/xlators/features/locks/src/common.h b/xlators/features/locks/src/common.h index b082090e1c2..bdc2910c782 100644 --- a/xlators/features/locks/src/common.h +++ b/xlators/features/locks/src/common.h @@ -53,7 +53,7 @@ pl_dom_list_t * get_domain (pl_inode_t *pl_inode, const char *volume); void -grant_blocked_inode_locks (pl_inode_t *pl_inode, pl_inode_lock_t *lock, pl_dom_list_t *dom); +grant_blocked_inode_locks (xlator_t *this, pl_inode_t *pl_inode, pl_inode_lock_t *lock, pl_dom_list_t *dom); void __delete_inode_lock (pl_inode_lock_t *lock); diff --git a/xlators/features/locks/src/entrylk.c b/xlators/features/locks/src/entrylk.c index 0ddc9532fba..3833359772f 100644 --- a/xlators/features/locks/src/entrylk.c +++ b/xlators/features/locks/src/entrylk.c @@ -456,7 +456,7 @@ pl_common_entrylk (call_frame_t *frame, xlator_t *this, dom = get_domain (pinode, volume); if (!dom){ - gf_log ("posix-locks", GF_LOG_ERROR, + gf_log (this->name, GF_LOG_ERROR, "Out of memory"); op_errno = ENOMEM; goto out; diff --git a/xlators/features/locks/src/inodelk.c b/xlators/features/locks/src/inodelk.c index 6ef8186e183..9885de5e0b0 100644 --- a/xlators/features/locks/src/inodelk.c +++ b/xlators/features/locks/src/inodelk.c @@ -144,7 +144,7 @@ __owner_has_lock (pl_dom_list_t *dom, pl_inode_lock_t *newlock) * is blocking, adds it to the blocked_inodelks list of the domain. */ static int -__lock_inodelk (pl_inode_t *pl_inode, pl_inode_lock_t *lock, +__lock_inodelk (xlator_t *this, pl_inode_t *pl_inode, pl_inode_lock_t *lock, int can_block, pl_dom_list_t *dom) { pl_inode_lock_t *conf = NULL; @@ -158,7 +158,7 @@ __lock_inodelk (pl_inode_t *pl_inode, pl_inode_lock_t *lock, list_add_tail (&lock->blocked_locks, &dom->blocked_inodelks); - gf_log ("posix-locks", GF_LOG_TRACE, + gf_log (this->name, GF_LOG_TRACE, "%s (pid=%d) %"PRId64" - %"PRId64" => Blocked", lock->fl_type == F_UNLCK ? "Unlock" : "Lock", lock->client_pid, @@ -176,9 +176,9 @@ __lock_inodelk (pl_inode_t *pl_inode, pl_inode_lock_t *lock, list_add_tail (&lock->blocked_locks, &dom->blocked_inodelks); - gf_log ("posix-locks", GF_LOG_TRACE, + gf_log (this->name, GF_LOG_TRACE, "Lock is grantable, but blocking to prevent starvation"); - gf_log ("posix-locks", GF_LOG_TRACE, + gf_log (this->name, GF_LOG_TRACE, "%s (pid=%d) %"PRId64" - %"PRId64" => Blocked", lock->fl_type == F_UNLCK ? "Unlock" : "Lock", lock->client_pid, @@ -223,19 +223,19 @@ find_matching_inodelk (pl_inode_lock_t *lock, pl_dom_list_t *dom) * as the UNLCK lock specifies. If such a lock is not found, returns invalid */ static pl_inode_lock_t * -__inode_unlock_lock (pl_inode_lock_t *lock, pl_dom_list_t *dom) +__inode_unlock_lock (xlator_t *this, pl_inode_lock_t *lock, pl_dom_list_t *dom) { pl_inode_lock_t *conf = NULL; conf = find_matching_inodelk (lock, dom); if (!conf) { - gf_log ("posix-locks", GF_LOG_DEBUG, + gf_log (this->name, GF_LOG_DEBUG, " Matching lock not found for unlock"); goto out; } __delete_inode_lock (conf); - gf_log ("posix-locks", GF_LOG_DEBUG, + gf_log (this->name, GF_LOG_DEBUG, " Matching lock found for unlock"); __destroy_inode_lock (lock); @@ -246,7 +246,7 @@ out: } static void -__grant_blocked_inode_locks (pl_inode_t *pl_inode, pl_dom_list_t *dom) +__grant_blocked_inode_locks (xlator_t *this, pl_inode_t *pl_inode, pl_dom_list_t *dom) { int bl_ret = 0; pl_inode_lock_t *bl = NULL; @@ -259,10 +259,10 @@ __grant_blocked_inode_locks (pl_inode_t *pl_inode, pl_dom_list_t *dom) list_del_init (&bl->blocked_locks); - bl_ret = __lock_inodelk (pl_inode, bl, 1, dom); + bl_ret = __lock_inodelk (this, pl_inode, bl, 1, dom); if (bl_ret == 0) { - gf_log ("posix-locks", GF_LOG_TRACE, + gf_log (this->name, GF_LOG_TRACE, "%s (pid=%d) %"PRId64" - %"PRId64" => Granted", bl->fl_type == F_UNLCK ? "Unlock" : "Lock", bl->client_pid, @@ -277,7 +277,7 @@ __grant_blocked_inode_locks (pl_inode_t *pl_inode, pl_dom_list_t *dom) /* Grant all inodelks blocked on a lock */ void -grant_blocked_inode_locks (pl_inode_t *pl_inode, pl_inode_lock_t *lock, pl_dom_list_t *dom) +grant_blocked_inode_locks (xlator_t *this, pl_inode_t *pl_inode, pl_inode_lock_t *lock, pl_dom_list_t *dom) { if (list_empty (&dom->blocked_inodelks)) { @@ -285,7 +285,7 @@ grant_blocked_inode_locks (pl_inode_t *pl_inode, pl_inode_lock_t *lock, pl_dom_l } - __grant_blocked_inode_locks (pl_inode, dom); + __grant_blocked_inode_locks (this, pl_inode, dom); __destroy_inode_lock (lock); } @@ -320,7 +320,7 @@ release_inode_locks_of_transport (xlator_t *this, pl_dom_list_t *dom, list_del_init (&l->list); - grant_blocked_inode_locks (pinode, l, dom); + grant_blocked_inode_locks (this, pinode, l, dom); __delete_inode_lock (l); @@ -358,7 +358,7 @@ pl_inode_setlk (xlator_t *this, pl_inode_t *pl_inode, pl_inode_lock_t *lock, pthread_mutex_lock (&pl_inode->mutex); { if (lock->fl_type != F_UNLCK) { - ret = __lock_inodelk (pl_inode, lock, can_block, dom); + ret = __lock_inodelk (this, pl_inode, lock, can_block, dom); if (ret == 0) gf_log (this->name, GF_LOG_TRACE, "%s (pid=%d) %"PRId64" - %"PRId64" => OK", @@ -379,7 +379,7 @@ pl_inode_setlk (xlator_t *this, pl_inode_t *pl_inode, pl_inode_lock_t *lock, } - retlock = __inode_unlock_lock (lock, dom); + retlock = __inode_unlock_lock (this, lock, dom); if (!retlock) { gf_log (this->name, GF_LOG_DEBUG, "Bad Unlock issued on Inode lock"); @@ -395,7 +395,7 @@ pl_inode_setlk (xlator_t *this, pl_inode_t *pl_inode, pl_inode_lock_t *lock, lock->user_flock.l_len); ret = 0; - grant_blocked_inode_locks (pl_inode, retlock, dom); + grant_blocked_inode_locks (this, pl_inode, retlock, dom); } out: pthread_mutex_unlock (&pl_inode->mutex); diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c index e7e4ba300d9..605902641d4 100644 --- a/xlators/features/locks/src/posix.c +++ b/xlators/features/locks/src/posix.c @@ -742,7 +742,7 @@ pl_forget (xlator_t *this, list_for_each_entry_safe (ino_l, ino_tmp, &dom->inodelk_list, list) { __delete_inode_lock (ino_l); - grant_blocked_inode_locks (pl_inode, ino_l, dom); + grant_blocked_inode_locks (this, pl_inode, ino_l, dom); } } -- cgit