Skip to contentSkip to conversation

ext4: don't print warnings on successful MMP read completion

PATCH In review Darrick J. Wong 2 participants 3 messages Sep 30, 2015 – Oct 1, 2015 ext4 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ext4: don't print warnings on successful MMP read completion

If the MMP block reads without error, don't spam dmesg with warnings.

---
 fs/ext4/mmp.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/ext4/mmp.c +3 -2
index 6eb1a61..7bc0873 100644
@@ -104,8 +104,9 @@ static int read_mmp_block(struct super_block *sb, struct buffer_head **bh,
 	ret = -EINVAL;
 
 warn_exit:
-	ext4_warning(sb, "Error %d while reading MMP block %llu",
-		     ret, mmp_block);
+	if (ret)
+		ext4_warning(sb, "Error %d while reading MMP block %llu",
+			     ret, mmp_block);
 	return ret;
 }
 
#1 lore raw
Quoted 2 lines · Darrick J. Wong

If the MMP block reads without error, don't spam dmesg with warnings.

It is hard to tell from the patch context here, but in the version of read_mmp_block() I have (v4.3-rc3-55-gdd36d73) the only way to get to warn_exit: is if there is an error already.

fs/ext4/mmp.c static int read_mmp_block(struct super_block *sb, struct buffer_head **bh,

Quoted 5 lines
fs/ext4/mmp.c +0 -0
index 6eb1a61..7bc0873 100644
@@ -104,8 +104,9 @@ static int read_mmp_block(struct super_block *sb, struct buffer_head **bh,

The preceding few lines are as follows, and all of the jumps to warn_exit before this set ret != 0:

        mmp = (struct mmp_struct *)((*bh)->b_data);
        if (le32_to_cpu(mmp->mmp_magic) == EXT4_MMP_MAGIC &&
            ext4_mmp_csum_verify(sb, mmp))
                return 0;
Quoted 10 lines
fs/ext4/mmp.c +0 -0
 	ret = -EINVAL;
 

warn_exit:

fs/ext4/mmp.c +3 -2
-	ext4_warning(sb, "Error %d while reading MMP block %llu",
-		     ret, mmp_block);
+	if (ret)
+		ext4_warning(sb, "Error %d while reading MMP block %llu",
+			     ret, mmp_block);
	return ret;
}

How does this code get to warn_exit: without setting ret?

Cheers, Andreas

#2 lore raw
Quoted 7 lines · Andreas Dilger
Quoted 2 lines · Darrick J. Wong

If the MMP block reads without error, don't spam dmesg with warnings.

It is hard to tell from the patch context here, but in the version of read_mmp_block() I have (v4.3-rc3-55-gdd36d73) the only way to get to warn_exit: is if there is an error already.

Aha! I'd forgotten that this patch came after an (unreleased) patch to change all the checksum and corruption errors to report the same codes as XFS. Without /that/ patch, this one is unnecessary.

Sorry for the noise, everyone can disregard this (for now).

--D

Quoted 33 lines

fs/ext4/mmp.c static int read_mmp_block(struct super_block *sb, struct buffer_head **bh,

Quoted 6 lines
fs/ext4/mmp.c +0 -0
index 6eb1a61..7bc0873 100644
@@ -104,8 +104,9 @@ static int read_mmp_block(struct super_block *sb, struct buffer_head **bh,

The preceding few lines are as follows, and all of the jumps to warn_exit before this set ret != 0:

        mmp = (struct mmp_struct *)((*bh)->b_data);
        if (le32_to_cpu(mmp->mmp_magic) == EXT4_MMP_MAGIC &&
            ext4_mmp_csum_verify(sb, mmp))
                return 0;
Quoted 10 lines
fs/ext4/mmp.c +0 -0
 	ret = -EINVAL;
 

warn_exit:

fs/ext4/mmp.c +3 -2
-	ext4_warning(sb, "Error %d while reading MMP block %llu",
-		     ret, mmp_block);
+	if (ret)
+		ext4_warning(sb, "Error %d while reading MMP block %llu",
+			     ret, mmp_block);
	return ret;
}

How does this code get to warn_exit: without setting ret?

Cheers, Andreas