Re: [PATCH v5 02/13] mm: Introduce memfile_notifier

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

 



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;
> > +}




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux