ceph: dout switches to hex format for the 'hash'
diff mbox series

Message ID 20200102030937.59546-1-xiubli@redhat.com
State New
Headers show
Series
  • ceph: dout switches to hex format for the 'hash'
Related show

Commit Message

Xiubo Li Jan. 2, 2020, 3:09 a.m. UTC
From: Xiubo Li <xiubli@redhat.com>

It's hard to read especially when it is:

ceph:  __choose_mds 00000000b7bc9c15 is_hash=1 (-271041095) mode 0

At the same time switch to __func__ to get rid of the check patch
warning.

Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
 fs/ceph/mds_client.c | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

Comments

Yan, Zheng Jan. 2, 2020, 3:36 a.m. UTC | #1
On 1/2/20 11:09 AM, xiubli@redhat.com wrote:
> From: Xiubo Li <xiubli@redhat.com>
> 
> It's hard to read especially when it is:
> 
> ceph:  __choose_mds 00000000b7bc9c15 is_hash=1 (-271041095) mode 0
> 
> At the same time switch to __func__ to get rid of the check patch
> warning.
> 
> Signed-off-by: Xiubo Li <xiubli@redhat.com>
> ---
>   fs/ceph/mds_client.c | 28 +++++++++++++---------------
>   1 file changed, 13 insertions(+), 15 deletions(-)
> 
> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> index e209eb9f2efb..b2f3d62f6a78 100644
> --- a/fs/ceph/mds_client.c
> +++ b/fs/ceph/mds_client.c
> @@ -911,7 +911,7 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
>   	if (req->r_resend_mds >= 0 &&
>   	    (__have_session(mdsc, req->r_resend_mds) ||
>   	     ceph_mdsmap_get_state(mdsc->mdsmap, req->r_resend_mds) > 0)) {
> -		dout("choose_mds using resend_mds mds%d\n",
> +		dout("%s using resend_mds mds%d\n", __func__,
>   		     req->r_resend_mds);
>   		return req->r_resend_mds;
>   	}
> @@ -929,7 +929,7 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
>   			rcu_read_lock();
>   			inode = get_nonsnap_parent(req->r_dentry);
>   			rcu_read_unlock();
> -			dout("__choose_mds using snapdir's parent %p\n", inode);
> +			dout("%s using snapdir's parent %p\n", __func__, inode);
>   		}
>   	} else if (req->r_dentry) {
>   		/* ignore race with rename; old or new d_parent is okay */
> @@ -949,7 +949,7 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
>   			/* direct snapped/virtual snapdir requests
>   			 * based on parent dir inode */
>   			inode = get_nonsnap_parent(parent);
> -			dout("__choose_mds using nonsnap parent %p\n", inode);
> +			dout("%s using nonsnap parent %p\n", __func__, inode);
>   		} else {
>   			/* dentry target */
>   			inode = d_inode(req->r_dentry);
> @@ -965,8 +965,8 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
>   		rcu_read_unlock();
>   	}
>   
> -	dout("__choose_mds %p is_hash=%d (%d) mode %d\n", inode, (int)is_hash,
> -	     (int)hash, mode);
> +	dout("%s %p is_hash=%d (0x%x) mode %d\n", __func__, inode, (int)is_hash,
> +	     hash, mode);
>   	if (!inode)
>   		goto random;
>   	ci = ceph_inode(inode);
> @@ -984,11 +984,9 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
>   				get_random_bytes(&r, 1);
>   				r %= frag.ndist;
>   				mds = frag.dist[r];
> -				dout("choose_mds %p %llx.%llx "
> -				     "frag %u mds%d (%d/%d)\n",
> -				     inode, ceph_vinop(inode),
> -				     frag.frag, mds,
> -				     (int)r, frag.ndist);
> +				dout("%s %p %llx.%llx frag %u mds%d (%d/%d)\n",
> +				     __func__, inode, ceph_vinop(inode),
> +				     frag.frag, mds, (int)r, frag.ndist);
>   				if (ceph_mdsmap_get_state(mdsc->mdsmap, mds) >=
>   				    CEPH_MDS_STATE_ACTIVE &&
>   				    !ceph_mdsmap_is_laggy(mdsc->mdsmap, mds))
> @@ -1001,9 +999,9 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
>   			if (frag.mds >= 0) {
>   				/* choose auth mds */
>   				mds = frag.mds;
> -				dout("choose_mds %p %llx.%llx "
> -				     "frag %u mds%d (auth)\n",
> -				     inode, ceph_vinop(inode), frag.frag, mds);
> +				dout("%s %p %llx.%llx frag %u mds%d (auth)\n",
> +				     __func__, inode, ceph_vinop(inode),
> +				     frag.frag, mds);
>   				if (ceph_mdsmap_get_state(mdsc->mdsmap, mds) >=
>   				    CEPH_MDS_STATE_ACTIVE) {
>   					if (mode == USE_ANY_MDS &&
> @@ -1028,7 +1026,7 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
>   		goto random;
>   	}
>   	mds = cap->session->s_mds;
> -	dout("choose_mds %p %llx.%llx mds%d (%scap %p)\n",
> +	dout("%s %p %llx.%llx mds%d (%scap %p)\n", __func__,
>   	     inode, ceph_vinop(inode), mds,
>   	     cap == ci->i_auth_cap ? "auth " : "", cap);
>   	spin_unlock(&ci->i_ceph_lock);
> @@ -1043,7 +1041,7 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
>   		*random = true;
>   
>   	mds = ceph_mdsmap_get_random_mds(mdsc->mdsmap);
> -	dout("choose_mds chose random mds%d\n", mds);
> +	dout("%s chose random mds%d\n", __func__, mds);
>   	return mds;
>   }
>   
> 

Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Jeff Layton Jan. 2, 2020, 11:57 a.m. UTC | #2
On Wed, 2020-01-01 at 22:09 -0500, xiubli@redhat.com wrote:
> From: Xiubo Li <xiubli@redhat.com>
> 
> It's hard to read especially when it is:
> 
> ceph:  __choose_mds 00000000b7bc9c15 is_hash=1 (-271041095) mode 0
> 
> At the same time switch to __func__ to get rid of the check patch
> warning.
> 
> Signed-off-by: Xiubo Li <xiubli@redhat.com>
> ---
>  fs/ceph/mds_client.c | 28 +++++++++++++---------------
>  1 file changed, 13 insertions(+), 15 deletions(-)
> 
> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> index e209eb9f2efb..b2f3d62f6a78 100644
> --- a/fs/ceph/mds_client.c
> +++ b/fs/ceph/mds_client.c
> @@ -911,7 +911,7 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
>  	if (req->r_resend_mds >= 0 &&
>  	    (__have_session(mdsc, req->r_resend_mds) ||
>  	     ceph_mdsmap_get_state(mdsc->mdsmap, req->r_resend_mds) > 0)) {
> -		dout("choose_mds using resend_mds mds%d\n",
> +		dout("%s using resend_mds mds%d\n", __func__,
>  		     req->r_resend_mds);
>  		return req->r_resend_mds;
>  	}
> @@ -929,7 +929,7 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
>  			rcu_read_lock();
>  			inode = get_nonsnap_parent(req->r_dentry);
>  			rcu_read_unlock();
> -			dout("__choose_mds using snapdir's parent %p\n", inode);
> +			dout("%s using snapdir's parent %p\n", __func__, inode);
>  		}
>  	} else if (req->r_dentry) {
>  		/* ignore race with rename; old or new d_parent is okay */
> @@ -949,7 +949,7 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
>  			/* direct snapped/virtual snapdir requests
>  			 * based on parent dir inode */
>  			inode = get_nonsnap_parent(parent);
> -			dout("__choose_mds using nonsnap parent %p\n", inode);
> +			dout("%s using nonsnap parent %p\n", __func__, inode);
>  		} else {
>  			/* dentry target */
>  			inode = d_inode(req->r_dentry);
> @@ -965,8 +965,8 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
>  		rcu_read_unlock();
>  	}
>  
> -	dout("__choose_mds %p is_hash=%d (%d) mode %d\n", inode, (int)is_hash,
> -	     (int)hash, mode);
> +	dout("%s %p is_hash=%d (0x%x) mode %d\n", __func__, inode, (int)is_hash,
> +	     hash, mode);
>  	if (!inode)
>  		goto random;
>  	ci = ceph_inode(inode);
> @@ -984,11 +984,9 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
>  				get_random_bytes(&r, 1);
>  				r %= frag.ndist;
>  				mds = frag.dist[r];
> -				dout("choose_mds %p %llx.%llx "
> -				     "frag %u mds%d (%d/%d)\n",
> -				     inode, ceph_vinop(inode),
> -				     frag.frag, mds,
> -				     (int)r, frag.ndist);
> +				dout("%s %p %llx.%llx frag %u mds%d (%d/%d)\n",
> +				     __func__, inode, ceph_vinop(inode),
> +				     frag.frag, mds, (int)r, frag.ndist);
>  				if (ceph_mdsmap_get_state(mdsc->mdsmap, mds) >=
>  				    CEPH_MDS_STATE_ACTIVE &&
>  				    !ceph_mdsmap_is_laggy(mdsc->mdsmap, mds))
> @@ -1001,9 +999,9 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
>  			if (frag.mds >= 0) {
>  				/* choose auth mds */
>  				mds = frag.mds;
> -				dout("choose_mds %p %llx.%llx "
> -				     "frag %u mds%d (auth)\n",
> -				     inode, ceph_vinop(inode), frag.frag, mds);
> +				dout("%s %p %llx.%llx frag %u mds%d (auth)\n",
> +				     __func__, inode, ceph_vinop(inode),
> +				     frag.frag, mds);
>  				if (ceph_mdsmap_get_state(mdsc->mdsmap, mds) >=
>  				    CEPH_MDS_STATE_ACTIVE) {
>  					if (mode == USE_ANY_MDS &&
> @@ -1028,7 +1026,7 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
>  		goto random;
>  	}
>  	mds = cap->session->s_mds;
> -	dout("choose_mds %p %llx.%llx mds%d (%scap %p)\n",
> +	dout("%s %p %llx.%llx mds%d (%scap %p)\n", __func__,
>  	     inode, ceph_vinop(inode), mds,
>  	     cap == ci->i_auth_cap ? "auth " : "", cap);
>  	spin_unlock(&ci->i_ceph_lock);
> @@ -1043,7 +1041,7 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
>  		*random = true;
>  
>  	mds = ceph_mdsmap_get_random_mds(mdsc->mdsmap);
> -	dout("choose_mds chose random mds%d\n", mds);
> +	dout("%s chose random mds%d\n", __func__, mds);
>  	return mds;
>  }
>  

Thanks! Merged with a slightly revised changelog.

Patch
diff mbox series

diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index e209eb9f2efb..b2f3d62f6a78 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -911,7 +911,7 @@  static int __choose_mds(struct ceph_mds_client *mdsc,
 	if (req->r_resend_mds >= 0 &&
 	    (__have_session(mdsc, req->r_resend_mds) ||
 	     ceph_mdsmap_get_state(mdsc->mdsmap, req->r_resend_mds) > 0)) {
-		dout("choose_mds using resend_mds mds%d\n",
+		dout("%s using resend_mds mds%d\n", __func__,
 		     req->r_resend_mds);
 		return req->r_resend_mds;
 	}
@@ -929,7 +929,7 @@  static int __choose_mds(struct ceph_mds_client *mdsc,
 			rcu_read_lock();
 			inode = get_nonsnap_parent(req->r_dentry);
 			rcu_read_unlock();
-			dout("__choose_mds using snapdir's parent %p\n", inode);
+			dout("%s using snapdir's parent %p\n", __func__, inode);
 		}
 	} else if (req->r_dentry) {
 		/* ignore race with rename; old or new d_parent is okay */
@@ -949,7 +949,7 @@  static int __choose_mds(struct ceph_mds_client *mdsc,
 			/* direct snapped/virtual snapdir requests
 			 * based on parent dir inode */
 			inode = get_nonsnap_parent(parent);
-			dout("__choose_mds using nonsnap parent %p\n", inode);
+			dout("%s using nonsnap parent %p\n", __func__, inode);
 		} else {
 			/* dentry target */
 			inode = d_inode(req->r_dentry);
@@ -965,8 +965,8 @@  static int __choose_mds(struct ceph_mds_client *mdsc,
 		rcu_read_unlock();
 	}
 
-	dout("__choose_mds %p is_hash=%d (%d) mode %d\n", inode, (int)is_hash,
-	     (int)hash, mode);
+	dout("%s %p is_hash=%d (0x%x) mode %d\n", __func__, inode, (int)is_hash,
+	     hash, mode);
 	if (!inode)
 		goto random;
 	ci = ceph_inode(inode);
@@ -984,11 +984,9 @@  static int __choose_mds(struct ceph_mds_client *mdsc,
 				get_random_bytes(&r, 1);
 				r %= frag.ndist;
 				mds = frag.dist[r];
-				dout("choose_mds %p %llx.%llx "
-				     "frag %u mds%d (%d/%d)\n",
-				     inode, ceph_vinop(inode),
-				     frag.frag, mds,
-				     (int)r, frag.ndist);
+				dout("%s %p %llx.%llx frag %u mds%d (%d/%d)\n",
+				     __func__, inode, ceph_vinop(inode),
+				     frag.frag, mds, (int)r, frag.ndist);
 				if (ceph_mdsmap_get_state(mdsc->mdsmap, mds) >=
 				    CEPH_MDS_STATE_ACTIVE &&
 				    !ceph_mdsmap_is_laggy(mdsc->mdsmap, mds))
@@ -1001,9 +999,9 @@  static int __choose_mds(struct ceph_mds_client *mdsc,
 			if (frag.mds >= 0) {
 				/* choose auth mds */
 				mds = frag.mds;
-				dout("choose_mds %p %llx.%llx "
-				     "frag %u mds%d (auth)\n",
-				     inode, ceph_vinop(inode), frag.frag, mds);
+				dout("%s %p %llx.%llx frag %u mds%d (auth)\n",
+				     __func__, inode, ceph_vinop(inode),
+				     frag.frag, mds);
 				if (ceph_mdsmap_get_state(mdsc->mdsmap, mds) >=
 				    CEPH_MDS_STATE_ACTIVE) {
 					if (mode == USE_ANY_MDS &&
@@ -1028,7 +1026,7 @@  static int __choose_mds(struct ceph_mds_client *mdsc,
 		goto random;
 	}
 	mds = cap->session->s_mds;
-	dout("choose_mds %p %llx.%llx mds%d (%scap %p)\n",
+	dout("%s %p %llx.%llx mds%d (%scap %p)\n", __func__,
 	     inode, ceph_vinop(inode), mds,
 	     cap == ci->i_auth_cap ? "auth " : "", cap);
 	spin_unlock(&ci->i_ceph_lock);
@@ -1043,7 +1041,7 @@  static int __choose_mds(struct ceph_mds_client *mdsc,
 		*random = true;
 
 	mds = ceph_mdsmap_get_random_mds(mdsc->mdsmap);
-	dout("choose_mds chose random mds%d\n", mds);
+	dout("%s chose random mds%d\n", __func__, mds);
 	return mds;
 }