From: Andrew Morton Subject: Re: [PATCH 1/2] fsnotify: Unify inode and mount marks handling Date: Tue, 18 Nov 2014 16:27:17 -0800 Message-ID: <20141118162717.e31dcd7736e48125e6001a67@linux-foundation.org> References: <1415808463-23959-1-git-send-email-jack@suse.cz> <1415808463-23959-2-git-send-email-jack@suse.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Heinrich Schuchardt , linux-fsdevel@vger.kernel.org, Eric Paris To: Jan Kara Return-path: Received: from mail.linuxfoundation.org ([140.211.169.12]:38239 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753786AbaKSA1T (ORCPT ); Tue, 18 Nov 2014 19:27:19 -0500 In-Reply-To: <1415808463-23959-2-git-send-email-jack@suse.cz> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Wed, 12 Nov 2014 17:07:42 +0100 Jan Kara wrote: > There's lot of common code in inode and mount marks handling. Factor it > out to common helper function. Confused. > --- a/fs/notify/inode_mark.c > +++ b/fs/notify/inode_mark.c > @@ -31,28 +31,13 @@ > #include "../internal.h" > > /* > - * Recalculate the mask of events relevant to a given inode locked. > - */ > -static void fsnotify_recalc_inode_mask_locked(struct inode *inode) > -{ > - struct fsnotify_mark *mark; > - __u32 new_mask = 0; > - > - assert_spin_locked(&inode->i_lock); > - > - hlist_for_each_entry(mark, &inode->i_fsnotify_marks, i.i_list) > - new_mask |= mark->mask; > - inode->i_fsnotify_mask = new_mask; > -} Gone. > @@ -202,36 +153,9 @@ int fsnotify_add_inode_mark(struct fsnotify_mark *mark, > assert_spin_locked(&mark->lock); > > spin_lock(&inode->i_lock); > - > - mark->i.inode = inode; > - > - /* is mark the first mark? */ > - if (hlist_empty(&inode->i_fsnotify_marks)) { > - hlist_add_head_rcu(&mark->i.i_list, &inode->i_fsnotify_marks); > - goto out; > - } > - > - /* should mark be in the middle of the current list? */ > - hlist_for_each_entry(lmark, &inode->i_fsnotify_marks, i.i_list) { > - last = lmark; > - > - if ((lmark->group == group) && !allow_dups) { > - ret = -EEXIST; > - goto out; > - } > - > - cmp = fsnotify_compare_groups(lmark->group, mark->group); > - if (cmp < 0) > - continue; > - > - hlist_add_before_rcu(&mark->i.i_list, &lmark->i.i_list); > - goto out; > - } > - > - BUG_ON(last == NULL); > - /* mark should be the last entry. last is the current last entry */ > - hlist_add_behind_rcu(&mark->i.i_list, &last->i.i_list); > -out: > + mark->inode = inode; > + ret = fsnotify_add_mark_list(&inode->i_fsnotify_marks, mark, > + allow_dups); > fsnotify_recalc_inode_mask_locked(inode); But not forgotten. The compiler noticed this ;) I'll drop fsnotify-unify-inode-and-mount-marks-handling.patch and fsnotify-remove-destroy_list-from-fsnotify_mark.patch - could you take a look please? I had to stage those two patches after linux-next.patch because someone has been fiddling with fs/notify/ in -next, causing conflicts. Perhaps that had something to do with it, but I don't see how.