ceph: print r_direct_hash in hex in __choose_mds() dout
authorXiubo Li <xiubli@redhat.com>
Thu, 2 Jan 2020 03:09:37 +0000 (22:09 -0500)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 27 Jan 2020 15:53:40 +0000 (16:53 +0100)
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 checkpatch
warning.

Signed-off-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/mds_client.c

index c839664..011c779 100644 (file)
@@ -900,7 +900,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;
        }
@@ -918,7 +918,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 */
@@ -938,7 +938,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);
@@ -954,8 +954,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);
@@ -973,11 +973,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))
@@ -990,9 +988,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 &&
@@ -1017,7 +1015,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);
@@ -1032,7 +1030,7 @@ random:
                *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;
 }