Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4743659pxj; Tue, 22 Jun 2021 07:08:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzc+yhFUrpjwqmgoo4IZQTtiXU4aiR/uopJh3JjoYCh1kUBd9BEd6AE2FoeGJXalFY8G/SG X-Received: by 2002:aa7:c845:: with SMTP id g5mr5314738edt.306.1624370923975; Tue, 22 Jun 2021 07:08:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624370923; cv=none; d=google.com; s=arc-20160816; b=uVDfS35MW/QTnaZBeWwl3Lbk9BMiVG3tzNJI9nejwGIMULlgH24wMhZUaTKvMhijFA UJNmZhfQBY/LBBuVb6Sbc6lv5lpdWDSoQLzDp3/MMJJrhurWomxgOYi/5MJerc3LRKwX jYWJSyQ8n5iDIQMyc5zni4CLe7r//YQL6084lGKJFbEDFCbcpGrqNfYMFUSeiMm6AZR4 ww43fThOODpDu6E7w1TyN2QrhIh1N1wTghH65N2t45I7XkdG7fVDsnDTNqjOglVRf/im qVsmcTIoLynz74mAT0hLk7L10qY51WoU+IGgl29pJdu432cUXaDPTuZxrZzdRvjXtp06 aIzw== 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=lYz1c6Q0oO1bk8WCh5Xd95X8h0ySiKal5LgsodUlhHQ=; b=tnUzJ8rSpj/T6yCQVGNF5KbA8fQMBQyMDEJ2oO1qGlizmHotHDbAUUIRaAZ4rAEnjJ 7acUsZaB/A68OxR31R7qVCTufHj+uPkWw6rUcIpbbq5rnV3vwXe5ezwBbOizJ3Q0P2oi 59MpLl6FrcWEf7f9DX6osKglgP4Lcu4sHZs75j05nqdSlEpIMsseK0FO3J9szU8VgUGc 9Je/rXFised8dJ4kb9Qc51xn/DIsglGHFGmoTQZ52TbZx5776RrnC7iyDyIwSom3jGDc Ya2NBVQx2DMCj2Jd0nAfeTYmbu3rjIe9DSNJIhdG7QvclC4fkxvj5JrA48GMoprg3emi 9fVw== 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 hz21si6826167ejc.626.2021.06.22.07.08.05; Tue, 22 Jun 2021 07:08:43 -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 S231589AbhFVOJN (ORCPT + 99 others); Tue, 22 Jun 2021 10:09:13 -0400 Received: from foss.arm.com ([217.140.110.172]:49792 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230160AbhFVOJM (ORCPT ); Tue, 22 Jun 2021 10:09:12 -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 889B9ED1; Tue, 22 Jun 2021 07:06:56 -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 5E7273F694; Tue, 22 Jun 2021 07:06:51 -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 , Christoph Hellwig , nd@arm.com, Jia He Subject: [PATCH v5 0/4] make '%pD' print the full path of file Date: Tue, 22 Jun 2021 22:06:30 +0800 Message-Id: <20210622140634.2436-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 the full path of 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. Link: https://lkml.org/lkml/2021/5/18/1260 [1] 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 ========= v5: - remove the RFC tag - refine the commit msg/comments(by Petr, Andy) - make using_scratch_space a new parameter of the test case 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 (3): fs: introduce helper d_path_unsafe() lib/vsprintf.c: make '%pD' print the full path of file lib/test_printf.c: add test cases for '%pD' Rasmus Villemoes (1): lib/test_printf.c: split write-beyond-buffer check in two Documentation/core-api/printk-formats.rst | 5 +- fs/d_path.c | 104 +++++++++++++++++++++- include/linux/dcache.h | 1 + lib/test_printf.c | 54 ++++++++--- lib/vsprintf.c | 40 ++++++++- 5 files changed, 184 insertions(+), 20 deletions(-) -- 2.17.1