Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f8db0be1 authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim
Browse files

f2fs: show f2fs instance in printk_ratelimited



As Eric mentioned, bare printk{,_ratelimited} won't show which
filesystem instance these message is coming from, this patch tries
to show fs instance with sb->s_id field in all places we missed
before.

Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 7c4b00dc
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -581,7 +581,7 @@ int f2fs_acquire_orphan_inode(struct f2fs_sb_info *sbi)


	if (time_to_inject(sbi, FAULT_ORPHAN)) {
	if (time_to_inject(sbi, FAULT_ORPHAN)) {
		spin_unlock(&im->ino_lock);
		spin_unlock(&im->ino_lock);
		f2fs_show_injection_info(FAULT_ORPHAN);
		f2fs_show_injection_info(sbi, FAULT_ORPHAN);
		return -ENOSPC;
		return -ENOSPC;
	}
	}


+5 −3
Original line number Original line Diff line number Diff line
@@ -168,8 +168,10 @@ static bool f2fs_bio_post_read_required(struct bio *bio)


static void f2fs_read_end_io(struct bio *bio)
static void f2fs_read_end_io(struct bio *bio)
{
{
	if (time_to_inject(F2FS_P_SB(bio->bi_io_vec->bv_page), FAULT_READ_IO)) {
	struct f2fs_sb_info *sbi = F2FS_P_SB(bio->bi_io_vec->bv_page);
		f2fs_show_injection_info(FAULT_READ_IO);

	if (time_to_inject(sbi, FAULT_READ_IO)) {
		f2fs_show_injection_info(sbi, FAULT_READ_IO);
		bio->bi_status = BLK_STS_IOERR;
		bio->bi_status = BLK_STS_IOERR;
	}
	}


@@ -191,7 +193,7 @@ static void f2fs_write_end_io(struct bio *bio)
	int i;
	int i;


	if (time_to_inject(sbi, FAULT_WRITE_IO)) {
	if (time_to_inject(sbi, FAULT_WRITE_IO)) {
		f2fs_show_injection_info(FAULT_WRITE_IO);
		f2fs_show_injection_info(sbi, FAULT_WRITE_IO);
		bio->bi_status = BLK_STS_IOERR;
		bio->bi_status = BLK_STS_IOERR;
	}
	}


+4 −3
Original line number Original line Diff line number Diff line
@@ -628,7 +628,7 @@ int f2fs_add_regular_entry(struct inode *dir, const struct qstr *new_name,


start:
start:
	if (time_to_inject(F2FS_I_SB(dir), FAULT_DIR_DEPTH)) {
	if (time_to_inject(F2FS_I_SB(dir), FAULT_DIR_DEPTH)) {
		f2fs_show_injection_info(FAULT_DIR_DEPTH);
		f2fs_show_injection_info(F2FS_I_SB(dir), FAULT_DIR_DEPTH);
		return -ENOSPC;
		return -ENOSPC;
	}
	}


@@ -919,8 +919,9 @@ int f2fs_fill_dentries(struct dir_context *ctx, struct f2fs_dentry_ptr *d,
			bit_pos++;
			bit_pos++;
			ctx->pos = start_pos + bit_pos;
			ctx->pos = start_pos + bit_pos;
			printk_ratelimited(
			printk_ratelimited(
				"%s, invalid namelen(0), ino:%u, run fsck to fix.",
				"%sF2FS-fs (%s): invalid namelen(0), ino:%u, run fsck to fix.",
				KERN_WARNING, le32_to_cpu(de->ino));
				KERN_WARNING, sbi->sb->s_id,
				le32_to_cpu(de->ino));
			set_sbi_flag(sbi, SBI_NEED_FSCK);
			set_sbi_flag(sbi, SBI_NEED_FSCK);
			continue;
			continue;
		}
		}
+13 −11
Original line number Original line Diff line number Diff line
@@ -1372,9 +1372,10 @@ struct f2fs_private_dio {
};
};


#ifdef CONFIG_F2FS_FAULT_INJECTION
#ifdef CONFIG_F2FS_FAULT_INJECTION
#define f2fs_show_injection_info(type)					\
#define f2fs_show_injection_info(sbi, type)					\
	printk_ratelimited("%sF2FS-fs : inject %s in %s of %pF\n",	\
	printk_ratelimited("%sF2FS-fs (%s) : inject %s in %s of %pS\n",	\
		KERN_INFO, f2fs_fault_name[type],			\
		KERN_INFO, sbi->sb->s_id,				\
		f2fs_fault_name[type],					\
		__func__, __builtin_return_address(0))
		__func__, __builtin_return_address(0))
static inline bool time_to_inject(struct f2fs_sb_info *sbi, int type)
static inline bool time_to_inject(struct f2fs_sb_info *sbi, int type)
{
{
@@ -1394,7 +1395,7 @@ static inline bool time_to_inject(struct f2fs_sb_info *sbi, int type)
	return false;
	return false;
}
}
#else
#else
#define f2fs_show_injection_info(type) do { } while (0)
#define f2fs_show_injection_info(sbi, type) do { } while (0)
static inline bool time_to_inject(struct f2fs_sb_info *sbi, int type)
static inline bool time_to_inject(struct f2fs_sb_info *sbi, int type)
{
{
	return false;
	return false;
@@ -1780,7 +1781,7 @@ static inline int inc_valid_block_count(struct f2fs_sb_info *sbi,
		return ret;
		return ret;


	if (time_to_inject(sbi, FAULT_BLOCK)) {
	if (time_to_inject(sbi, FAULT_BLOCK)) {
		f2fs_show_injection_info(FAULT_BLOCK);
		f2fs_show_injection_info(sbi, FAULT_BLOCK);
		release = *count;
		release = *count;
		goto release_quota;
		goto release_quota;
	}
	}
@@ -2032,7 +2033,7 @@ static inline int inc_valid_node_count(struct f2fs_sb_info *sbi,
	}
	}


	if (time_to_inject(sbi, FAULT_BLOCK)) {
	if (time_to_inject(sbi, FAULT_BLOCK)) {
		f2fs_show_injection_info(FAULT_BLOCK);
		f2fs_show_injection_info(sbi, FAULT_BLOCK);
		goto enospc;
		goto enospc;
	}
	}


@@ -2147,7 +2148,8 @@ static inline struct page *f2fs_grab_cache_page(struct address_space *mapping,
			return page;
			return page;


		if (time_to_inject(F2FS_M_SB(mapping), FAULT_PAGE_ALLOC)) {
		if (time_to_inject(F2FS_M_SB(mapping), FAULT_PAGE_ALLOC)) {
			f2fs_show_injection_info(FAULT_PAGE_ALLOC);
			f2fs_show_injection_info(F2FS_M_SB(mapping),
							FAULT_PAGE_ALLOC);
			return NULL;
			return NULL;
		}
		}
	}
	}
@@ -2162,7 +2164,7 @@ static inline struct page *f2fs_pagecache_get_page(
				int fgp_flags, gfp_t gfp_mask)
				int fgp_flags, gfp_t gfp_mask)
{
{
	if (time_to_inject(F2FS_M_SB(mapping), FAULT_PAGE_GET)) {
	if (time_to_inject(F2FS_M_SB(mapping), FAULT_PAGE_GET)) {
		f2fs_show_injection_info(FAULT_PAGE_GET);
		f2fs_show_injection_info(F2FS_M_SB(mapping), FAULT_PAGE_GET);
		return NULL;
		return NULL;
	}
	}


@@ -2231,7 +2233,7 @@ static inline struct bio *f2fs_bio_alloc(struct f2fs_sb_info *sbi,
		return bio;
		return bio;
	}
	}
	if (time_to_inject(sbi, FAULT_ALLOC_BIO)) {
	if (time_to_inject(sbi, FAULT_ALLOC_BIO)) {
		f2fs_show_injection_info(FAULT_ALLOC_BIO);
		f2fs_show_injection_info(sbi, FAULT_ALLOC_BIO);
		return NULL;
		return NULL;
	}
	}


@@ -2798,7 +2800,7 @@ static inline void *f2fs_kmalloc(struct f2fs_sb_info *sbi,
	void *ret;
	void *ret;


	if (time_to_inject(sbi, FAULT_KMALLOC)) {
	if (time_to_inject(sbi, FAULT_KMALLOC)) {
		f2fs_show_injection_info(FAULT_KMALLOC);
		f2fs_show_injection_info(sbi, FAULT_KMALLOC);
		return NULL;
		return NULL;
	}
	}


@@ -2819,7 +2821,7 @@ static inline void *f2fs_kvmalloc(struct f2fs_sb_info *sbi,
					size_t size, gfp_t flags)
					size_t size, gfp_t flags)
{
{
	if (time_to_inject(sbi, FAULT_KVMALLOC)) {
	if (time_to_inject(sbi, FAULT_KVMALLOC)) {
		f2fs_show_injection_info(FAULT_KVMALLOC);
		f2fs_show_injection_info(sbi, FAULT_KVMALLOC);
		return NULL;
		return NULL;
	}
	}


+1 −1
Original line number Original line Diff line number Diff line
@@ -680,7 +680,7 @@ int f2fs_truncate(struct inode *inode)
	trace_f2fs_truncate(inode);
	trace_f2fs_truncate(inode);


	if (time_to_inject(F2FS_I_SB(inode), FAULT_TRUNCATE)) {
	if (time_to_inject(F2FS_I_SB(inode), FAULT_TRUNCATE)) {
		f2fs_show_injection_info(FAULT_TRUNCATE);
		f2fs_show_injection_info(F2FS_I_SB(inode), FAULT_TRUNCATE);
		return -EIO;
		return -EIO;
	}
	}


Loading