Re: [PATCH 1/3] cdev: Finish the cdev api with queued mode support

From: Dan Williams
Date: Wed Jan 20 2021 - 19:02:07 EST


On Wed, Jan 20, 2021 at 12:20 PM Dan Williams <dan.j.williams@xxxxxxxxx> wrote:
>
> On Wed, Jan 20, 2021 at 11:46 AM Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:
> >
> > The subject doesn't make any sense to me.
> >
> > But thn again queued sound really weird. You just have a managed
> > API with a refcount and synchronization, right?
>
> Correct.
>
> "queue" was in reference to the way q_usage_count behaves, but yes,
> just refcount + synchronization is all this is.
>
> >
> > procfs and debugfs already support these kind of managed ops, kinda sad
> > to duplicate this concept yet another time.
>
> Oh, I didn't realize there were managed ops there, I'll go take a look
> and see if cdev can adopt that scheme.

So in both cases they are leveraging the fact that they are the
filesystems that allocated the inode and will stash the private
reference counting somewhere relative to the container_of the
vfs_inode. I don't immediately see how that scheme can be implied to
special device files that can come from an inode on any filesystem.

I do see how debugfs and procfs could be unified, but I don't think
this percpu_ref for cdev is compatible.

Other ideas?