/* Too bad, we had an error */
 
 Ebadsize:
-       nilfs_error(sb, "nilfs_check_page",
+       nilfs_error(sb,
                    "size of directory #%lu is not a multiple of chunk size",
-                   dir->i_ino
-       );
+                   dir->i_ino);
        goto fail;
 Eshort:
        error = "rec_len is smaller than minimal";
 Espan:
        error = "directory entry across blocks";
 bad_entry:
-       nilfs_error(sb, "nilfs_check_page", "bad entry in directory #%lu: %s - "
-                   "offset=%lu, inode=%lu, rec_len=%d, name_len=%d",
-                   dir->i_ino, error, (page->index<<PAGE_SHIFT)+offs,
-                   (unsigned long) le64_to_cpu(p->inode),
+       nilfs_error(sb,
+                   "bad entry in directory #%lu: %s - offset=%lu, inode=%lu, rec_len=%d, name_len=%d",
+                   dir->i_ino, error, (page->index << PAGE_SHIFT) + offs,
+                   (unsigned long)le64_to_cpu(p->inode),
                    rec_len, p->name_len);
        goto fail;
 Eend:
        p = (struct nilfs_dir_entry *)(kaddr + offs);
-       nilfs_error(sb, "nilfs_check_page",
-                   "entry in directory #%lu spans the page boundary"
-                   "offset=%lu, inode=%lu",
-                   dir->i_ino, (page->index<<PAGE_SHIFT)+offs,
-                   (unsigned long) le64_to_cpu(p->inode));
+       nilfs_error(sb,
+                   "entry in directory #%lu spans the page boundary offset=%lu, inode=%lu",
+                   dir->i_ino, (page->index << PAGE_SHIFT) + offs,
+                   (unsigned long)le64_to_cpu(p->inode));
 fail:
        SetPageError(page);
        return false;
                struct page *page = nilfs_get_page(inode, n);
 
                if (IS_ERR(page)) {
-                       nilfs_error(sb, __func__, "bad page in #%lu",
-                                   inode->i_ino);
+                       nilfs_error(sb, "bad page in #%lu", inode->i_ino);
                        ctx->pos += PAGE_SIZE - offset;
                        return -EIO;
                }
                        NILFS_DIR_REC_LEN(1);
                for ( ; (char *)de <= limit; de = nilfs_next_entry(de)) {
                        if (de->rec_len == 0) {
-                               nilfs_error(sb, __func__,
-                                           "zero-length directory entry");
+                               nilfs_error(sb, "zero-length directory entry");
                                nilfs_put_page(page);
                                return -EIO;
                        }
                        kaddr += nilfs_last_byte(dir, n) - reclen;
                        while ((char *) de <= kaddr) {
                                if (de->rec_len == 0) {
-                                       nilfs_error(dir->i_sb, __func__,
+                                       nilfs_error(dir->i_sb,
                                                "zero-length directory entry");
                                        nilfs_put_page(page);
                                        goto out;
                        n = 0;
                /* next page is past the blocks we've got */
                if (unlikely(n > (dir->i_blocks >> (PAGE_SHIFT - 9)))) {
-                       nilfs_error(dir->i_sb, __func__,
+                       nilfs_error(dir->i_sb,
                               "dir %lu size %lld exceeds block count %llu",
                               dir->i_ino, dir->i_size,
                               (unsigned long long)dir->i_blocks);
                                goto got_it;
                        }
                        if (de->rec_len == 0) {
-                               nilfs_error(dir->i_sb, __func__,
+                               nilfs_error(dir->i_sb,
                                            "zero-length directory entry");
                                err = -EIO;
                                goto out_unlock;
 
        while ((char *)de < (char *)dir) {
                if (de->rec_len == 0) {
-                       nilfs_error(inode->i_sb, __func__,
+                       nilfs_error(inode->i_sb,
                                    "zero-length directory entry");
                        err = -EIO;
                        goto out;
 
                while ((char *)de <= kaddr) {
                        if (de->rec_len == 0) {
-                               nilfs_error(inode->i_sb, __func__,
+                               nilfs_error(inode->i_sb,
                                            "zero-length directory entry (kaddr=%p, de=%p)",
                                            kaddr, de);
                                goto not_empty;
 
 /* super.c */
 extern struct inode *nilfs_alloc_inode(struct super_block *);
 extern void nilfs_destroy_inode(struct inode *);
+
 extern __printf(3, 4)
-void nilfs_error(struct super_block *, const char *, const char *, ...);
+void __nilfs_error(struct super_block *sb, const char *function,
+                  const char *fmt, ...);
 extern __printf(3, 4)
 void nilfs_warning(struct super_block *, const char *, const char *, ...);
+
+#ifdef CONFIG_PRINTK
+
+#define nilfs_error(sb, fmt, ...)                                      \
+       __nilfs_error(sb, __func__, fmt, ##__VA_ARGS__)
+
+#else
+
+#define nilfs_error(sb, fmt, ...)                                      \
+       do {                                                            \
+               no_printk(fmt, ##__VA_ARGS__);                          \
+               __nilfs_error(sb, "", " ");                             \
+       } while (0)
+
+#endif /* CONFIG_PRINTK */
+
 extern struct nilfs_super_block *
 nilfs_read_super_block(struct super_block *, u64, int, struct buffer_head **);
 extern int nilfs_store_magic_and_option(struct super_block *,
 
 }
 
 /**
- * nilfs_error() - report failure condition on a filesystem
+ * __nilfs_error() - report failure condition on a filesystem
  *
- * nilfs_error() sets an ERROR_FS flag on the superblock as well as
- * reporting an error message.  It should be called when NILFS detects
- * incoherences or defects of meta data on disk.  As for sustainable
- * errors such as a single-shot I/O error, nilfs_warning() or the printk()
- * function should be used instead.
+ * __nilfs_error() sets an ERROR_FS flag on the superblock as well as
+ * reporting an error message.  This function should be called when
+ * NILFS detects incoherences or defects of meta data on disk.
  *
- * The segment constructor must not call this function because it can
- * kill itself.
+ * This implements the body of nilfs_error() macro.  Normally,
+ * nilfs_error() should be used.  As for sustainable errors such as a
+ * single-shot I/O error, nilfs_warning() or printk() should be used
+ * instead.
+ *
+ * Callers should not add a trailing newline since this will do it.
  */
-void nilfs_error(struct super_block *sb, const char *function,
-                const char *fmt, ...)
+void __nilfs_error(struct super_block *sb, const char *function,
+                  const char *fmt, ...)
 {
        struct the_nilfs *nilfs = sb->s_fs_info;
        struct va_format vaf;