Return-Path: Received: from mx2.suse.de ([195.135.220.15]:46174 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751104AbdCPHpo (ORCPT ); Thu, 16 Mar 2017 03:45:44 -0400 Date: Thu, 16 Mar 2017 08:45:40 +0100 From: Jan Kara To: Amir Goldstein Cc: Jan Kara , linux-fsdevel , Miklos Szeredi , Paul Moore Subject: Re: [PATCH 06/33] fsnotify: Move mark list head from object into dedicated structure Message-ID: <20170316074540.GK12989@quack2.suse.cz> References: <20170315104632.7037-1-jack@suse.cz> <20170315104632.7037-7-jack@suse.cz> <20170316072643.GJ12989@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170316072643.GJ12989@quack2.suse.cz> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu 16-03-17 08:26:43, Jan Kara wrote: > On Wed 15-03-17 16:11:17, Amir Goldstein wrote: > > > +/* > > > + * Add mark into proper place in given list of marks. These marks may be used > > > + * for the fsnotify backend to determine which event types should be delivered > > > + * to which group and for which inodes. These marks are ordered according to > > > + * priority, highest number first, and then by the group's location in memory. > > > + */ > > > +int fsnotify_add_mark_list(struct fsnotify_mark_connector **connp, > > > + struct fsnotify_mark *mark, int allow_dups) > > > { > > > struct fsnotify_mark *lmark, *last = NULL; > > > + struct fsnotify_mark_connector *conn; > > > int cmp; > > > > > > + if (!*connp) { > > > + conn = kmem_cache_alloc(fsnotify_mark_connector_cachep, > > > + GFP_ATOMIC); > > > + if (!conn) > > > + return -ENOMEM; > > > + INIT_HLIST_HEAD(&conn->list); > > > + /* > > > + * Make sure 'conn' initialization is visible. Matches > > > + * lockless_dereference() in fsnotify(). > > > + */ > > > + smp_wmb(); > > > + *connp = conn; > > > + } else { > > > + conn = *connp; > > > + } > > > + > > > > This chunk would look nicer in fsnotify_connector_get() helper. > > Good point. I've called the function fsnotify_grab_create_connector() to > make it consistent with later fsnotify_grab_connector() and to stress clearly > that this may allocate new connector unlike later fsnotify_grab_connector()... OK, after looking more at your other suggestion and patches, I've moved only the allocation into a separate function and called it fsnotify_attach_connector_to_object() (which matches fsnotify_detach_connector_from_object() added later). Honza -- Jan Kara SUSE Labs, CR