[PATCH RFC 0/3] make '%pD' print full path for file

From: Jia He
Date: Sat May 08 2021 - 08:29:16 EST


At [1], Linux suggested printing full path for file instead of printing
the components as '%pd'.

Typically, there is no need for printk specifiers to take any real locks
(ie mount_lock or rename_lock). So I introduce a new helper d_path_fast
which is similar to d_path except not taking any seqlock/spinlock.

The cases I tested:
1. print %pD with full path when opening a ext4 file
2. mount a ext4 filesystem upon a ext4 filesystem, and print the file
with %pD
3. print the file full path which has more than 128 chars
4. all test_print selftests

After this set, I noticed there are many lines which contained "%pD[234]"
that should be changed to "%pD". I don't want to involve those
subsystems in this patch series before the helper is satisfied with
everyone.

You can get the lines by
$find fs/ -name \*.[ch] | xargs grep -rn "\%pD[234]"

[1] https://lore.kernel.org/lkml/CAHk-=wimsMqGdzik187YWLb-ru+iktb4MYbMQG1rnZ81dXYFVg@xxxxxxxxxxxxxx/

Jia He (3):
fs: introduce helper d_path_fast()
lib/vsprintf.c: make %pD print full path for file
s390/hmcdrv: remove the redundant directory path in debug message

Documentation/core-api/printk-formats.rst | 5 ++-
drivers/s390/char/hmcdrv_dev.c | 10 ++---
fs/d_path.c | 51 +++++++++++++++++------
include/linux/dcache.h | 1 +
lib/vsprintf.c | 12 +++++-
5 files changed, 58 insertions(+), 21 deletions(-)

--
2.17.1