Ratelimit the error message of zeroing out data between the valid size and the file size in exfat_file_mmap() to not flood dmesg. Signed-off-by: Yuezhang Mo <Yuezhang.Mo@xxxxxxxx> --- fs/exfat/exfat_fs.h | 5 +++++ fs/exfat/file.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h index 9474cd50da6d..46f2760d9846 100644 --- a/fs/exfat/exfat_fs.h +++ b/fs/exfat/exfat_fs.h @@ -542,6 +542,11 @@ void __exfat_fs_error(struct super_block *sb, int report, const char *fmt, ...) /* expand to pr_*() with prefix */ #define exfat_err(sb, fmt, ...) \ pr_err("exFAT-fs (%s): " fmt "\n", (sb)->s_id, ##__VA_ARGS__) +#define exfat_err_ratelimit(sb, fmt, args...) \ + do { \ + if (__ratelimit(&EXFAT_SB(sb)->ratelimit)) \ + exfat_err(sb, fmt, ## args); \ + } while (0) #define exfat_warn(sb, fmt, ...) \ pr_warn("exFAT-fs (%s): " fmt "\n", (sb)->s_id, ##__VA_ARGS__) #define exfat_info(sb, fmt, ...) \ diff --git a/fs/exfat/file.c b/fs/exfat/file.c index 473c1641d50d..68405ae06772 100644 --- a/fs/exfat/file.c +++ b/fs/exfat/file.c @@ -619,7 +619,7 @@ static int exfat_file_mmap(struct file *file, struct vm_area_struct *vma) ret = exfat_file_zeroed_range(file, ei->valid_size, end); inode_unlock(inode); if (ret < 0) { - exfat_err(inode->i_sb, + exfat_err_ratelimit(inode->i_sb, "mmap: fail to zero from %llu to %llu(%d)", start, end, ret); return ret; -- 2.34.1
Attachment:
v1-0001-exfat-ratelimit-error-msg-in-exfat_file_mmap.patch
Description: v1-0001-exfat-ratelimit-error-msg-in-exfat_file_mmap.patch