Re: [PATCH 07/25] fsnotify: Move fsnotify_destroy_marks()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 1, 2017 at 12:44 PM, Jan Kara <jack@xxxxxxx> wrote:
> Move fsnotify_destroy_marks() to be later in the fs/notify/mark.c. It
> will need some functions that are declared after its current
> declaration. No functional change.
>
> Signed-off-by: Jan Kara <jack@xxxxxxx>
> ---

You may re-add

Reviewed-by: Amir Goldstein <amir73il@xxxxxxxxx>


>  fs/notify/mark.c | 86 ++++++++++++++++++++++++++++----------------------------
>  1 file changed, 43 insertions(+), 43 deletions(-)
>
> diff --git a/fs/notify/mark.c b/fs/notify/mark.c
> index ce2314ae96d0..f3f6286bf9bb 100644
> --- a/fs/notify/mark.c
> +++ b/fs/notify/mark.c
> @@ -221,49 +221,6 @@ void fsnotify_destroy_mark(struct fsnotify_mark *mark,
>         fsnotify_free_mark(mark);
>  }
>
> -void fsnotify_destroy_marks(struct fsnotify_mark_connector **connp,
> -                           spinlock_t *lock)
> -{
> -       struct fsnotify_mark *mark;
> -
> -       while (1) {
> -               /*
> -                * We have to be careful since we can race with e.g.
> -                * fsnotify_clear_marks_by_group() and once we drop 'lock',
> -                * mark can get removed from the obj_list and destroyed. But
> -                * we are holding mark reference so mark cannot be freed and
> -                * calling fsnotify_destroy_mark() more than once is fine.
> -                */
> -               spin_lock(lock);
> -               if (hlist_empty(&(*connp)->list)) {
> -                       spin_unlock(lock);
> -                       break;
> -               }
> -               mark = hlist_entry((*connp)->list.first, struct fsnotify_mark,
> -                                  obj_list);
> -               /*
> -                * We don't update i_fsnotify_mask / mnt_fsnotify_mask here
> -                * since inode / mount is going away anyway. So just remove
> -                * mark from the list.
> -                */
> -               hlist_del_init_rcu(&mark->obj_list);
> -               fsnotify_get_mark(mark);
> -               spin_unlock(lock);
> -               fsnotify_destroy_mark(mark, mark->group);
> -               fsnotify_put_mark(mark);
> -       }
> -       /*
> -        * Skip freeing of connector when inode is just unlinked. We leave that
> -        * until destroy_inode() is called at which moment nobody will be
> -        * looking at the inode anymore.
> -        */
> -       if ((*connp)->flags & FSNOTIFY_OBJ_TYPE_INODE &&
> -           !((*connp)->inode->i_state & I_CLEAR))
> -               return;
> -       kmem_cache_free(fsnotify_mark_connector_cachep, *connp);
> -       *connp = NULL;
> -}
> -
>  void fsnotify_set_mark_mask_locked(struct fsnotify_mark *mark, __u32 mask)
>  {
>         assert_spin_locked(&mark->lock);
> @@ -574,6 +531,49 @@ void fsnotify_detach_group_marks(struct fsnotify_group *group)
>         }
>  }
>
> +void fsnotify_destroy_marks(struct fsnotify_mark_connector **connp,
> +                           spinlock_t *lock)
> +{
> +       struct fsnotify_mark *mark;
> +
> +       while (1) {
> +               /*
> +                * We have to be careful since we can race with e.g.
> +                * fsnotify_clear_marks_by_group() and once we drop 'lock',
> +                * mark can get removed from the obj_list and destroyed. But
> +                * we are holding mark reference so mark cannot be freed and
> +                * calling fsnotify_destroy_mark() more than once is fine.
> +                */
> +               spin_lock(lock);
> +               if (hlist_empty(&(*connp)->list)) {
> +                       spin_unlock(lock);
> +                       break;
> +               }
> +               mark = hlist_entry((*connp)->list.first, struct fsnotify_mark,
> +                                  obj_list);
> +               /*
> +                * We don't update i_fsnotify_mask / mnt_fsnotify_mask here
> +                * since inode / mount is going away anyway. So just remove
> +                * mark from the list.
> +                */
> +               hlist_del_init_rcu(&mark->obj_list);
> +               fsnotify_get_mark(mark);
> +               spin_unlock(lock);
> +               fsnotify_destroy_mark(mark, mark->group);
> +               fsnotify_put_mark(mark);
> +       }
> +       /*
> +        * Skip freeing of connector when inode is just unlinked. We leave that
> +        * until destroy_inode() is called at which moment nobody will be
> +        * looking at the inode anymore.
> +        */
> +       if ((*connp)->flags & FSNOTIFY_OBJ_TYPE_INODE &&
> +           !((*connp)->inode->i_state & I_CLEAR))
> +               return;
> +       kmem_cache_free(fsnotify_mark_connector_cachep, *connp);
> +       *connp = NULL;
> +}
> +
>  /*
>   * Nothing fancy, just initialize lists and locks and counters.
>   */
> --
> 2.10.2
>



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux