Commit 4f761fa2 authored by Gao Xiang's avatar Gao Xiang Committed by Greg Kroah-Hartman
Browse files

erofs: rename errln/infoln/debugln to erofs_{err, info, dbg}



Add prefix "erofs_" to these functions and print
sb->s_id as a prefix to erofs_{err, info} so that
the user knows which file system is affected.

Reported-by: default avatarChristoph Hellwig <hch@infradead.org>
Signed-off-by: default avatarGao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-23-gaoxiang25@huawei.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 84947eb6
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -137,7 +137,8 @@ static int erofs_map_blocks_flatmode(struct inode *inode,

		/* inline data should be located in one meta block */
		if (erofs_blkoff(map->m_pa) + map->m_plen > PAGE_SIZE) {
			errln("inline data cross block boundary @ nid %llu",
			erofs_err(inode->i_sb,
				  "inline data cross block boundary @ nid %llu",
				  vi->nid);
			DBG_BUGON(1);
			err = -EFSCORRUPTED;
@@ -146,7 +147,8 @@ static int erofs_map_blocks_flatmode(struct inode *inode,

		map->m_flags |= EROFS_MAP_META;
	} else {
		errln("internal error @ nid: %llu (size %llu), m_la 0x%llx",
		erofs_err(inode->i_sb,
			  "internal error @ nid: %llu (size %llu), m_la 0x%llx",
			  vi->nid, inode->i_size, map->m_la);
		DBG_BUGON(1);
		err = -EIO;
+2 −3
Original line number Diff line number Diff line
@@ -161,9 +161,8 @@ static int z_erofs_lz4_decompress(struct z_erofs_decompress_req *rq, u8 *out)
					  inlen, rq->outputsize,
					  rq->outputsize);
	if (ret < 0) {
		errln("%s, failed to decompress, in[%p, %u, %u] out[%p, %u]",
		      __func__, src + inputmargin, inlen, inputmargin,
		      out, rq->outputsize);
		erofs_err(rq->sb, "failed to decompress, in[%u, %u] out[%u]",
			  inlen, inputmargin, rq->outputsize);
		WARN_ON(1);
		print_hex_dump(KERN_DEBUG, "[ in]: ", DUMP_PREFIX_OFFSET,
			       16, 1, src + inputmargin, inlen, true);
+10 −7
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ static void debug_one_dentry(unsigned char d_type, const char *de_name,
	memcpy(dbg_namebuf, de_name, de_namelen);
	dbg_namebuf[de_namelen] = '\0';

	debugln("found dirent %s de_len %u d_type %d", dbg_namebuf,
	erofs_dbg("found dirent %s de_len %u d_type %d", dbg_namebuf,
		  de_namelen, d_type);
#endif
}
@@ -47,7 +47,8 @@ static int erofs_fill_dentries(struct inode *dir, struct dir_context *ctx,
		/* a corrupted entry is found */
		if (nameoff + de_namelen > maxsize ||
		    de_namelen > EROFS_NAME_LEN) {
			errln("bogus dirent @ nid %llu", EROFS_I(dir)->nid);
			erofs_err(dir->i_sb, "bogus dirent @ nid %llu",
				  EROFS_I(dir)->nid);
			DBG_BUGON(1);
			return -EFSCORRUPTED;
		}
@@ -84,7 +85,8 @@ static int erofs_readdir(struct file *f, struct dir_context *ctx)
			err = -ENOMEM;
			break;
		} else if (IS_ERR(dentry_page)) {
			errln("fail to readdir of logical block %u of nid %llu",
			erofs_err(dir->i_sb,
				  "fail to readdir of logical block %u of nid %llu",
				  i, EROFS_I(dir)->nid);
			err = -EFSCORRUPTED;
			break;
@@ -96,8 +98,9 @@ static int erofs_readdir(struct file *f, struct dir_context *ctx)

		if (nameoff < sizeof(struct erofs_dirent) ||
		    nameoff >= PAGE_SIZE) {
			errln("%s, invalid de[0].nameoff %u @ nid %llu",
			      __func__, nameoff, EROFS_I(dir)->nid);
			erofs_err(dir->i_sb,
				  "invalid de[0].nameoff %u @ nid %llu",
				  nameoff, EROFS_I(dir)->nid);
			err = -EFSCORRUPTED;
			goto skip_this;
		}
+17 −14
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ static int erofs_read_inode(struct inode *inode, void *data)
	vi->datalayout = erofs_inode_datalayout(ifmt);

	if (vi->datalayout >= EROFS_INODE_DATALAYOUT_MAX) {
		errln("unsupported datalayout %u of nid %llu",
		erofs_err(inode->i_sb, "unsupported datalayout %u of nid %llu",
			  vi->datalayout, vi->nid);
		DBG_BUGON(1);
		return -EOPNOTSUPP;
@@ -108,7 +108,8 @@ static int erofs_read_inode(struct inode *inode, void *data)
			nblks = le32_to_cpu(dic->i_u.compressed_blocks);
		break;
	default:
		errln("unsupported on-disk inode version %u of nid %llu",
		erofs_err(inode->i_sb,
			  "unsupported on-disk inode version %u of nid %llu",
			  erofs_inode_version(ifmt), vi->nid);
		DBG_BUGON(1);
		return -EOPNOTSUPP;
@@ -122,7 +123,8 @@ static int erofs_read_inode(struct inode *inode, void *data)
	return 0;

bogusimode:
	errln("bogus i_mode (%o) @ nid %llu", inode->i_mode, vi->nid);
	erofs_err(inode->i_sb, "bogus i_mode (%o) @ nid %llu",
		  inode->i_mode, vi->nid);
	DBG_BUGON(1);
	return -EFSCORRUPTED;
}
@@ -148,7 +150,8 @@ static int erofs_fill_symlink(struct inode *inode, void *data,
	/* inline symlink data shouldn't cross page boundary as well */
	if (m_pofs + inode->i_size > PAGE_SIZE) {
		kfree(lnk);
		errln("inline data cross block boundary @ nid %llu",
		erofs_err(inode->i_sb,
			  "inline data cross block boundary @ nid %llu",
			  vi->nid);
		DBG_BUGON(1);
		return -EFSCORRUPTED;
@@ -164,7 +167,7 @@ static int erofs_fill_symlink(struct inode *inode, void *data,

static int erofs_fill_inode(struct inode *inode, int isdir)
{
	struct erofs_sb_info *sbi = EROFS_SB(inode->i_sb);
	struct super_block *sb = inode->i_sb;
	struct erofs_inode *vi = EROFS_I(inode);
	struct page *page;
	void *data;
@@ -174,17 +177,17 @@ static int erofs_fill_inode(struct inode *inode, int isdir)
	erofs_off_t inode_loc;

	trace_erofs_fill_inode(inode, isdir);
	inode_loc = iloc(sbi, vi->nid);
	inode_loc = iloc(EROFS_SB(sb), vi->nid);
	blkaddr = erofs_blknr(inode_loc);
	ofs = erofs_blkoff(inode_loc);

	debugln("%s, reading inode nid %llu at %u of blkaddr %u",
	erofs_dbg("%s, reading inode nid %llu at %u of blkaddr %u",
		  __func__, vi->nid, ofs, blkaddr);

	page = erofs_get_meta_page(inode->i_sb, blkaddr);
	page = erofs_get_meta_page(sb, blkaddr);

	if (IS_ERR(page)) {
		errln("failed to get inode (nid: %llu) page, err %ld",
		erofs_err(sb, "failed to get inode (nid: %llu) page, err %ld",
			  vi->nid, PTR_ERR(page));
		return PTR_ERR(page);
	}
+10 −4
Original line number Diff line number Diff line
@@ -22,13 +22,19 @@
#undef pr_fmt
#define pr_fmt(fmt) "erofs: " fmt

#define errln(x, ...)   pr_err(x "\n", ##__VA_ARGS__)
#define infoln(x, ...)  pr_info(x "\n", ##__VA_ARGS__)
__printf(3, 4) void _erofs_err(struct super_block *sb,
			       const char *function, const char *fmt, ...);
#define erofs_err(sb, fmt, ...)	\
	_erofs_err(sb, __func__, fmt "\n", ##__VA_ARGS__)
__printf(3, 4) void _erofs_info(struct super_block *sb,
			       const char *function, const char *fmt, ...);
#define erofs_info(sb, fmt, ...) \
	_erofs_info(sb, __func__, fmt "\n", ##__VA_ARGS__)
#ifdef CONFIG_EROFS_FS_DEBUG
#define debugln(x, ...) pr_debug(x "\n", ##__VA_ARGS__)
#define erofs_dbg(x, ...)       pr_debug(x "\n", ##__VA_ARGS__)
#define DBG_BUGON               BUG_ON
#else
#define debugln(x, ...)         ((void)0)
#define erofs_dbg(x, ...)       ((void)0)
#define DBG_BUGON(x)            ((void)(x))
#endif	/* !CONFIG_EROFS_FS_DEBUG */

Loading