diff mbox series

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

Message ID 20210715031533.9553-10-justin.he@arm.com (mailing list archive)
State New
Headers show
Series None | expand

Commit Message

Justin He July 15, 2021, 3:15 a.m. UTC
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@linux-foundation.org>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Jia He <justin.he@arm.com>
---
 mm/filemap.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
diff mbox series

Patch

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);
 	}
 }