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

Commit c398eda0 authored by Theodore Ts'o's avatar Theodore Ts'o
Browse files

ext4: Pass line numbers to ext4_error() and friends



Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
parent 60fd4da3
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -84,11 +84,10 @@ int __ext4_check_dir_entry(const char *function, unsigned int line,
		error_msg = "inode out of bounds";

	if (error_msg != NULL)
		ext4_error_inode(function, dir,
			"bad entry in directory: %s - block=%llu"
		ext4_error_inode(dir, function, line, bh->b_blocknr,
			"bad entry in directory: %s - "
			"offset=%u(%u), inode=%u, rec_len=%d, name_len=%d",
			error_msg, (unsigned long long) bh->b_blocknr,
			(unsigned) (offset%bh->b_size), offset,
			error_msg, (unsigned) (offset%bh->b_size), offset,
			le32_to_cpu(de->inode),
			rlen, de->name_len);
	return error_msg == NULL ? 1 : 0;
+27 −17
Original line number Diff line number Diff line
@@ -57,10 +57,13 @@
#endif

#define EXT4_ERROR_INODE(inode, fmt, a...) \
	ext4_error_inode(__func__, (inode), (fmt), ## a)
	ext4_error_inode((inode), __func__, __LINE__, 0, (fmt), ## a)

#define EXT4_ERROR_INODE_BLOCK(inode, block, fmt, a...)			\
	ext4_error_inode((inode), __func__, __LINE__, (block), (fmt), ## a)

#define EXT4_ERROR_FILE(file, fmt, a...)	\
	ext4_error_file(__func__, (file), (fmt), ## a)
	ext4_error_file(__func__, __LINE__, (file), (fmt), ## a)

/* data type for block offset of block group */
typedef int ext4_grpblk_t;
@@ -1623,22 +1626,29 @@ extern int ext4_group_extend(struct super_block *sb,
				ext4_fsblk_t n_blocks_count);

/* super.c */
extern void __ext4_error(struct super_block *, const char *, const char *, ...)
	__attribute__ ((format (printf, 3, 4)));
#define ext4_error(sb, message...)	__ext4_error(sb, __func__, ## message)
extern void ext4_error_inode(const char *, struct inode *, const char *, ...)
	__attribute__ ((format (printf, 3, 4)));
extern void ext4_error_file(const char *, struct file *, const char *, ...)
	__attribute__ ((format (printf, 3, 4)));
extern void __ext4_std_error(struct super_block *, const char *, int);
extern void __ext4_abort(struct super_block *, const char *, const char *, ...)
	__attribute__ ((format (printf, 3, 4)));
extern void __ext4_error(struct super_block *, const char *, unsigned int,
			 const char *, ...)
	__attribute__ ((format (printf, 4, 5)));
#define ext4_error(sb, message...)	__ext4_error(sb, __func__,	\
						     __LINE__, ## message)
extern void ext4_error_inode(struct inode *, const char *, unsigned int,
			     ext4_fsblk_t, const char *, ...)
	__attribute__ ((format (printf, 5, 6)));
extern void ext4_error_file(struct file *, const char *, unsigned int,
			    const char *, ...)
	__attribute__ ((format (printf, 4, 5)));
extern void __ext4_std_error(struct super_block *, const char *,
			     unsigned int, int);
extern void __ext4_abort(struct super_block *, const char *, unsigned int,
		       const char *, ...)
	__attribute__ ((format (printf, 4, 5)));
#define ext4_abort(sb, message...)	__ext4_abort(sb, __func__, \
						     ## message)
extern void __ext4_warning(struct super_block *, const char *,
						       __LINE__, ## message)
extern void __ext4_warning(struct super_block *, const char *, unsigned int,
			  const char *, ...)
	__attribute__ ((format (printf, 3, 4)));
#define ext4_warning(sb, message...)	__ext4_warning(sb, __func__, ## message)
	__attribute__ ((format (printf, 4, 5)));
#define ext4_warning(sb, message...)	__ext4_warning(sb, __func__, \
						       __LINE__, ## message)
extern void ext4_msg(struct super_block *, const char *, const char *, ...)
	__attribute__ ((format (printf, 3, 4)));
extern void __ext4_grp_locked_error(const char *, unsigned int, \
@@ -1781,7 +1791,7 @@ static inline unsigned int ext4_flex_bg_size(struct ext4_sb_info *sbi)
#define ext4_std_error(sb, errno)				\
do {								\
	if ((errno))						\
		__ext4_std_error((sb), __func__, (errno));	\
		__ext4_std_error((sb), __func__, __LINE__, (errno));	\
} while (0)

#ifdef CONFIG_SMP
+5 −7
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ int __ext4_forget(const char *where, unsigned int line, handle_t *handle,
	if (err) {
		ext4_journal_abort_handle(where, line, __func__,
					  bh, handle, err);
		__ext4_abort(inode->i_sb, where,
		__ext4_abort(inode->i_sb, where, line,
			   "error %d when attempting revoke", err);
	}
	BUFFER_TRACE(bh, "exit");
@@ -134,11 +134,9 @@ int __ext4_handle_dirty_metadata(const char *where, unsigned int line,
		if (inode && inode_needs_sync(inode)) {
			sync_dirty_buffer(bh);
			if (buffer_req(bh) && !buffer_uptodate(bh)) {
				ext4_error(inode->i_sb,
					   "IO error syncing inode, "
					   "inode=%lu, block=%llu",
					   inode->i_ino,
					   (unsigned long long) bh->b_blocknr);
				ext4_error_inode(inode, where, line,
						 bh->b_blocknr,
					"IO error syncing itable block");
				err = -EIO;
			}
		}
+2 −2
Original line number Diff line number Diff line
@@ -162,7 +162,7 @@ int __ext4_handle_dirty_super(const char *where, unsigned int line,
	__ext4_handle_dirty_super(__func__, __LINE__, (handle), (sb))

handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks);
int __ext4_journal_stop(const char *where, handle_t *handle);
int __ext4_journal_stop(const char *where, unsigned int line, handle_t *handle);

#define EXT4_NOJOURNAL_MAX_REF_COUNT ((unsigned long) 4096)

@@ -215,7 +215,7 @@ static inline handle_t *ext4_journal_start(struct inode *inode, int nblocks)
}

#define ext4_journal_stop(handle) \
	__ext4_journal_stop(__func__, (handle))
	__ext4_journal_stop(__func__, __LINE__, (handle))

static inline handle_t *ext4_journal_current_handle(void)
{
+5 −5
Original line number Diff line number Diff line
@@ -401,8 +401,8 @@ static int ext4_valid_extent_entries(struct inode *inode,
	return 1;
}

static int __ext4_ext_check(const char *function, struct inode *inode,
					struct ext4_extent_header *eh,
static int __ext4_ext_check(const char *function, unsigned int line,
			    struct inode *inode, struct ext4_extent_header *eh,
			    int depth)
{
	const char *error_msg;
@@ -436,7 +436,7 @@ static int __ext4_ext_check(const char *function, struct inode *inode,
	return 0;

corrupted:
	ext4_error_inode(function, inode,
	ext4_error_inode(inode, function, line, 0,
			"bad header/extent: %s - magic %x, "
			"entries %u, max %u(%u), depth %u(%u)",
			error_msg, le16_to_cpu(eh->eh_magic),
@@ -447,7 +447,7 @@ corrupted:
}

#define ext4_ext_check(inode, eh, depth)	\
	__ext4_ext_check(__func__, inode, eh, depth)
	__ext4_ext_check(__func__, __LINE__, inode, eh, depth)

int ext4_ext_check_inode(struct inode *inode)
{
Loading