Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1083964pxb; Sat, 16 Oct 2021 01:03:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiviLdsOv/Ss7vog0+ahFYzY9ZhZExbm2CB5oBtEb+Ik3g9u2jMhVbrQth3YSMz3lyY7yc X-Received: by 2002:a05:6a00:80c:b0:44d:90ef:e90c with SMTP id m12-20020a056a00080c00b0044d90efe90cmr10003862pfk.33.1634371392070; Sat, 16 Oct 2021 01:03:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634371392; cv=none; d=google.com; s=arc-20160816; b=s014laV/g8cFhKxNA0lEpful7QcTntxZTDqoHVBhS8zRvQSG+2+tPJ5zYUNYRGrmz8 IzJfmOYGIfnylJnCV2KBrJpS1b1BF/fGD6APij8wnVA+rdl+ac1EMU73Fe8pUBCHnL/v jwJCrvuLMsCp6Qov/zbLgOgqqysKr0d+nonIZ+qOr9ayJuUlpPGJCHn4X0NxUISKneKb mIjWXpIp5zUrZrOg94hYBU758KT2mm9M7U/rCRZk/DPOPNLs75aJ/gD6fFjLlrhSx5sf A7j4NMUHL+mhu6CpWnKdETaW7sYnuOids8TVYAnoXLvnluDsts67c/wEGQjljPHFtQM3 CxPw== 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=LTnq0UGHCHfxUpr/rvZAc+3hL2Fvz6piRi80GljMscM=; b=oysPrvjVnxSv5aJSzWZfEnnfBDjCrdSxc2rDC8ioGslXG89q7o6JDVYlzF+0dtWUSv IBQtbs+ndpJceKdC1//GHtpNKmUook5EGknnhaxhNIbcpdfgw7m+VbuTYdR75Y2uULym EHoFGVCNRVG8VbqoDSD0ePMWbJJPhkP4r9Opk1zkH4f7o6SYz3uc7K/FEQnC6Z2oYXQO p2mAyd4X4Z/5FXjszs4oFImxCJXj2WA2l3La9vmqhovOFIVoXi7l1/07jFZp7/KEGEmJ c4S2jor7Yq11gwTNJxBZ7HC0vgEM+CVQOn/pSnrYnUTXhru8WfjXQakw7pz5SS9oT8Sq iAVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=ZIOSbcHP; 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 f12si11178415pln.297.2021.10.16.01.02.55; Sat, 16 Oct 2021 01:03:12 -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=ZIOSbcHP; 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 S239713AbhJONl7 (ORCPT + 99 others); Fri, 15 Oct 2021 09:41:59 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:47226 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239423AbhJONl5 (ORCPT ); Fri, 15 Oct 2021 09:41:57 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 4967D21973; Fri, 15 Oct 2021 13:39:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1634305190; 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=LTnq0UGHCHfxUpr/rvZAc+3hL2Fvz6piRi80GljMscM=; b=ZIOSbcHPjLcN9y2KZnBegWtHi6Ke2y25DV6WT4oetijXmSut30z1/eaQSaFC8OOf0m6mez tY2N3Cd+fcVB+ui1KJ5R/fsBYyh8a8Dnj3hvSUekBVNcEZYl+cwLR+MYS/qw7H52Gr8omg xB6IuRfekxt7XlAa7ehJI6NSxdyj1xs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1634305190; 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=LTnq0UGHCHfxUpr/rvZAc+3hL2Fvz6piRi80GljMscM=; b=86JwG3Jc+hbDUv2EFdvMq26W/DsBBf8zWlOpLoDEjDWgbikC/2ajme+llLExqOX0JT1ULY rnNCM1J/l39hT2AA== Received: from quack2.suse.cz (unknown [10.100.200.198]) by relay2.suse.de (Postfix) with ESMTP id 39931A3B87; Fri, 15 Oct 2021 13:39:50 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 26CC71E0A40; Fri, 15 Oct 2021 15:39:50 +0200 (CEST) Date: Fri, 15 Oct 2021 15:39:50 +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: <20211015133950.GP23102@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 Did this ever get used in this series? 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