nilfs2: reduce bare use of printk() with nilfs_msg()
[linux-block.git] / fs / nilfs2 / segment.c
index e78b68a81aec15824d0129528e7284f773fa19a4..1cc968502e53ac7e4b8c2ca90dc7d8ec5beb5a61 100644 (file)
@@ -150,7 +150,8 @@ static void nilfs_dispose_list(struct the_nilfs *, struct list_head *, int);
 #define nilfs_cnt32_lt(a, b)  nilfs_cnt32_gt(b, a)
 #define nilfs_cnt32_le(a, b)  nilfs_cnt32_ge(b, a)
 
-static int nilfs_prepare_segment_lock(struct nilfs_transaction_info *ti)
+static int nilfs_prepare_segment_lock(struct super_block *sb,
+                                     struct nilfs_transaction_info *ti)
 {
        struct nilfs_transaction_info *cur_ti = current->journal_info;
        void *save = NULL;
@@ -164,8 +165,7 @@ static int nilfs_prepare_segment_lock(struct nilfs_transaction_info *ti)
                 * it is saved and will be restored on
                 * nilfs_transaction_commit().
                 */
-               printk(KERN_WARNING
-                      "NILFS warning: journal info from a different FS\n");
+               nilfs_msg(sb, KERN_WARNING, "journal info from a different FS");
                save = current->journal_info;
        }
        if (!ti) {
@@ -215,7 +215,7 @@ int nilfs_transaction_begin(struct super_block *sb,
                            int vacancy_check)
 {
        struct the_nilfs *nilfs;
-       int ret = nilfs_prepare_segment_lock(ti);
+       int ret = nilfs_prepare_segment_lock(sb, ti);
        struct nilfs_transaction_info *trace_ti;
 
        if (unlikely(ret < 0))
@@ -2467,9 +2467,9 @@ int nilfs_clean_segments(struct super_block *sb, struct nilfs_argv *argv,
                int ret = nilfs_discard_segments(nilfs, sci->sc_freesegs,
                                                 sci->sc_nfreesegs);
                if (ret) {
-                       printk(KERN_WARNING
-                              "NILFS warning: error %d on discard request, "
-                              "turning discards off for the device\n", ret);
+                       nilfs_msg(sb, KERN_WARNING,
+                                 "error %d on discard request, turning discards off for the device",
+                                 ret);
                        nilfs_clear_opt(nilfs, DISCARD);
                }
        }
@@ -2551,10 +2551,9 @@ static int nilfs_segctor_thread(void *arg)
        /* start sync. */
        sci->sc_task = current;
        wake_up(&sci->sc_wait_task); /* for nilfs_segctor_start_thread() */
-       printk(KERN_INFO
-              "segctord starting. Construction interval = %lu seconds, "
-              "CP frequency < %lu seconds\n",
-              sci->sc_interval / HZ, sci->sc_mjcp_freq / HZ);
+       nilfs_msg(sci->sc_super, KERN_INFO,
+                 "segctord starting. Construction interval = %lu seconds, CP frequency < %lu seconds",
+                 sci->sc_interval / HZ, sci->sc_mjcp_freq / HZ);
 
        spin_lock(&sci->sc_state_lock);
  loop:
@@ -2628,8 +2627,8 @@ static int nilfs_segctor_start_thread(struct nilfs_sc_info *sci)
        if (IS_ERR(t)) {
                int err = PTR_ERR(t);
 
-               printk(KERN_ERR "NILFS: error %d creating segctord thread\n",
-                      err);
+               nilfs_msg(sci->sc_super, KERN_ERR,
+                         "error %d creating segctord thread", err);
                return err;
        }
        wait_event(sci->sc_wait_task, sci->sc_task != NULL);