* [PATCH RFC 09/13] mm/filemap: simplify the printing with '%pD' specifier
[not found] <20210715031533.9553-1-justin.he@arm.com>
@ 2021-07-15 3:15 ` Jia He
2021-07-15 3:15 ` [PATCH RFC 12/13] mm: simplify the printing with '%pd' specifier Jia He
1 sibling, 0 replies; 2+ messages in thread
From: Jia He @ 2021-07-15 3:15 UTC (permalink / raw)
To: linux-kernel
Cc: Linus Torvalds, Christoph Hellwig, nd, Jia He, Andrew Morton,
linux-mm
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 --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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH RFC 12/13] mm: simplify the printing with '%pd' specifier
[not found] <20210715031533.9553-1-justin.he@arm.com>
2021-07-15 3:15 ` [PATCH RFC 09/13] mm/filemap: simplify the printing with '%pD' specifier Jia He
@ 2021-07-15 3:15 ` Jia He
1 sibling, 0 replies; 2+ messages in thread
From: Jia He @ 2021-07-15 3:15 UTC (permalink / raw)
To: linux-kernel
Cc: Linus Torvalds, Christoph Hellwig, nd, Jia He, Andrew Morton,
linux-mm
Use '%pd' to simplify the printing since kbasename(file_path()) is to
get the last dentry of the full path.
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/memory.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/mm/memory.c b/mm/memory.c
index 747a01d495f2..350692ada6f7 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -5217,18 +5217,14 @@ void print_vma_addr(char *prefix, unsigned long ip)
vma = find_vma(mm, ip);
if (vma && vma->vm_file) {
struct file *f = vma->vm_file;
- char *buf = (char *)__get_free_page(GFP_NOWAIT);
- if (buf) {
- char *p;
-
- p = file_path(f, buf, PAGE_SIZE);
- if (IS_ERR(p))
- p = "?";
- printk("%s%s[%lx+%lx]", prefix, kbasename(p),
+
+ if (f)
+ printk("%s%pd[%lx+%lx]", prefix, f->f_path.dentry,
vma->vm_start,
vma->vm_end - vma->vm_start);
- free_page((unsigned long)buf);
- }
+ else
+ printk("%s?[%lx+%lx]", prefix, vma->vm_start,
+ vma->vm_end - vma->vm_start);
}
mmap_read_unlock(mm);
}
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-07-15 3:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20210715031533.9553-1-justin.he@arm.com>
2021-07-15 3:15 ` [PATCH RFC 09/13] mm/filemap: simplify the printing with '%pD' specifier Jia He
2021-07-15 3:15 ` [PATCH RFC 12/13] mm: simplify the printing with '%pd' specifier Jia He
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).