Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move reference counting out of libplfs and into FUSE #339

Open
brettkettering opened this issue Feb 4, 2014 · 0 comments
Open

Move reference counting out of libplfs and into FUSE #339

brettkettering opened this issue Feb 4, 2014 · 0 comments
Assignees

Comments

@brettkettering
Copy link
Contributor

I wonder if it would make sense to move the reference counting out of libplfs and into FUSE and then just disallow *pfd in plfs_open from being non-NULL? You'd modify the FUSE open_files map to have the reference count.

That might simplify the mainline code a bit, and not complicate the FUSE much more than it currently is (since it has to manage the open filename map anyway).

I looked at this some more and I'm thinking the thread locking doesn't use the counts.

The main reference counter is Metadata::reference_count which is accessed via the incrementOpens(int amount) API. The main place that gets touched is in the open/close code path (not surprising), but if we moved the reference count up into FUSE then that code would go away.

The reference counting actually trickles up anyway... via the last arg of the plfs_close() API:

plfs_error_t plfs_close(Plfs_fd *fd, pid_t pid, uid_t u, int open_flags,
Plfs_close_opt *close_opt, int *num_ref)

that "num_ref" becomes "remaining" in the FUSE layer and FUSE does locking on the FUSE "struct OpenFile" ... so maybe in the current code the locking is in the FUSE layer (on OpenFile) but the reference count is down in Metadata::reference_count.

if we make this move, the "num_ref" in that API doesn't make sense anymore either. we could get rid of it, but that would change an external API.

@ghost ghost assigned chuckcranor Feb 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants