Skip to contentSkip to conversation

Linux/Pro -- clusters

DISCUSSION [email protected] 2 participants 2 messages Dec 10, 2001

lore
Share & tools
lore
#0 lore raw

From [email protected] Mon Dec 10 18:01:03 2001

And it means we can get proper refcounting. Which as the maintainer of two block drivers that support dynamic volume create/destroy is remarkably good news.

You say this as if that would be a difference between the two approaches. I don't think it is.

My goal was: allow large device numbers.
The subgoal: get rid of the arrays since these do not allow large indices. The approach: make kdev_t a pointer to some random structure.

Now that I have achieved my goal, if you come along and want refcounting, it seems to me that all I have to do is add a field refcount to this struct, and have xget() and xput() routines increase or decrease this number.

Maybe you are confused because usually one has a structure that keeps track of all references to itself, so that the structure can be freed when the number drops to zero. I do not need such refcounting for a kdev_t, but it is very easy to keep track of the number of openers, the number of inodes, or whatever you would like to count. After all, anything you do with the device gets called with
a kdev_t argument, so nothing is easier than having open() increase and close() decrease some field.

Andries

#1 lore raw
Quoted 6 lines

And it means we can get proper refcounting. Which as the maintainer of two block drivers that support dynamic volume create/destroy is remarkably good news.

You say this as if that would be a difference between the two approaches. I don't think it is.

Its easier to make sure its correct when we have a single structure not a pile of arrays. Object lifetime becomes explicit, and we don't have to worry about re-use races since a new instance of that major,minor will have a different object attached to the one in use that is about to be refcounted into oblivion by currently active requests