Merge tag 'ceph-for-6.7-rc1' of https://github.com/ceph/ceph-client
[linux-2.6-microblaze.git] / fs / ceph / snap.c
index 6732e1e..c65f2b2 100644 (file)
@@ -138,7 +138,7 @@ static struct ceph_snap_realm *ceph_create_snap_realm(
        __insert_snap_realm(&mdsc->snap_realms, realm);
        mdsc->num_snap_realms++;
 
-       dout("%s %llx %p\n", __func__, realm->ino, realm);
+       doutc(mdsc->fsc->client, "%llx %p\n", realm->ino, realm);
        return realm;
 }
 
@@ -150,6 +150,7 @@ static struct ceph_snap_realm *ceph_create_snap_realm(
 static struct ceph_snap_realm *__lookup_snap_realm(struct ceph_mds_client *mdsc,
                                                   u64 ino)
 {
+       struct ceph_client *cl = mdsc->fsc->client;
        struct rb_node *n = mdsc->snap_realms.rb_node;
        struct ceph_snap_realm *r;
 
@@ -162,7 +163,7 @@ static struct ceph_snap_realm *__lookup_snap_realm(struct ceph_mds_client *mdsc,
                else if (ino > r->ino)
                        n = n->rb_right;
                else {
-                       dout("%s %llx %p\n", __func__, r->ino, r);
+                       doutc(cl, "%llx %p\n", r->ino, r);
                        return r;
                }
        }
@@ -188,9 +189,10 @@ static void __put_snap_realm(struct ceph_mds_client *mdsc,
 static void __destroy_snap_realm(struct ceph_mds_client *mdsc,
                                 struct ceph_snap_realm *realm)
 {
+       struct ceph_client *cl = mdsc->fsc->client;
        lockdep_assert_held_write(&mdsc->snap_rwsem);
 
-       dout("%s %p %llx\n", __func__, realm, realm->ino);
+       doutc(cl, "%p %llx\n", realm, realm->ino);
 
        rb_erase(&realm->node, &mdsc->snap_realms);
        mdsc->num_snap_realms--;
@@ -290,6 +292,7 @@ static int adjust_snap_realm_parent(struct ceph_mds_client *mdsc,
                                    struct ceph_snap_realm *realm,
                                    u64 parentino)
 {
+       struct ceph_client *cl = mdsc->fsc->client;
        struct ceph_snap_realm *parent;
 
        lockdep_assert_held_write(&mdsc->snap_rwsem);
@@ -303,8 +306,8 @@ static int adjust_snap_realm_parent(struct ceph_mds_client *mdsc,
                if (IS_ERR(parent))
                        return PTR_ERR(parent);
        }
-       dout("%s %llx %p: %llx %p -> %llx %p\n", __func__, realm->ino,
-            realm, realm->parent_ino, realm->parent, parentino, parent);
+       doutc(cl, "%llx %p: %llx %p -> %llx %p\n", realm->ino, realm,
+             realm->parent_ino, realm->parent, parentino, parent);
        if (realm->parent) {
                list_del_init(&realm->child_item);
                ceph_put_snap_realm(mdsc, realm->parent);
@@ -329,10 +332,12 @@ static int cmpu64_rev(const void *a, const void *b)
 /*
  * build the snap context for a given realm.
  */
-static int build_snap_context(struct ceph_snap_realm *realm,
+static int build_snap_context(struct ceph_mds_client *mdsc,
+                             struct ceph_snap_realm *realm,
                              struct list_head *realm_queue,
                              struct list_head *dirty_realms)
 {
+       struct ceph_client *cl = mdsc->fsc->client;
        struct ceph_snap_realm *parent = realm->parent;
        struct ceph_snap_context *snapc;
        int err = 0;
@@ -360,10 +365,10 @@ static int build_snap_context(struct ceph_snap_realm *realm,
            realm->cached_context->seq == realm->seq &&
            (!parent ||
             realm->cached_context->seq >= parent->cached_context->seq)) {
-               dout("%s %llx %p: %p seq %lld (%u snaps) (unchanged)\n",
-                    __func__, realm->ino, realm, realm->cached_context,
-                    realm->cached_context->seq,
-                    (unsigned int)realm->cached_context->num_snaps);
+               doutc(cl, "%llx %p: %p seq %lld (%u snaps) (unchanged)\n",
+                     realm->ino, realm, realm->cached_context,
+                     realm->cached_context->seq,
+                     (unsigned int)realm->cached_context->num_snaps);
                return 0;
        }
 
@@ -400,8 +405,8 @@ static int build_snap_context(struct ceph_snap_realm *realm,
 
        sort(snapc->snaps, num, sizeof(u64), cmpu64_rev, NULL);
        snapc->num_snaps = num;
-       dout("%s %llx %p: %p seq %lld (%u snaps)\n", __func__, realm->ino,
-            realm, snapc, snapc->seq, (unsigned int) snapc->num_snaps);
+       doutc(cl, "%llx %p: %p seq %lld (%u snaps)\n", realm->ino, realm,
+             snapc, snapc->seq, (unsigned int) snapc->num_snaps);
 
        ceph_put_snap_context(realm->cached_context);
        realm->cached_context = snapc;
@@ -418,16 +423,18 @@ fail:
                ceph_put_snap_context(realm->cached_context);
                realm->cached_context = NULL;
        }
-       pr_err("%s %llx %p fail %d\n", __func__, realm->ino, realm, err);
+       pr_err_client(cl, "%llx %p fail %d\n", realm->ino, realm, err);
        return err;
 }
 
 /*
  * rebuild snap context for the given realm and all of its children.
  */
-static void rebuild_snap_realms(struct ceph_snap_realm *realm,
+static void rebuild_snap_realms(struct ceph_mds_client *mdsc,
+                               struct ceph_snap_realm *realm,
                                struct list_head *dirty_realms)
 {
+       struct ceph_client *cl = mdsc->fsc->client;
        LIST_HEAD(realm_queue);
        int last = 0;
        bool skip = false;
@@ -451,9 +458,10 @@ static void rebuild_snap_realms(struct ceph_snap_realm *realm,
                        continue;
                }
 
-               last = build_snap_context(_realm, &realm_queue, dirty_realms);
-               dout("%s %llx %p, %s\n", __func__, _realm->ino, _realm,
-                    last > 0 ? "is deferred" : !last ? "succeeded" : "failed");
+               last = build_snap_context(mdsc, _realm, &realm_queue,
+                                         dirty_realms);
+               doutc(cl, "%llx %p, %s\n", realm->ino, realm,
+                     last > 0 ? "is deferred" : !last ? "succeeded" : "failed");
 
                /* is any child in the list ? */
                list_for_each_entry(child, &_realm->children, child_item) {
@@ -523,6 +531,7 @@ static void ceph_queue_cap_snap(struct ceph_inode_info *ci,
                                struct ceph_cap_snap **pcapsnap)
 {
        struct inode *inode = &ci->netfs.inode;
+       struct ceph_client *cl = ceph_inode_to_client(inode);
        struct ceph_snap_context *old_snapc, *new_snapc;
        struct ceph_cap_snap *capsnap = *pcapsnap;
        struct ceph_buffer *old_blob = NULL;
@@ -548,14 +557,14 @@ static void ceph_queue_cap_snap(struct ceph_inode_info *ci,
                   as no new writes are allowed to start when pending, so any
                   writes in progress now were started before the previous
                   cap_snap.  lucky us. */
-               dout("%s %p %llx.%llx already pending\n",
-                    __func__, inode, ceph_vinop(inode));
+               doutc(cl, "%p %llx.%llx already pending\n", inode,
+                     ceph_vinop(inode));
                goto update_snapc;
        }
        if (ci->i_wrbuffer_ref_head == 0 &&
            !(dirty & (CEPH_CAP_ANY_EXCL|CEPH_CAP_FILE_WR))) {
-               dout("%s %p %llx.%llx nothing dirty|writing\n",
-                    __func__, inode, ceph_vinop(inode));
+               doutc(cl, "%p %llx.%llx nothing dirty|writing\n", inode,
+                     ceph_vinop(inode));
                goto update_snapc;
        }
 
@@ -575,15 +584,15 @@ static void ceph_queue_cap_snap(struct ceph_inode_info *ci,
        } else {
                if (!(used & CEPH_CAP_FILE_WR) &&
                    ci->i_wrbuffer_ref_head == 0) {
-                       dout("%s %p %llx.%llx no new_snap|dirty_page|writing\n",
-                            __func__, inode, ceph_vinop(inode));
+                       doutc(cl, "%p %llx.%llx no new_snap|dirty_page|writing\n",
+                             inode, ceph_vinop(inode));
                        goto update_snapc;
                }
        }
 
-       dout("%s %p %llx.%llx cap_snap %p queuing under %p %s %s\n",
-            __func__, inode, ceph_vinop(inode), capsnap, old_snapc,
-            ceph_cap_string(dirty), capsnap->need_flush ? "" : "no_flush");
+       doutc(cl, "%p %llx.%llx cap_snap %p queuing under %p %s %s\n",
+             inode, ceph_vinop(inode), capsnap, old_snapc,
+             ceph_cap_string(dirty), capsnap->need_flush ? "" : "no_flush");
        ihold(inode);
 
        capsnap->follows = old_snapc->seq;
@@ -615,9 +624,9 @@ static void ceph_queue_cap_snap(struct ceph_inode_info *ci,
        list_add_tail(&capsnap->ci_item, &ci->i_cap_snaps);
 
        if (used & CEPH_CAP_FILE_WR) {
-               dout("%s %p %llx.%llx cap_snap %p snapc %p seq %llu used WR,"
-                    " now pending\n", __func__, inode, ceph_vinop(inode),
-                    capsnap, old_snapc, old_snapc->seq);
+               doutc(cl, "%p %llx.%llx cap_snap %p snapc %p seq %llu used WR,"
+                     " now pending\n", inode, ceph_vinop(inode), capsnap,
+                     old_snapc, old_snapc->seq);
                capsnap->writing = 1;
        } else {
                /* note mtime, size NOW. */
@@ -634,7 +643,7 @@ update_snapc:
                ci->i_head_snapc = NULL;
        } else {
                ci->i_head_snapc = ceph_get_snap_context(new_snapc);
-               dout(" new snapc is %p\n", new_snapc);
+               doutc(cl, " new snapc is %p\n", new_snapc);
        }
        spin_unlock(&ci->i_ceph_lock);
 
@@ -655,6 +664,7 @@ int __ceph_finish_cap_snap(struct ceph_inode_info *ci,
 {
        struct inode *inode = &ci->netfs.inode;
        struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(inode->i_sb);
+       struct ceph_client *cl = mdsc->fsc->client;
 
        BUG_ON(capsnap->writing);
        capsnap->size = i_size_read(inode);
@@ -667,11 +677,12 @@ int __ceph_finish_cap_snap(struct ceph_inode_info *ci,
        capsnap->truncate_size = ci->i_truncate_size;
        capsnap->truncate_seq = ci->i_truncate_seq;
        if (capsnap->dirty_pages) {
-               dout("%s %p %llx.%llx cap_snap %p snapc %p %llu %s s=%llu "
-                    "still has %d dirty pages\n", __func__, inode,
-                    ceph_vinop(inode), capsnap, capsnap->context,
-                    capsnap->context->seq, ceph_cap_string(capsnap->dirty),
-                    capsnap->size, capsnap->dirty_pages);
+               doutc(cl, "%p %llx.%llx cap_snap %p snapc %p %llu %s "
+                     "s=%llu still has %d dirty pages\n", inode,
+                     ceph_vinop(inode), capsnap, capsnap->context,
+                     capsnap->context->seq,
+                     ceph_cap_string(capsnap->dirty),
+                     capsnap->size, capsnap->dirty_pages);
                return 0;
        }
 
@@ -680,20 +691,20 @@ int __ceph_finish_cap_snap(struct ceph_inode_info *ci,
         * And trigger to flush the buffer immediately.
         */
        if (ci->i_wrbuffer_ref) {
-               dout("%s %p %llx.%llx cap_snap %p snapc %p %llu %s s=%llu "
-                    "used WRBUFFER, delaying\n", __func__, inode,
-                    ceph_vinop(inode), capsnap, capsnap->context,
-                    capsnap->context->seq, ceph_cap_string(capsnap->dirty),
-                    capsnap->size);
+               doutc(cl, "%p %llx.%llx cap_snap %p snapc %p %llu %s "
+                     "s=%llu used WRBUFFER, delaying\n", inode,
+                     ceph_vinop(inode), capsnap, capsnap->context,
+                     capsnap->context->seq, ceph_cap_string(capsnap->dirty),
+                     capsnap->size);
                ceph_queue_writeback(inode);
                return 0;
        }
 
        ci->i_ceph_flags |= CEPH_I_FLUSH_SNAPS;
-       dout("%s %p %llx.%llx cap_snap %p snapc %p %llu %s s=%llu\n",
-            __func__, inode, ceph_vinop(inode), capsnap, capsnap->context,
-            capsnap->context->seq, ceph_cap_string(capsnap->dirty),
-            capsnap->size);
+       doutc(cl, "%p %llx.%llx cap_snap %p snapc %p %llu %s s=%llu\n",
+             inode, ceph_vinop(inode), capsnap, capsnap->context,
+             capsnap->context->seq, ceph_cap_string(capsnap->dirty),
+             capsnap->size);
 
        spin_lock(&mdsc->snap_flush_lock);
        if (list_empty(&ci->i_snap_flush_item)) {
@@ -708,13 +719,15 @@ int __ceph_finish_cap_snap(struct ceph_inode_info *ci,
  * Queue cap_snaps for snap writeback for this realm and its children.
  * Called under snap_rwsem, so realm topology won't change.
  */
-static void queue_realm_cap_snaps(struct ceph_snap_realm *realm)
+static void queue_realm_cap_snaps(struct ceph_mds_client *mdsc,
+                                 struct ceph_snap_realm *realm)
 {
+       struct ceph_client *cl = mdsc->fsc->client;
        struct ceph_inode_info *ci;
        struct inode *lastinode = NULL;
        struct ceph_cap_snap *capsnap = NULL;
 
-       dout("%s %p %llx inode\n", __func__, realm, realm->ino);
+       doutc(cl, "%p %llx inode\n", realm, realm->ino);
 
        spin_lock(&realm->inodes_with_caps_lock);
        list_for_each_entry(ci, &realm->inodes_with_caps, i_snap_realm_item) {
@@ -733,8 +746,9 @@ static void queue_realm_cap_snaps(struct ceph_snap_realm *realm)
                if (!capsnap) {
                        capsnap = kmem_cache_zalloc(ceph_cap_snap_cachep, GFP_NOFS);
                        if (!capsnap) {
-                               pr_err("ENOMEM allocating ceph_cap_snap on %p\n",
-                                      inode);
+                               pr_err_client(cl,
+                                       "ENOMEM allocating ceph_cap_snap on %p\n",
+                                       inode);
                                return;
                        }
                }
@@ -752,7 +766,7 @@ static void queue_realm_cap_snaps(struct ceph_snap_realm *realm)
 
        if (capsnap)
                kmem_cache_free(ceph_cap_snap_cachep, capsnap);
-       dout("%s %p %llx done\n", __func__, realm, realm->ino);
+       doutc(cl, "%p %llx done\n", realm, realm->ino);
 }
 
 /*
@@ -766,6 +780,7 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc,
                           void *p, void *e, bool deletion,
                           struct ceph_snap_realm **realm_ret)
 {
+       struct ceph_client *cl = mdsc->fsc->client;
        struct ceph_mds_snap_realm *ri;    /* encoded */
        __le64 *snaps;                     /* encoded */
        __le64 *prior_parent_snaps;        /* encoded */
@@ -780,7 +795,7 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc,
 
        lockdep_assert_held_write(&mdsc->snap_rwsem);
 
-       dout("%s deletion=%d\n", __func__, deletion);
+       doutc(cl, "deletion=%d\n", deletion);
 more:
        realm = NULL;
        rebuild_snapcs = 0;
@@ -810,8 +825,8 @@ more:
        rebuild_snapcs += err;
 
        if (le64_to_cpu(ri->seq) > realm->seq) {
-               dout("%s updating %llx %p %lld -> %lld\n", __func__,
-                    realm->ino, realm, realm->seq, le64_to_cpu(ri->seq));
+               doutc(cl, "updating %llx %p %lld -> %lld\n", realm->ino,
+                     realm, realm->seq, le64_to_cpu(ri->seq));
                /* update realm parameters, snap lists */
                realm->seq = le64_to_cpu(ri->seq);
                realm->created = le64_to_cpu(ri->created);
@@ -834,16 +849,16 @@ more:
 
                rebuild_snapcs = 1;
        } else if (!realm->cached_context) {
-               dout("%s %llx %p seq %lld new\n", __func__,
-                    realm->ino, realm, realm->seq);
+               doutc(cl, "%llx %p seq %lld new\n", realm->ino, realm,
+                     realm->seq);
                rebuild_snapcs = 1;
        } else {
-               dout("%s %llx %p seq %lld unchanged\n", __func__,
-                    realm->ino, realm, realm->seq);
+               doutc(cl, "%llx %p seq %lld unchanged\n", realm->ino, realm,
+                     realm->seq);
        }
 
-       dout("done with %llx %p, rebuild_snapcs=%d, %p %p\n", realm->ino,
-            realm, rebuild_snapcs, p, e);
+       doutc(cl, "done with %llx %p, rebuild_snapcs=%d, %p %p\n", realm->ino,
+             realm, rebuild_snapcs, p, e);
 
        /*
         * this will always track the uppest parent realm from which
@@ -855,7 +870,7 @@ more:
 
        /* rebuild_snapcs when we reach the _end_ (root) of the trace */
        if (realm_to_rebuild && p >= e)
-               rebuild_snap_realms(realm_to_rebuild, &dirty_realms);
+               rebuild_snap_realms(mdsc, realm_to_rebuild, &dirty_realms);
 
        if (!first_realm)
                first_realm = realm;
@@ -873,7 +888,7 @@ more:
                realm = list_first_entry(&dirty_realms, struct ceph_snap_realm,
                                         dirty_item);
                list_del_init(&realm->dirty_item);
-               queue_realm_cap_snaps(realm);
+               queue_realm_cap_snaps(mdsc, realm);
        }
 
        if (realm_ret)
@@ -891,7 +906,7 @@ fail:
                ceph_put_snap_realm(mdsc, realm);
        if (first_realm)
                ceph_put_snap_realm(mdsc, first_realm);
-       pr_err("%s error %d\n", __func__, err);
+       pr_err_client(cl, "error %d\n", err);
 
        /*
         * When receiving a corrupted snap trace we don't know what
@@ -905,11 +920,12 @@ fail:
        WRITE_ONCE(mdsc->fsc->mount_state, CEPH_MOUNT_FENCE_IO);
        ret = ceph_monc_blocklist_add(&client->monc, &client->msgr.inst.addr);
        if (ret)
-               pr_err("%s failed to blocklist %s: %d\n", __func__,
-                      ceph_pr_addr(&client->msgr.inst.addr), ret);
+               pr_err_client(cl, "failed to blocklist %s: %d\n",
+                             ceph_pr_addr(&client->msgr.inst.addr), ret);
 
-       WARN(1, "%s: %s%sdo remount to continue%s",
-            __func__, ret ? "" : ceph_pr_addr(&client->msgr.inst.addr),
+       WARN(1, "[client.%lld] %s %s%sdo remount to continue%s",
+            client->monc.auth->global_id, __func__,
+            ret ? "" : ceph_pr_addr(&client->msgr.inst.addr),
             ret ? "" : " was blocklisted, ",
             err == -EIO ? " after corrupted snaptrace is fixed" : "");
 
@@ -925,11 +941,12 @@ fail:
  */
 static void flush_snaps(struct ceph_mds_client *mdsc)
 {
+       struct ceph_client *cl = mdsc->fsc->client;
        struct ceph_inode_info *ci;
        struct inode *inode;
        struct ceph_mds_session *session = NULL;
 
-       dout("%s\n", __func__);
+       doutc(cl, "begin\n");
        spin_lock(&mdsc->snap_flush_lock);
        while (!list_empty(&mdsc->snap_flush_list)) {
                ci = list_first_entry(&mdsc->snap_flush_list,
@@ -944,7 +961,7 @@ static void flush_snaps(struct ceph_mds_client *mdsc)
        spin_unlock(&mdsc->snap_flush_lock);
 
        ceph_put_mds_session(session);
-       dout("%s done\n", __func__);
+       doutc(cl, "done\n");
 }
 
 /**
@@ -960,7 +977,7 @@ static void flush_snaps(struct ceph_mds_client *mdsc)
 void ceph_change_snap_realm(struct inode *inode, struct ceph_snap_realm *realm)
 {
        struct ceph_inode_info *ci = ceph_inode(inode);
-       struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
+       struct ceph_mds_client *mdsc = ceph_inode_to_fs_client(inode)->mdsc;
        struct ceph_snap_realm *oldrealm = ci->i_snap_realm;
 
        lockdep_assert_held(&ci->i_ceph_lock);
@@ -1000,6 +1017,7 @@ void ceph_handle_snap(struct ceph_mds_client *mdsc,
                      struct ceph_mds_session *session,
                      struct ceph_msg *msg)
 {
+       struct ceph_client *cl = mdsc->fsc->client;
        struct super_block *sb = mdsc->fsc->sb;
        int mds = session->s_mds;
        u64 split;
@@ -1030,8 +1048,8 @@ void ceph_handle_snap(struct ceph_mds_client *mdsc,
        trace_len = le32_to_cpu(h->trace_len);
        p += sizeof(*h);
 
-       dout("%s from mds%d op %s split %llx tracelen %d\n", __func__,
-            mds, ceph_snap_op_name(op), split, trace_len);
+       doutc(cl, "from mds%d op %s split %llx tracelen %d\n", mds,
+             ceph_snap_op_name(op), split, trace_len);
 
        down_write(&mdsc->snap_rwsem);
        locked_rwsem = 1;
@@ -1062,7 +1080,7 @@ void ceph_handle_snap(struct ceph_mds_client *mdsc,
                                goto out;
                }
 
-               dout("splitting snap_realm %llx %p\n", realm->ino, realm);
+               doutc(cl, "splitting snap_realm %llx %p\n", realm->ino, realm);
                for (i = 0; i < num_split_inos; i++) {
                        struct ceph_vino vino = {
                                .ino = le64_to_cpu(split_inos[i]),
@@ -1087,13 +1105,13 @@ void ceph_handle_snap(struct ceph_mds_client *mdsc,
                         */
                        if (ci->i_snap_realm->created >
                            le64_to_cpu(ri->created)) {
-                               dout(" leaving %p %llx.%llx in newer realm %llx %p\n",
-                                    inode, ceph_vinop(inode), ci->i_snap_realm->ino,
-                                    ci->i_snap_realm);
+                               doutc(cl, " leaving %p %llx.%llx in newer realm %llx %p\n",
+                                     inode, ceph_vinop(inode), ci->i_snap_realm->ino,
+                                     ci->i_snap_realm);
                                goto skip_inode;
                        }
-                       dout(" will move %p %llx.%llx to split realm %llx %p\n",
-                            inode, ceph_vinop(inode), realm->ino, realm);
+                       doutc(cl, " will move %p %llx.%llx to split realm %llx %p\n",
+                             inode, ceph_vinop(inode), realm->ino, realm);
 
                        ceph_get_snap_realm(mdsc, realm);
                        ceph_change_snap_realm(inode, realm);
@@ -1154,7 +1172,7 @@ skip_inode:
        return;
 
 bad:
-       pr_err("%s corrupt snap message from mds%d\n", __func__, mds);
+       pr_err_client(cl, "corrupt snap message from mds%d\n", mds);
        ceph_msg_dump(msg);
 out:
        if (locked_rwsem)
@@ -1170,6 +1188,7 @@ out:
 struct ceph_snapid_map* ceph_get_snapid_map(struct ceph_mds_client *mdsc,
                                            u64 snap)
 {
+       struct ceph_client *cl = mdsc->fsc->client;
        struct ceph_snapid_map *sm, *exist;
        struct rb_node **p, *parent;
        int ret;
@@ -1192,8 +1211,8 @@ struct ceph_snapid_map* ceph_get_snapid_map(struct ceph_mds_client *mdsc,
        }
        spin_unlock(&mdsc->snapid_map_lock);
        if (exist) {
-               dout("%s found snapid map %llx -> %x\n", __func__,
-                    exist->snap, exist->dev);
+               doutc(cl, "found snapid map %llx -> %x\n", exist->snap,
+                     exist->dev);
                return exist;
        }
 
@@ -1237,13 +1256,12 @@ struct ceph_snapid_map* ceph_get_snapid_map(struct ceph_mds_client *mdsc,
        if (exist) {
                free_anon_bdev(sm->dev);
                kfree(sm);
-               dout("%s found snapid map %llx -> %x\n", __func__,
-                    exist->snap, exist->dev);
+               doutc(cl, "found snapid map %llx -> %x\n", exist->snap,
+                     exist->dev);
                return exist;
        }
 
-       dout("%s create snapid map %llx -> %x\n", __func__,
-            sm->snap, sm->dev);
+       doutc(cl, "create snapid map %llx -> %x\n", sm->snap, sm->dev);
        return sm;
 }
 
@@ -1268,6 +1286,7 @@ void ceph_put_snapid_map(struct ceph_mds_client* mdsc,
 
 void ceph_trim_snapid_map(struct ceph_mds_client *mdsc)
 {
+       struct ceph_client *cl = mdsc->fsc->client;
        struct ceph_snapid_map *sm;
        unsigned long now;
        LIST_HEAD(to_free);
@@ -1289,7 +1308,7 @@ void ceph_trim_snapid_map(struct ceph_mds_client *mdsc)
        while (!list_empty(&to_free)) {
                sm = list_first_entry(&to_free, struct ceph_snapid_map, lru);
                list_del(&sm->lru);
-               dout("trim snapid map %llx -> %x\n", sm->snap, sm->dev);
+               doutc(cl, "trim snapid map %llx -> %x\n", sm->snap, sm->dev);
                free_anon_bdev(sm->dev);
                kfree(sm);
        }
@@ -1297,6 +1316,7 @@ void ceph_trim_snapid_map(struct ceph_mds_client *mdsc)
 
 void ceph_cleanup_snapid_map(struct ceph_mds_client *mdsc)
 {
+       struct ceph_client *cl = mdsc->fsc->client;
        struct ceph_snapid_map *sm;
        struct rb_node *p;
        LIST_HEAD(to_free);
@@ -1315,8 +1335,8 @@ void ceph_cleanup_snapid_map(struct ceph_mds_client *mdsc)
                list_del(&sm->lru);
                free_anon_bdev(sm->dev);
                if (WARN_ON_ONCE(atomic_read(&sm->ref))) {
-                       pr_err("snapid map %llx -> %x still in use\n",
-                              sm->snap, sm->dev);
+                       pr_err_client(cl, "snapid map %llx -> %x still in use\n",
+                                     sm->snap, sm->dev);
                }
                kfree(sm);
        }