lkml.org 
[lkml]   [2022]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 02/13] mm: Introduce memfile_notifier
On Tue, Apr 12, 2022 at 10:36:54PM +0800, Hillf Danton wrote:
> On Thu, 10 Mar 2022 22:09:00 +0800 Chao Peng wrote:
> > +
> > +void memfile_register_backing_store(struct memfile_backing_store *bs)
> > +{
> > + BUG_ON(!bs || !bs->get_notifier_list);
> > +
> > + list_add_tail(&bs->list, &backing_store_list);
> > +}
> > +
> > +void memfile_unregister_backing_store(struct memfile_backing_store *bs)
> > +{
> > + list_del(&bs->list);
> > +}
> > +
> > +static int memfile_get_notifier_info(struct inode *inode,
>
> Nit, s/get/lookup/

Thanks.

>
> > + struct memfile_notifier_list **list,
> > + struct memfile_pfn_ops **ops)
> > +{
> > + struct memfile_backing_store *bs, *iter;
> > + struct memfile_notifier_list *tmp;
> > +
> > + list_for_each_entry_safe(bs, iter, &backing_store_list, list) {
>
> Wonder what serializes list walk with list del and add above.

Yes, this needs locking if we want to support backing stores as modules,
as Sean pointed out, at this time this is not quite meaningful so I will
remove unregister also the register should be done at kernel init time
so the walk here is actually on a readonly list.

Thanks,
Chao

>
> > + tmp = bs->get_notifier_list(inode);
> > + if (tmp) {
> > + *list = tmp;
> > + if (ops)
> > + *ops = &bs->pfn_ops;
> > + return 0;
> > + }
> > + }
> > + return -EOPNOTSUPP;
> > +}

\
 
 \ /
  Last update: 2022-04-13 08:48    [W:0.513 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site