Hi Miklos,
On Friday 03 August 2007, Miklos Szeredi wrote:
> From: Miklos Szeredi <[email protected]>
>
> Make lifetime of 'struct fuse_file' independent from 'struct file' by
> adding a reference counter and destructor.
What about using krefs to implement that?
see include/linux/kref.h
and lib/kref.c
Just embed that "struct kref" inside your struct fuse_file
struct fuse_file {
...
struct kref ref;
...
}
init in struct fuse_file *fuse_file_alloc(void) where you added the counter.
...
kref_init(&ff->ref);
...
and implement the release function like:
static void fuse_file_release(struct kref *ff_ref)
{
struct fuse_file *ff = container_of(ff_ref, struct fuse_file, ref);
struct fuse_req *req = ff->reserved_req;
struct fuse_conn *fc = get_fuse_conn(req->dentry->d_inode);
request_send_background(fc, req);
kfree(ff);
}
This will also fix the missing smp_barriers, is very simple, saves code,
makes your life easier and is a well known known kernel infrastructure :-)
BTW: FUSE rocks! :-)
You can add my "Signed-off-by: Ingo Oeser <[email protected]>",
if you want to use that suggestion.
Best Regards
Ingo Oeser
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]