From patchwork Tue May 17 21:55:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 9115361 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BEB2B9F1C1 for ; Tue, 17 May 2016 21:55:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D7D552022A for ; Tue, 17 May 2016 21:55:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E371020148 for ; Tue, 17 May 2016 21:55:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751302AbcEQVz0 (ORCPT ); Tue, 17 May 2016 17:55:26 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35091 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750867AbcEQVzZ (ORCPT ); Tue, 17 May 2016 17:55:25 -0400 Received: by mail-wm0-f65.google.com with SMTP id g17so1547703wme.2 for ; Tue, 17 May 2016 14:55:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=y3ijy49pHW6pkOOEUMv+kESK/4E2J+bGHPPRj9qf7yM=; b=CbhehR/vWJICw1B4i4bLZHtCiG9VZi4eL/84ietVkCCqF45/y518yz7NVX1fyv6qdi lKxTdkEn1hFCHqKkgho7rm9NqJb+rQ5tQmcRbEAYm+G5lPoEUf0d4Szy4TQgLdEfOapc 3LMzNY0WLc0KPbMixb7bKB+vaSMNMGepuKjMY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=y3ijy49pHW6pkOOEUMv+kESK/4E2J+bGHPPRj9qf7yM=; b=EOORSSRdGCYn/cmg08TtdpXsuizK3Ock9yrug60N2KoN2MO3eUB0xUtKzjoPLOy9Xd xG06sMgNt91Dj75eZxGgVZ48qdwYcRYA3eV7H4NGoUUkIh8ABZEgzdMsA499Thb36YXq WBVW6twpNhTlAAESnMyoTYknSJFukR8jhvruSEc+q10bWsLckjyqgos8JF9tQP5az0an 9k6brZqTZDrfP/AEx1e+p716+KjOKBgS7GBQztpGCTP/XdFHLHDqO+1lMJbKVIY8aA+C jQ9J5EYHWgD9bWsRl28gRDZGZfEnBIUQk0U2zmqlwLnSHZpzIeqqaAZfwpERvGomndsn q7TQ== X-Gm-Message-State: AOPr4FX0qUOgOvhbCJcOzbbGtZjOv0vdWJVeUwN1eia8ea54nNCHPWxj5oiRBN00Xm/21A== X-Received: by 10.28.20.144 with SMTP id 138mr3669295wmu.103.1463522123738; Tue, 17 May 2016 14:55:23 -0700 (PDT) Received: from veci.piliscsaba.szeredi.hu (pool-dsl-2c-0018.externet.hu. [217.173.44.24]) by smtp.gmail.com with ESMTPSA id i1sm5183268wjd.38.2016.05.17.14.55.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 May 2016 14:55:22 -0700 (PDT) Date: Tue, 17 May 2016 23:55:20 +0200 From: Miklos Szeredi To: Al Viro Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, David Howells Subject: [PATCH 2/3] vfs: document ->d_real() Message-ID: <20160517215520.GB1589@veci.piliscsaba.szeredi.hu> References: <20160517215326.GA1589@veci.piliscsaba.szeredi.hu> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160517215326.GA1589@veci.piliscsaba.szeredi.hu> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add missing documentation for the d_op->d_real() method and d_real() helper. Signed-off-by: Miklos Szeredi --- Documentation/filesystems/Locking | 2 ++ Documentation/filesystems/vfs.txt | 19 +++++++++++++++++++ include/linux/dcache.h | 7 +++++++ 3 files changed, 28 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/Documentation/filesystems/Locking +++ b/Documentation/filesystems/Locking @@ -20,6 +20,7 @@ be able to use diff(1). char *(*d_dname)((struct dentry *dentry, char *buffer, int buflen); struct vfsmount *(*d_automount)(struct path *path); int (*d_manage)(struct dentry *, bool); + struct dentry *(*d_real)(struct dentry *, struct inode *, unsigned int); locking rules: rename_lock ->d_lock may block rcu-walk @@ -34,6 +35,7 @@ d_iput: no no yes no d_dname: no no no no d_automount: no no yes no d_manage: no no yes (ref-walk) maybe +d_real no no yes no --------------------------- inode_operations --------------------------- prototypes: --- a/Documentation/filesystems/vfs.txt +++ b/Documentation/filesystems/vfs.txt @@ -938,6 +938,7 @@ struct dentry_operations { char *(*d_dname)(struct dentry *, char *, int); struct vfsmount *(*d_automount)(struct path *); int (*d_manage)(struct dentry *, bool); + struct dentry *(*d_real)(struct dentry *, struct inode *, unsigned int); }; d_revalidate: called when the VFS needs to revalidate a dentry. This @@ -1060,6 +1061,24 @@ struct dentry_operations { This function is only used if DCACHE_MANAGE_TRANSIT is set on the dentry being transited from. + d_real: overlay/union type filesystems implement this method to return one of + the underlying dentries hidden by the overlay. It is used in three + different modes: + + Called from open it may need to copy-up the file depending on the + supplied open flags. This mode is selected with a non-zero flags + argument. In this mode the d_real method can return an error. + + Called from file_dentry() it returns the real dentry matching the inode + argument. The real dentry may be from a lower layer already copied up, + but still referenced from the file. This mode is selected with a + non-NULL inode argument. This will always succeed. + + With NULL inode and zero flags the topmost real underlying dentry is + returned. This will always succeed. + + This method is never called with both non-NULL inode and non-zero flags. + Example : static char *pipefs_dname(struct dentry *dent, char *buffer, int buflen) --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -554,6 +554,13 @@ static inline struct dentry *d_backing_d return upper; } +/** + * d_real - Return the real dentry + * @dentry: The dentry to query + * + * If dentry is on an union/overlay, then return the underlying, real dentry. + * Otherwise return the dentry itself. + */ static inline struct dentry *d_real(struct dentry *dentry) { if (unlikely(dentry->d_flags & DCACHE_OP_REAL))