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

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.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 84947eb6
...@@ -137,8 +137,9 @@ static int erofs_map_blocks_flatmode(struct inode *inode, ...@@ -137,8 +137,9 @@ static int erofs_map_blocks_flatmode(struct inode *inode,
/* inline data should be located in one meta block */ /* inline data should be located in one meta block */
if (erofs_blkoff(map->m_pa) + map->m_plen > PAGE_SIZE) { if (erofs_blkoff(map->m_pa) + map->m_plen > PAGE_SIZE) {
errln("inline data cross block boundary @ nid %llu", erofs_err(inode->i_sb,
vi->nid); "inline data cross block boundary @ nid %llu",
vi->nid);
DBG_BUGON(1); DBG_BUGON(1);
err = -EFSCORRUPTED; err = -EFSCORRUPTED;
goto err_out; goto err_out;
...@@ -146,8 +147,9 @@ static int erofs_map_blocks_flatmode(struct inode *inode, ...@@ -146,8 +147,9 @@ static int erofs_map_blocks_flatmode(struct inode *inode,
map->m_flags |= EROFS_MAP_META; map->m_flags |= EROFS_MAP_META;
} else { } else {
errln("internal error @ nid: %llu (size %llu), m_la 0x%llx", erofs_err(inode->i_sb,
vi->nid, inode->i_size, map->m_la); "internal error @ nid: %llu (size %llu), m_la 0x%llx",
vi->nid, inode->i_size, map->m_la);
DBG_BUGON(1); DBG_BUGON(1);
err = -EIO; err = -EIO;
goto err_out; goto err_out;
......
...@@ -161,9 +161,8 @@ static int z_erofs_lz4_decompress(struct z_erofs_decompress_req *rq, u8 *out) ...@@ -161,9 +161,8 @@ static int z_erofs_lz4_decompress(struct z_erofs_decompress_req *rq, u8 *out)
inlen, rq->outputsize, inlen, rq->outputsize,
rq->outputsize); rq->outputsize);
if (ret < 0) { if (ret < 0) {
errln("%s, failed to decompress, in[%p, %u, %u] out[%p, %u]", erofs_err(rq->sb, "failed to decompress, in[%u, %u] out[%u]",
__func__, src + inputmargin, inlen, inputmargin, inlen, inputmargin, rq->outputsize);
out, rq->outputsize);
WARN_ON(1); WARN_ON(1);
print_hex_dump(KERN_DEBUG, "[ in]: ", DUMP_PREFIX_OFFSET, print_hex_dump(KERN_DEBUG, "[ in]: ", DUMP_PREFIX_OFFSET,
16, 1, src + inputmargin, inlen, true); 16, 1, src + inputmargin, inlen, true);
......
...@@ -16,8 +16,8 @@ static void debug_one_dentry(unsigned char d_type, const char *de_name, ...@@ -16,8 +16,8 @@ static void debug_one_dentry(unsigned char d_type, const char *de_name,
memcpy(dbg_namebuf, de_name, de_namelen); memcpy(dbg_namebuf, de_name, de_namelen);
dbg_namebuf[de_namelen] = '\0'; 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); de_namelen, d_type);
#endif #endif
} }
...@@ -47,7 +47,8 @@ static int erofs_fill_dentries(struct inode *dir, struct dir_context *ctx, ...@@ -47,7 +47,8 @@ static int erofs_fill_dentries(struct inode *dir, struct dir_context *ctx,
/* a corrupted entry is found */ /* a corrupted entry is found */
if (nameoff + de_namelen > maxsize || if (nameoff + de_namelen > maxsize ||
de_namelen > EROFS_NAME_LEN) { 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); DBG_BUGON(1);
return -EFSCORRUPTED; return -EFSCORRUPTED;
} }
...@@ -84,8 +85,9 @@ static int erofs_readdir(struct file *f, struct dir_context *ctx) ...@@ -84,8 +85,9 @@ static int erofs_readdir(struct file *f, struct dir_context *ctx)
err = -ENOMEM; err = -ENOMEM;
break; break;
} else if (IS_ERR(dentry_page)) { } else if (IS_ERR(dentry_page)) {
errln("fail to readdir of logical block %u of nid %llu", erofs_err(dir->i_sb,
i, EROFS_I(dir)->nid); "fail to readdir of logical block %u of nid %llu",
i, EROFS_I(dir)->nid);
err = -EFSCORRUPTED; err = -EFSCORRUPTED;
break; break;
} }
...@@ -96,8 +98,9 @@ static int erofs_readdir(struct file *f, struct dir_context *ctx) ...@@ -96,8 +98,9 @@ static int erofs_readdir(struct file *f, struct dir_context *ctx)
if (nameoff < sizeof(struct erofs_dirent) || if (nameoff < sizeof(struct erofs_dirent) ||
nameoff >= PAGE_SIZE) { nameoff >= PAGE_SIZE) {
errln("%s, invalid de[0].nameoff %u @ nid %llu", erofs_err(dir->i_sb,
__func__, nameoff, EROFS_I(dir)->nid); "invalid de[0].nameoff %u @ nid %llu",
nameoff, EROFS_I(dir)->nid);
err = -EFSCORRUPTED; err = -EFSCORRUPTED;
goto skip_this; goto skip_this;
} }
......
...@@ -22,8 +22,8 @@ static int erofs_read_inode(struct inode *inode, void *data) ...@@ -22,8 +22,8 @@ static int erofs_read_inode(struct inode *inode, void *data)
vi->datalayout = erofs_inode_datalayout(ifmt); vi->datalayout = erofs_inode_datalayout(ifmt);
if (vi->datalayout >= EROFS_INODE_DATALAYOUT_MAX) { 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); vi->datalayout, vi->nid);
DBG_BUGON(1); DBG_BUGON(1);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
...@@ -108,8 +108,9 @@ static int erofs_read_inode(struct inode *inode, void *data) ...@@ -108,8 +108,9 @@ static int erofs_read_inode(struct inode *inode, void *data)
nblks = le32_to_cpu(dic->i_u.compressed_blocks); nblks = le32_to_cpu(dic->i_u.compressed_blocks);
break; break;
default: default:
errln("unsupported on-disk inode version %u of nid %llu", erofs_err(inode->i_sb,
erofs_inode_version(ifmt), vi->nid); "unsupported on-disk inode version %u of nid %llu",
erofs_inode_version(ifmt), vi->nid);
DBG_BUGON(1); DBG_BUGON(1);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
...@@ -122,7 +123,8 @@ static int erofs_read_inode(struct inode *inode, void *data) ...@@ -122,7 +123,8 @@ static int erofs_read_inode(struct inode *inode, void *data)
return 0; return 0;
bogusimode: 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); DBG_BUGON(1);
return -EFSCORRUPTED; return -EFSCORRUPTED;
} }
...@@ -148,8 +150,9 @@ static int erofs_fill_symlink(struct inode *inode, void *data, ...@@ -148,8 +150,9 @@ static int erofs_fill_symlink(struct inode *inode, void *data,
/* inline symlink data shouldn't cross page boundary as well */ /* inline symlink data shouldn't cross page boundary as well */
if (m_pofs + inode->i_size > PAGE_SIZE) { if (m_pofs + inode->i_size > PAGE_SIZE) {
kfree(lnk); kfree(lnk);
errln("inline data cross block boundary @ nid %llu", erofs_err(inode->i_sb,
vi->nid); "inline data cross block boundary @ nid %llu",
vi->nid);
DBG_BUGON(1); DBG_BUGON(1);
return -EFSCORRUPTED; return -EFSCORRUPTED;
} }
...@@ -164,7 +167,7 @@ static int erofs_fill_symlink(struct inode *inode, void *data, ...@@ -164,7 +167,7 @@ static int erofs_fill_symlink(struct inode *inode, void *data,
static int erofs_fill_inode(struct inode *inode, int isdir) 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 erofs_inode *vi = EROFS_I(inode);
struct page *page; struct page *page;
void *data; void *data;
...@@ -174,18 +177,18 @@ static int erofs_fill_inode(struct inode *inode, int isdir) ...@@ -174,18 +177,18 @@ static int erofs_fill_inode(struct inode *inode, int isdir)
erofs_off_t inode_loc; erofs_off_t inode_loc;
trace_erofs_fill_inode(inode, isdir); 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); blkaddr = erofs_blknr(inode_loc);
ofs = erofs_blkoff(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); __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)) { 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)); vi->nid, PTR_ERR(page));
return PTR_ERR(page); return PTR_ERR(page);
} }
......
...@@ -22,13 +22,19 @@ ...@@ -22,13 +22,19 @@
#undef pr_fmt #undef pr_fmt
#define pr_fmt(fmt) "erofs: " fmt #define pr_fmt(fmt) "erofs: " fmt
#define errln(x, ...) pr_err(x "\n", ##__VA_ARGS__) __printf(3, 4) void _erofs_err(struct super_block *sb,
#define infoln(x, ...) pr_info(x "\n", ##__VA_ARGS__) 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 #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 #define DBG_BUGON BUG_ON
#else #else
#define debugln(x, ...) ((void)0) #define erofs_dbg(x, ...) ((void)0)
#define DBG_BUGON(x) ((void)(x)) #define DBG_BUGON(x) ((void)(x))
#endif /* !CONFIG_EROFS_FS_DEBUG */ #endif /* !CONFIG_EROFS_FS_DEBUG */
......
...@@ -116,8 +116,9 @@ static struct page *find_target_block_classic(struct inode *dir, ...@@ -116,8 +116,9 @@ static struct page *find_target_block_classic(struct inode *dir,
if (!ndirents) { if (!ndirents) {
kunmap_atomic(de); kunmap_atomic(de);
put_page(page); put_page(page);
errln("corrupted dir block %d @ nid %llu", erofs_err(dir->i_sb,
mid, EROFS_I(dir)->nid); "corrupted dir block %d @ nid %llu",
mid, EROFS_I(dir)->nid);
DBG_BUGON(1); DBG_BUGON(1);
page = ERR_PTR(-EFSCORRUPTED); page = ERR_PTR(-EFSCORRUPTED);
goto out; goto out;
...@@ -233,8 +234,8 @@ static struct dentry *erofs_lookup(struct inode *dir, ...@@ -233,8 +234,8 @@ static struct dentry *erofs_lookup(struct inode *dir,
} else if (err) { } else if (err) {
inode = ERR_PTR(err); inode = ERR_PTR(err);
} else { } else {
debugln("%s, %s (nid %llu) found, d_type %u", __func__, erofs_dbg("%s, %s (nid %llu) found, d_type %u", __func__,
dentry->d_name.name, nid, d_type); dentry->d_name.name, nid, d_type);
inode = erofs_iget(dir->i_sb, nid, d_type == FT_DIR); inode = erofs_iget(dir->i_sb, nid, d_type == FT_DIR);
} }
return d_splice_alias(inode, dentry); return d_splice_alias(inode, dentry);
......
...@@ -16,6 +16,36 @@ ...@@ -16,6 +16,36 @@
static struct kmem_cache *erofs_inode_cachep __read_mostly; static struct kmem_cache *erofs_inode_cachep __read_mostly;
void _erofs_err(struct super_block *sb, const char *function,
const char *fmt, ...)
{
struct va_format vaf;
va_list args;
va_start(args, fmt);
vaf.fmt = fmt;
vaf.va = &args;
pr_err("(device %s): %s: %pV", sb->s_id, function, &vaf);
va_end(args);
}
void _erofs_info(struct super_block *sb, const char *function,
const char *fmt, ...)
{
struct va_format vaf;
va_list args;
va_start(args, fmt);
vaf.fmt = fmt;
vaf.va = &args;
pr_info("(device %s): %pV", sb->s_id, &vaf);
va_end(args);
}
static void erofs_inode_init_once(void *ptr) static void erofs_inode_init_once(void *ptr)
{ {
struct erofs_inode *vi = ptr; struct erofs_inode *vi = ptr;
...@@ -57,8 +87,9 @@ static bool check_layout_compatibility(struct super_block *sb, ...@@ -57,8 +87,9 @@ static bool check_layout_compatibility(struct super_block *sb,
/* check if current kernel meets all mandatory requirements */ /* check if current kernel meets all mandatory requirements */
if (feature & (~EROFS_ALL_FEATURE_INCOMPAT)) { if (feature & (~EROFS_ALL_FEATURE_INCOMPAT)) {
errln("unidentified incompatible feature %x, please upgrade kernel version", erofs_err(sb,
feature & ~EROFS_ALL_FEATURE_INCOMPAT); "unidentified incompatible feature %x, please upgrade kernel version",
feature & ~EROFS_ALL_FEATURE_INCOMPAT);
return false; return false;
} }
return true; return true;
...@@ -75,7 +106,7 @@ static int erofs_read_superblock(struct super_block *sb) ...@@ -75,7 +106,7 @@ static int erofs_read_superblock(struct super_block *sb)
bh = sb_bread(sb, 0); bh = sb_bread(sb, 0);
if (!bh) { if (!bh) {
errln("cannot read erofs superblock"); erofs_err(sb, "cannot read erofs superblock");
return -EIO; return -EIO;
} }
...@@ -84,15 +115,15 @@ static int erofs_read_superblock(struct super_block *sb) ...@@ -84,15 +115,15 @@ static int erofs_read_superblock(struct super_block *sb)
ret = -EINVAL; ret = -EINVAL;
if (le32_to_cpu(dsb->magic) != EROFS_SUPER_MAGIC_V1) { if (le32_to_cpu(dsb->magic) != EROFS_SUPER_MAGIC_V1) {
errln("cannot find valid erofs superblock"); erofs_err(sb, "cannot find valid erofs superblock");
goto out; goto out;
} }
blkszbits = dsb->blkszbits; blkszbits = dsb->blkszbits;
/* 9(512 bytes) + LOG_SECTORS_PER_BLOCK == LOG_BLOCK_SIZE */ /* 9(512 bytes) + LOG_SECTORS_PER_BLOCK == LOG_BLOCK_SIZE */
if (blkszbits != LOG_BLOCK_SIZE) { if (blkszbits != LOG_BLOCK_SIZE) {
errln("blksize %u isn't supported on this platform", erofs_err(sb, "blksize %u isn't supported on this platform",
1 << blkszbits); 1 << blkszbits);
goto out; goto out;
} }
...@@ -116,7 +147,7 @@ static int erofs_read_superblock(struct super_block *sb) ...@@ -116,7 +147,7 @@ static int erofs_read_superblock(struct super_block *sb)
ret = strscpy(sbi->volume_name, dsb->volume_name, ret = strscpy(sbi->volume_name, dsb->volume_name,
sizeof(dsb->volume_name)); sizeof(dsb->volume_name));
if (ret < 0) { /* -E2BIG */ if (ret < 0) { /* -E2BIG */
errln("bad volume name without NIL terminator"); erofs_err(sb, "bad volume name without NIL terminator");
ret = -EFSCORRUPTED; ret = -EFSCORRUPTED;
goto out; goto out;
} }
...@@ -127,14 +158,15 @@ static int erofs_read_superblock(struct super_block *sb) ...@@ -127,14 +158,15 @@ static int erofs_read_superblock(struct super_block *sb)
} }
#ifdef CONFIG_EROFS_FS_ZIP #ifdef CONFIG_EROFS_FS_ZIP
static int erofs_build_cache_strategy(struct erofs_sb_info *sbi, static int erofs_build_cache_strategy(struct super_block *sb,
substring_t *args) substring_t *args)
{ {
struct erofs_sb_info *sbi = EROFS_SB(sb);
const char *cs = match_strdup(args); const char *cs = match_strdup(args);
int err = 0; int err = 0;
if (!cs) { if (!cs) {
errln("Not enough memory to store cache strategy"); erofs_err(sb, "Not enough memory to store cache strategy");
return -ENOMEM; return -ENOMEM;
} }
...@@ -145,17 +177,17 @@ static int erofs_build_cache_strategy(struct erofs_sb_info *sbi, ...@@ -145,17 +177,17 @@ static int erofs_build_cache_strategy(struct erofs_sb_info *sbi,
} else if (!strcmp(cs, "readaround")) { } else if (!strcmp(cs, "readaround")) {
sbi->cache_strategy = EROFS_ZIP_CACHE_READAROUND; sbi->cache_strategy = EROFS_ZIP_CACHE_READAROUND;
} else { } else {
errln("Unrecognized cache strategy \"%s\"", cs); erofs_err(sb, "Unrecognized cache strategy \"%s\"", cs);
err = -EINVAL; err = -EINVAL;
} }
kfree(cs); kfree(cs);
return err; return err;
} }
#else #else
static int erofs_build_cache_strategy(struct erofs_sb_info *sbi, static int erofs_build_cache_strategy(struct super_block *sb,
substring_t *args) substring_t *args)
{ {
infoln("EROFS compression is disabled, so cache strategy is ignored"); erofs_info(sb, "EROFS compression is disabled, so cache strategy is ignored");
return 0; return 0;
} }
#endif #endif
...@@ -221,10 +253,10 @@ static int erofs_parse_options(struct super_block *sb, char *options) ...@@ -221,10 +253,10 @@ static int erofs_parse_options(struct super_block *sb, char *options)
break; break;
#else #else
case Opt_user_xattr: case Opt_user_xattr:
infoln("user_xattr options not supported"); erofs_info(sb, "user_xattr options not supported");
break; break;
case Opt_nouser_xattr: case Opt_nouser_xattr:
infoln("nouser_xattr options not supported"); erofs_info(sb, "nouser_xattr options not supported");
break; break;
#endif #endif
#ifdef CONFIG_EROFS_FS_POSIX_ACL #ifdef CONFIG_EROFS_FS_POSIX_ACL
...@@ -236,19 +268,19 @@ static int erofs_parse_options(struct super_block *sb, char *options) ...@@ -236,19 +268,19 @@ static int erofs_parse_options(struct super_block *sb, char *options)
break; break;
#else #else
case Opt_acl: case Opt_acl:
infoln("acl options not supported"); erofs_info(sb, "acl options not supported");
break; break;
case Opt_noacl: case Opt_noacl:
infoln("noacl options not supported"); erofs_info(sb, "noacl options not supported");
break; break;
#endif #endif
case Opt_cache_strategy: case Opt_cache_strategy:
err = erofs_build_cache_strategy(EROFS_SB(sb), args); err = erofs_build_cache_strategy(sb, args);
if (err) if (err)
return err; return err;
break; break;
default: default:
errln("Unrecognized mount option \"%s\" or missing value", p); erofs_err(sb, "Unrecognized mount option \"%s\" or missing value", p);
return -EINVAL; return -EINVAL;
} }
} }
...@@ -323,7 +355,7 @@ static int erofs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -323,7 +355,7 @@ static int erofs_fill_super(struct super_block *sb, void *data, int silent)
sb->s_magic = EROFS_SUPER_MAGIC; sb->s_magic = EROFS_SUPER_MAGIC;
if (!sb_set_blocksize(sb, EROFS_BLKSIZ)) { if (!sb_set_blocksize(sb, EROFS_BLKSIZ)) {
errln("failed to set erofs blksize"); erofs_err(sb, "failed to set erofs blksize");
return -EINVAL; return -EINVAL;
} }
...@@ -367,8 +399,8 @@ static int erofs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -367,8 +399,8 @@ static int erofs_fill_super(struct super_block *sb, void *data, int silent)
return PTR_ERR(inode); return PTR_ERR(inode);
if (!S_ISDIR(inode->i_mode)) { if (!S_ISDIR(inode->i_mode)) {
errln("rootino(nid %llu) is not a directory(i_mode %o)", erofs_err(sb, "rootino(nid %llu) is not a directory(i_mode %o)",
ROOT_NID(sbi), inode->i_mode); ROOT_NID(sbi), inode->i_mode);
iput(inode); iput(inode);
return -EINVAL; return -EINVAL;
} }
...@@ -383,9 +415,8 @@ static int erofs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -383,9 +415,8 @@ static int erofs_fill_super(struct super_block *sb, void *data, int silent)
if (err) if (err)
return err; return err;
if (!silent) erofs_info(sb, "mounted with opts: %s, root inode @ nid %llu.",
infoln("mounted on %s with opts: %s, root inode @ nid %llu.", (char *)data, ROOT_NID(sbi));
sb->s_id, (char *)data, ROOT_NID(sbi));
return 0; return 0;
} }
...@@ -404,7 +435,6 @@ static void erofs_kill_sb(struct super_block *sb) ...@@ -404,7 +435,6 @@ static void erofs_kill_sb(struct super_block *sb)
struct erofs_sb_info *sbi; struct erofs_sb_info *sbi;
WARN_ON(sb->s_magic != EROFS_SUPER_MAGIC); WARN_ON(sb->s_magic != EROFS_SUPER_MAGIC);
infoln("unmounting for %s", sb->s_id);
kill_block_super(sb); kill_block_super(sb);
...@@ -443,7 +473,6 @@ static int __init erofs_module_init(void) ...@@ -443,7 +473,6 @@ static int __init erofs_module_init(void)
int err; int err;
erofs_check_ondisk_layout_definitions(); erofs_check_ondisk_layout_definitions();
infoln("initializing erofs " EROFS_VERSION);
erofs_inode_cachep = kmem_cache_create("erofs_inode", erofs_inode_cachep = kmem_cache_create("erofs_inode",
sizeof(struct erofs_inode), 0, sizeof(struct erofs_inode), 0,
...@@ -466,7 +495,6 @@ static int __init erofs_module_init(void) ...@@ -466,7 +495,6 @@ static int __init erofs_module_init(void)
if (err) if (err)
goto fs_err; goto fs_err;
infoln("successfully to initialize erofs");
return 0; return 0;
fs_err: fs_err:
...@@ -488,7 +516,6 @@ static void __exit erofs_module_exit(void) ...@@ -488,7 +516,6 @@ static void __exit erofs_module_exit(void)
/* Ensure all RCU free inodes are safe before cache is destroyed. */ /* Ensure all RCU free inodes are safe before cache is destroyed. */
rcu_barrier(); rcu_barrier();
kmem_cache_destroy(erofs_inode_cachep); kmem_cache_destroy(erofs_inode_cachep);
infoln("successfully finalize erofs");
} }
/* get filesystem statistics */ /* get filesystem statistics */
......
...@@ -67,13 +67,15 @@ static int init_inode_xattrs(struct inode *inode) ...@@ -67,13 +67,15 @@ static int init_inode_xattrs(struct inode *inode)
* undefined right now (maybe use later with some new sb feature). * undefined right now (maybe use later with some new sb feature).
*/ */
if (vi->xattr_isize == sizeof(struct erofs_xattr_ibody_header)) { if (vi->xattr_isize == sizeof(struct erofs_xattr_ibody_header)) {
errln("xattr_isize %d of nid %llu is not supported yet", erofs_err(inode->i_sb,
vi->xattr_isize, vi->nid); "xattr_isize %d of nid %llu is not supported yet",
vi->xattr_isize, vi->nid);
ret = -EOPNOTSUPP; ret = -EOPNOTSUPP;
goto out_unlock; goto out_unlock;
} else if (vi->xattr_isize < sizeof(struct erofs_xattr_ibody_header)) { } else if (vi->xattr_isize < sizeof(struct erofs_xattr_ibody_header)) {
if (vi->xattr_isize) { if (vi->xattr_isize) {
errln("bogus xattr ibody @ nid %llu", vi->nid); erofs_err(inode->i_sb,
"bogus xattr ibody @ nid %llu", vi->nid);
DBG_BUGON(1); DBG_BUGON(1);
ret = -EFSCORRUPTED; ret = -EFSCORRUPTED;
goto out_unlock; /* xattr ondisk layout error */ goto out_unlock; /* xattr ondisk layout error */
......
...@@ -600,7 +600,7 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe, ...@@ -600,7 +600,7 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe,
} }
/* go ahead the next map_blocks */ /* go ahead the next map_blocks */
debugln("%s: [out-of-range] pos %llu", __func__, offset + cur); erofs_dbg("%s: [out-of-range] pos %llu", __func__, offset + cur);
if (z_erofs_collector_end(clt)) if (z_erofs_collector_end(clt))
fe->backmost = false; fe->backmost = false;
...@@ -680,8 +680,8 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe, ...@@ -680,8 +680,8 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe,
out: out:
z_erofs_onlinepage_endio(page); z_erofs_onlinepage_endio(page);
debugln("%s, finish page: %pK spiltted: %u map->m_llen %llu", erofs_dbg("%s, finish page: %pK spiltted: %u map->m_llen %llu",
__func__, page, spiltted, map->m_llen); __func__, page, spiltted, map->m_llen);
return err; return err;
/* if some error occurred while processing this page */ /* if some error occurred while processing this page */
...@@ -1340,7 +1340,7 @@ static int z_erofs_vle_normalaccess_readpage(struct file *file, ...@@ -1340,7 +1340,7 @@ static int z_erofs_vle_normalaccess_readpage(struct file *file,
z_erofs_submit_and_unzip(inode->i_sb, &f.clt, &pagepool, true); z_erofs_submit_and_unzip(inode->i_sb, &f.clt, &pagepool, true);
if (err) if (err)
errln("%s, failed to read, err [%d]", __func__, err); erofs_err(inode->i_sb, "failed to read, err [%d]", err);
if (f.map.mpage) if (f.map.mpage)
put_page(f.map.mpage); put_page(f.map.mpage);
...@@ -1406,8 +1406,9 @@ static int z_erofs_vle_normalaccess_readpages(struct file *filp, ...@@ -1406,8 +1406,9 @@ static int z_erofs_vle_normalaccess_readpages(struct file *filp,
err = z_erofs_do_read_page(&f, page, &pagepool); err = z_erofs_do_read_page(&f, page, &pagepool);
if (err) if (err)
errln("%s, readahead error at page %lu of nid %llu", erofs_err(inode->i_sb,
__func__, page->index, EROFS_I(inode)->nid); "readahead error at page %lu @ nid %llu",
page->index, EROFS_I(inode)->nid);
put_page(page); put_page(page);
} }
......
...@@ -182,7 +182,7 @@ static inline void z_erofs_onlinepage_endio(struct page *page) ...@@ -182,7 +182,7 @@ static inline void z_erofs_onlinepage_endio(struct page *page)
SetPageUptodate(page); SetPageUptodate(page);
unlock_page(page); unlock_page(page);
} }
debugln("%s, page %p value %x", __func__, page, atomic_read(u.o)); erofs_dbg("%s, page %p value %x", __func__, page, atomic_read(u.o));
} }
#define Z_EROFS_VMAP_ONSTACK_PAGES \ #define Z_EROFS_VMAP_ONSTACK_PAGES \
......
...@@ -64,8 +64,8 @@ static int fill_inode_lazy(struct inode *inode) ...@@ -64,8 +64,8 @@ static int fill_inode_lazy(struct inode *inode)
vi->z_algorithmtype[1] = h->h_algorithmtype >> 4; vi->z_algorithmtype[1] = h->h_algorithmtype >> 4;
if (vi->z_algorithmtype[0] >= Z_EROFS_COMPRESSION_MAX) { if (vi->z_algorithmtype[0] >= Z_EROFS_COMPRESSION_MAX) {
errln("unknown compression format %u for nid %llu, please upgrade kernel", erofs_err(sb, "unknown compression format %u for nid %llu, please upgrade kernel",
vi->z_algorithmtype[0], vi->nid); vi->z_algorithmtype[0], vi->nid);
err = -EOPNOTSUPP; err = -EOPNOTSUPP;
goto unmap_done; goto unmap_done;
} }
...@@ -75,8 +75,8 @@ static int fill_inode_lazy(struct inode *inode) ...@@ -75,8 +75,8 @@ static int fill_inode_lazy(struct inode *inode)
((h->h_clusterbits >> 3) & 3); ((h->h_clusterbits >> 3) & 3);
if (vi->z_physical_clusterbits[0] != LOG_BLOCK_SIZE) { if (vi->z_physical_clusterbits[0] != LOG_BLOCK_SIZE) {
errln("unsupported physical clusterbits %u for nid %llu, please upgrade kernel", erofs_err(sb, "unsupported physical clusterbits %u for nid %llu, please upgrade kernel",
vi->z_physical_clusterbits[0], vi->nid); vi->z_physical_clusterbits[0], vi->nid);
err = -EOPNOTSUPP; err = -EOPNOTSUPP;
goto unmap_done; goto unmap_done;
} }
...@@ -335,7 +335,8 @@ static int vle_extent_lookback(struct z_erofs_maprecorder *m, ...@@ -335,7 +335,8 @@ static int vle_extent_lookback(struct z_erofs_maprecorder *m,
int err; int err;
if (lcn < lookback_distance) { if (lcn < lookback_distance) {
errln("bogus lookback distance @ nid %llu", vi->nid); erofs_err(m->inode->i_sb,
"bogus lookback distance @ nid %llu", vi->nid);
DBG_BUGON(1); DBG_BUGON(1);
return -EFSCORRUPTED; return -EFSCORRUPTED;
} }
...@@ -349,8 +350,9 @@ static int vle_extent_lookback(struct z_erofs_maprecorder *m, ...@@ -349,8 +350,9 @@ static int vle_extent_lookback(struct z_erofs_maprecorder *m,
switch (m->type) { switch (m->type) {
case Z_EROFS_VLE_CLUSTER_TYPE_NONHEAD: case Z_EROFS_VLE_CLUSTER_TYPE_NONHEAD:
if (!m->delta[0]) { if (!m->delta[0]) {
errln("invalid lookback distance 0 at nid %llu", erofs_err(m->inode->i_sb,
vi->nid); "invalid lookback distance 0 @ nid %llu",
vi->nid);
DBG_BUGON(1); DBG_BUGON(1);
return -EFSCORRUPTED; return -EFSCORRUPTED;
} }
...@@ -362,8 +364,9 @@ static int vle_extent_lookback(struct z_erofs_maprecorder *m, ...@@ -362,8 +364,9 @@ static int vle_extent_lookback(struct z_erofs_maprecorder *m,
map->m_la = (lcn << lclusterbits) | m->clusterofs; map->m_la = (lcn << lclusterbits) | m->clusterofs;
break; break;
default: default:
errln("unknown type %u at lcn %lu of nid %llu", erofs_err(m->inode->i_sb,
m->type, lcn, vi->nid); "unknown type %u @ lcn %lu of nid %llu",
m->type, lcn, vi->nid);
DBG_BUGON(1); DBG_BUGON(1);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
...@@ -421,8 +424,9 @@ int z_erofs_map_blocks_iter(struct inode *inode, ...@@ -421,8 +424,9 @@ int z_erofs_map_blocks_iter(struct inode *inode,
} }
/* m.lcn should be >= 1 if endoff < m.clusterofs */ /* m.lcn should be >= 1 if endoff < m.clusterofs */
if (!m.lcn) { if (!m.lcn) {
errln("invalid logical cluster 0 at nid %llu", erofs_err(inode->i_sb,
vi->nid); "invalid logical cluster 0 at nid %llu",
vi->nid);
err = -EFSCORRUPTED; err = -EFSCORRUPTED;
goto unmap_out; goto unmap_out;
} }
...@@ -437,8 +441,9 @@ int z_erofs_map_blocks_iter(struct inode *inode, ...@@ -437,8 +441,9 @@ int z_erofs_map_blocks_iter(struct inode *inode,
goto unmap_out; goto unmap_out;
break; break;
default: default:
errln("unknown type %u at offset %llu of nid %llu", erofs_err(inode->i_sb,
m.type, ofs, vi->nid); "unknown type %u @ offset %llu of nid %llu",
m.type, ofs, vi->nid);
err = -EOPNOTSUPP; err = -EOPNOTSUPP;
goto unmap_out; goto unmap_out;
} }
...@@ -453,9 +458,9 @@ int z_erofs_map_blocks_iter(struct inode *inode, ...@@ -453,9 +458,9 @@ int z_erofs_map_blocks_iter(struct inode *inode,
kunmap_atomic(m.kaddr); kunmap_atomic(m.kaddr);
out: out:
debugln("%s, m_la %llu m_pa %llu m_llen %llu m_plen %llu m_flags 0%o", erofs_dbg("%s, m_la %llu m_pa %llu m_llen %llu m_plen %llu m_flags 0%o",
__func__, map->m_la, map->m_pa, __func__, map->m_la, map->m_pa,
map->m_llen, map->m_plen, map->m_flags); map->m_llen, map->m_plen, map->m_flags);
trace_z_erofs_map_blocks_iter_exit(inode, map, flags, err); trace_z_erofs_map_blocks_iter_exit(inode, map, flags, err);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment