[PATCH RFC 09/13] mm/filemap: simplify the printing with '%pD' specifier

From: Jia He
Date: Wed Jul 14 2021 - 23:16:32 EST


After the behavior of '%pD' is changed to print the full path of file,
the log printing in dio_warn_stale_pagecache() can be simplified.

Given that the error case is well handled in d_path_unsafe(), the error
string would be copied in '%pD' buffer, no need to additionally handle
IS_ERR().

Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: linux-mm@xxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Signed-off-by: Jia He <justin.he@xxxxxxx>
---
mm/filemap.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index d1458ecf2f51..477288017765 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -3497,16 +3497,11 @@ EXPORT_SYMBOL(pagecache_write_end);
void dio_warn_stale_pagecache(struct file *filp)
{
static DEFINE_RATELIMIT_STATE(_rs, 86400 * HZ, DEFAULT_RATELIMIT_BURST);
- char pathname[128];
- char *path;

errseq_set(&filp->f_mapping->wb_err, -EIO);
if (__ratelimit(&_rs)) {
- path = file_path(filp, pathname, sizeof(pathname));
- if (IS_ERR(path))
- path = "(unknown)";
pr_crit("Page cache invalidation failure on direct I/O. Possible data corruption due to collision with buffered I/O!\n");
- pr_crit("File: %s PID: %d Comm: %.20s\n", path, current->pid,
+ pr_crit("File: %pD PID: %d Comm: %.20s\n", filp, current->pid,
current->comm);
}
}
--
2.17.1