From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de ([195.135.220.15]:41494 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726074AbfADJyt (ORCPT ); Fri, 4 Jan 2019 04:54:49 -0500 Date: Fri, 4 Jan 2019 10:54:47 +0100 From: Jan Kara To: Amir Goldstein Cc: Jan Kara , Matthew Bobrowski , linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v4 09/15] fanotify: cache fsid in fsnotify_mark_connector Message-ID: <20190104095447.GF22409@quack2.suse.cz> References: <20181202113826.32133-1-amir73il@gmail.com> <20181202113826.32133-10-amir73il@gmail.com> <20190104093839.GE22409@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190104093839.GE22409@quack2.suse.cz> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Fri 04-01-19 10:38:39, Jan Kara wrote: > On Sun 02-12-18 13:38:20, Amir Goldstein wrote: > > @@ -268,6 +289,7 @@ static int fanotify_handle_event(struct fsnotify_group *group, > > int ret = 0; > > struct fanotify_event *event; > > struct fsnotify_event *fsn_event; > > + __kernel_fsid_t __fsid, *fsid = NULL; > > > > BUILD_BUG_ON(FAN_ACCESS != FS_ACCESS); > > BUILD_BUG_ON(FAN_MODIFY != FS_MODIFY); > > @@ -300,7 +322,10 @@ static int fanotify_handle_event(struct fsnotify_group *group, > > return 0; > > } > > > > - event = fanotify_alloc_event(group, inode, mask, data); > > + if (FAN_GROUP_FLAG(group, FAN_REPORT_FID)) > > + fsid = fanotify_get_fsid(iter_info, &__fsid); > > + > > + event = fanotify_alloc_event(group, inode, mask, data, fsid); > > This looks wrong? fsid is never assigned anything != NULL? How could have > this worked? Sorry. I understand now. But the calling convention is somewhat unusual. Actually, since fsid is just 8 bytes anyway, why not just return is as value? I.e. something like: static __kernel_fsid_t fanotify_get_fsid(struct fsnotify_iter_info*iter_info) { ... } You won't save any copying on 64-bit archs and I've checked and GCC will optimize this to a standard register return convention anyway. Honza -- Jan Kara SUSE Labs, CR