Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2807753pxb; Mon, 18 Oct 2021 02:13:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7MRdoTSY55s5k9iD2MLfCYeSuI9VdpTnFSePismWD2PVHcm2U2QML+EPpigrUEO2Ota7a X-Received: by 2002:a50:998c:: with SMTP id m12mr35295497edb.19.1634548403819; Mon, 18 Oct 2021 02:13:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634548403; cv=none; d=google.com; s=arc-20160816; b=cnTBR5j2TCMfURoPiatf23CQXTh8MIzEAm0dPvf2+g9bpzpGpjADHZ+b7Gm/Rygoo6 TN/SLlOShPRC4IjG5VGQilUGxTNSb4PwHWHjllGFOBVlwBpYkrYhztl+v6LN04K6PPT5 d+/jRJ7a0SLgM+SYEAfqOvY6MdKX2j/nGttxZZfjFTzqkCLpDuOmS2304Sh7dtGMKf3E DFCLRpDB7Z6rSgEKjseJosYc1Nh1LVW24GoBX69ACxOOgOBRGytQmZq4AN/SiUOYkKkQ j3jqwGXW8ihaYJjOyu2RgJsgUee0ypdC4N6zbFNPe0j5GkkiILGu9w2dwkVcxed/KwI5 Sr5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=eF2Rifqt8ucpeEBozDyQtYsm3MGnDcqBDObeOW5swFI=; b=NnDr4UfFHl+d3RlwjBfIdSIYDhyHAP6U0zm0u0P2l25bFvRMN0ADXoc/tWxYVYjY7f 2Ai1HCWswB7szP3UBzZIfI5d5MMTImWSfK8JZS2H3UyIv5sQNn9WsU5liM3rccO7RCpC zChV/+rEJ9MkB7vhEa8WQWsSHHkkdpG4hoHZlPZncB5ITTGndXUvV3ZYjGyIQq9hKbk3 VpsJ4jbIo50DLSEJlpfub6V5EHY10vCFc/46Su9+OykFZy21POn+K8AaqjJz6+8Bt6/8 9+zee52K8FnxHCPLbPYM49vIXzt3YHZztaWyQ63lHqucoSfOPSytI0Uws0/gBtnVUM9x VUiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=VfG3Xmwo; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c20si18795034edy.349.2021.10.18.02.12.47; Mon, 18 Oct 2021 02:13:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=VfG3Xmwo; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231422AbhJRJOE (ORCPT + 99 others); Mon, 18 Oct 2021 05:14:04 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:43582 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231411AbhJRJOC (ORCPT ); Mon, 18 Oct 2021 05:14:02 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 2B77521966; Mon, 18 Oct 2021 09:11:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1634548310; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=eF2Rifqt8ucpeEBozDyQtYsm3MGnDcqBDObeOW5swFI=; b=VfG3XmwopjYLNY8uBIcOV1d5y0rNa6FkQ78ZS2K03/S2kxmcE69Uf+TpXYbfSNbEdlzeTS ExOOFwy9jEP8pe8idUu39zP7Ri48YGgwOApDRrt393B0MAdwqITqK8CuElxlZMRSMRykMF fRoxQ389Ul0CJH9kaxRl5AVy4WIvg+k= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1634548310; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=eF2Rifqt8ucpeEBozDyQtYsm3MGnDcqBDObeOW5swFI=; b=E/APmor9UmV+NfDwuczHe7pgy2f2mu/Uff+FJI3QBkWZSNSMLw5bJiKI6rX6l/1HYjHBQ8 09USThLyr6QTCfCw== Received: from quack2.suse.cz (unknown [10.100.200.198]) by relay2.suse.de (Postfix) with ESMTP id 11FD4A3B81; Mon, 18 Oct 2021 09:11:50 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id F0D301E0875; Mon, 18 Oct 2021 11:11:48 +0200 (CEST) Date: Mon, 18 Oct 2021 11:11:48 +0200 From: Jan Kara To: Gabriel Krisman Bertazi Cc: jack@suse.com, amir73il@gmail.com, djwong@kernel.org, tytso@mit.edu, dhowells@redhat.com, khazhy@google.com, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-api@vger.kernel.org, repnop@google.com, kernel@collabora.com Subject: Re: [PATCH v7 02/28] fsnotify: pass dentry instead of inode data Message-ID: <20211018091148.GB29715@quack2.suse.cz> References: <20211014213646.1139469-1-krisman@collabora.com> <20211014213646.1139469-3-krisman@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211014213646.1139469-3-krisman@collabora.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Thu 14-10-21 18:36:20, Gabriel Krisman Bertazi wrote: > From: Amir Goldstein > > Define a new data type to pass for event - FSNOTIFY_EVENT_DENTRY. > Use it to pass the dentry instead of it's ->d_inode where available. > > Signed-off-by: Amir Goldstein > Signed-off-by: Gabriel Krisman Bertazi Looks good. Feel free to add: Reviewed-by: Jan Kara Honza > --- > include/linux/fsnotify.h | 5 ++--- > include/linux/fsnotify_backend.h | 16 ++++++++++++++++ > 2 files changed, 18 insertions(+), 3 deletions(-) > > diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h > index d1144d7c3536..df0fa4687a18 100644 > --- a/include/linux/fsnotify.h > +++ b/include/linux/fsnotify.h > @@ -39,8 +39,7 @@ static inline int fsnotify_name(__u32 mask, const void *data, int data_type, > static inline void fsnotify_dirent(struct inode *dir, struct dentry *dentry, > __u32 mask) > { > - fsnotify_name(mask, d_inode(dentry), FSNOTIFY_EVENT_INODE, > - dir, &dentry->d_name, 0); > + fsnotify_name(mask, dentry, FSNOTIFY_EVENT_DENTRY, dir, &dentry->d_name, 0); > } > > static inline void fsnotify_inode(struct inode *inode, __u32 mask) > @@ -87,7 +86,7 @@ static inline int fsnotify_parent(struct dentry *dentry, __u32 mask, > */ > static inline void fsnotify_dentry(struct dentry *dentry, __u32 mask) > { > - fsnotify_parent(dentry, mask, d_inode(dentry), FSNOTIFY_EVENT_INODE); > + fsnotify_parent(dentry, mask, dentry, FSNOTIFY_EVENT_DENTRY); > } > > static inline int fsnotify_file(struct file *file, __u32 mask) > diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h > index 1ce66748a2d2..a2db821e8a8f 100644 > --- a/include/linux/fsnotify_backend.h > +++ b/include/linux/fsnotify_backend.h > @@ -248,6 +248,7 @@ enum fsnotify_data_type { > FSNOTIFY_EVENT_NONE, > FSNOTIFY_EVENT_PATH, > FSNOTIFY_EVENT_INODE, > + FSNOTIFY_EVENT_DENTRY, > }; > > static inline struct inode *fsnotify_data_inode(const void *data, int data_type) > @@ -255,6 +256,8 @@ static inline struct inode *fsnotify_data_inode(const void *data, int data_type) > switch (data_type) { > case FSNOTIFY_EVENT_INODE: > return (struct inode *)data; > + case FSNOTIFY_EVENT_DENTRY: > + return d_inode(data); > case FSNOTIFY_EVENT_PATH: > return d_inode(((const struct path *)data)->dentry); > default: > @@ -262,6 +265,19 @@ static inline struct inode *fsnotify_data_inode(const void *data, int data_type) > } > } > > +static inline struct dentry *fsnotify_data_dentry(const void *data, int data_type) > +{ > + switch (data_type) { > + case FSNOTIFY_EVENT_DENTRY: > + /* Non const is needed for dget() */ > + return (struct dentry *)data; > + case FSNOTIFY_EVENT_PATH: > + return ((const struct path *)data)->dentry; > + default: > + return NULL; > + } > +} > + > static inline const struct path *fsnotify_data_path(const void *data, > int data_type) > { > -- > 2.33.0 > -- Jan Kara SUSE Labs, CR