Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3801296pxj; Tue, 15 Jun 2021 08:57:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQshh/5mqhWN0ns6JWZ1jLbCqJjda+cbksd48K5j4KgCv2cxCGlcgd0PKZlWrVIlzI4slX X-Received: by 2002:a17:906:3c56:: with SMTP id i22mr193745ejg.369.1623772632832; Tue, 15 Jun 2021 08:57:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623772632; cv=none; d=google.com; s=arc-20160816; b=tLfxqv/STZGh9B3evfyJwHFpP9+hIpIvovLT0FZ49j576tJQUPh3QndUJSMbGS9p8L orriTgEkFzP9bKVYCrBiV8AGVZsuB3barCUty7Z4/fCHYde9SYqKbyCnUdABRxHbHpaQ vvigh6/ttKym1shwNCrfPfLtmqTAU4A2J71/KqaYghuw4ycomem4SeWS5KFxVPi6P012 SqgE3RBiOD9zuJjKrODg1hsT/wY+P4yq1i5leoWzPOVGLei0wHSwKZduL+Bq64NXP3Di AXcLkpacLC+fnLpN3LxoeTXs13dfo0sEv5oC2FIFqATqxC/QirzW1PoGTjhQOFOa8PtP B8LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=cHxLKMBuj2crHjtFQ/t2+m1U2kls6sfigOMZ8lAAcfc=; b=phJT7V6zAUsa5KO3XWUsn0gc85WF/vANJCtziYHky96n1/1yj8j5jgSdiy9uWYnz+e cdZAxt2qUyVRvCO3ThwNOOWB5LOYh41k0D33vGyo7DXSGJSvVd+SdapE4Eut1EbU5JhI N9Kw/VV99ACqKyWREi0szajLQAFHv3ExE6gikzkF8q2Har29E4xRkOVagL628TC4XZYH QVgDTcS3JDBVHtnHwf099nL0BBAoTNw0sJZQEYEjVdgGFdCK+/SrtuPKQuycPit2ulnO 8+1frD57n+HEUTVChUZ+vE+iJXYB9OzNYf2T5YCp0sU+ZAEAjzkIMlchLDxybTUyYNbu +Rtg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j20si16317896edp.274.2021.06.15.08.56.48; Tue, 15 Jun 2021 08:57:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232513AbhFOPzC (ORCPT + 99 others); Tue, 15 Jun 2021 11:55:02 -0400 Received: from foss.arm.com ([217.140.110.172]:39002 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232169AbhFOPwI (ORCPT ); Tue, 15 Jun 2021 11:52:08 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B60E913A1; Tue, 15 Jun 2021 08:50:03 -0700 (PDT) Received: from entos-ampere-02.shanghai.arm.com (entos-ampere-02.shanghai.arm.com [10.169.214.103]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 102773F694; Tue, 15 Jun 2021 08:49:58 -0700 (PDT) From: Jia He To: Petr Mladek , Steven Rostedt , Sergey Senozhatsky , Andy Shevchenko , Rasmus Villemoes , Jonathan Corbet , Alexander Viro , Linus Torvalds Cc: "Peter Zijlstra (Intel)" , Eric Biggers , "Ahmed S. Darwish" , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Matthew Wilcox , Jia He Subject: [PATCH RFCv4 0/4] make '%pD' print full path for file Date: Tue, 15 Jun 2021 23:49:48 +0800 Message-Id: <20210615154952.2744-1-justin.he@arm.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Background ========== Linus 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 it doesn't take any seqlock/spinlock. This series is based on Al Viro's d_path cleanup patches [1] which lifted the inner lockless loop into a new helper. [1] https://lkml.org/lkml/2021/5/18/1260 Test ==== The cases I tested: 1. print '%pD' with full path of ext4 file 2. mount a ext4 filesystem upon a ext4 filesystem, and print the file with '%pD' 3. all test_print selftests, including the new '%14pD' '%-14pD' 4. kasnprintf Changelog ========= v4: - don't support spec.precision anymore for '%pD' - add Rasmus's patch into this series v3: - implement new d_path_unsafe to use [buf, end] instead of stack space for filling bytes (by Matthew) - add new test cases for '%pD' - drop patch "hmcdrv: remove the redundant directory path" before removing rfc. v2: - implement new d_path_fast based on Al Viro's patches - add check_pointer check (by Petr) - change the max full path size to 256 in stack space v1: https://lkml.org/lkml/2021/5/8/122 Jia He (4): fs: introduce helper d_path_unsafe() lib/vsprintf.c: make '%pD' print full path for file lib/test_printf.c: split write-beyond-buffer check in two lib/test_printf.c: add test cases for '%pD' Documentation/core-api/printk-formats.rst | 5 +- fs/d_path.c | 83 ++++++++++++++++++++++- include/linux/dcache.h | 1 + lib/test_printf.c | 31 ++++++++- lib/vsprintf.c | 37 ++++++++-- 5 files changed, 148 insertions(+), 9 deletions(-) -- 2.17.1