Commit b57d4264 authored by Miklos Szeredi's avatar Miklos Szeredi Committed by Linus Torvalds

fuse: save space in struct fuse_req

Move the fields 'dentry' and 'vfsmount' into the request specific union, since
these are only used for the RELEASE request.
Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 0952b2a4
...@@ -77,8 +77,8 @@ static struct fuse_file *fuse_file_get(struct fuse_file *ff) ...@@ -77,8 +77,8 @@ static struct fuse_file *fuse_file_get(struct fuse_file *ff)
static void fuse_release_end(struct fuse_conn *fc, struct fuse_req *req) static void fuse_release_end(struct fuse_conn *fc, struct fuse_req *req)
{ {
dput(req->dentry); dput(req->misc.release.dentry);
mntput(req->vfsmount); mntput(req->misc.release.vfsmount);
fuse_put_request(fc, req); fuse_put_request(fc, req);
} }
...@@ -86,7 +86,8 @@ static void fuse_file_put(struct fuse_file *ff) ...@@ -86,7 +86,8 @@ static void fuse_file_put(struct fuse_file *ff)
{ {
if (atomic_dec_and_test(&ff->count)) { if (atomic_dec_and_test(&ff->count)) {
struct fuse_req *req = ff->reserved_req; struct fuse_req *req = ff->reserved_req;
struct fuse_conn *fc = get_fuse_conn(req->dentry->d_inode); struct inode *inode = req->misc.release.dentry->d_inode;
struct fuse_conn *fc = get_fuse_conn(inode);
req->end = fuse_release_end; req->end = fuse_release_end;
request_send_background(fc, req); request_send_background(fc, req);
kfree(ff); kfree(ff);
...@@ -137,7 +138,7 @@ int fuse_open_common(struct inode *inode, struct file *file, int isdir) ...@@ -137,7 +138,7 @@ int fuse_open_common(struct inode *inode, struct file *file, int isdir)
void fuse_release_fill(struct fuse_file *ff, u64 nodeid, int flags, int opcode) void fuse_release_fill(struct fuse_file *ff, u64 nodeid, int flags, int opcode)
{ {
struct fuse_req *req = ff->reserved_req; struct fuse_req *req = ff->reserved_req;
struct fuse_release_in *inarg = &req->misc.release_in; struct fuse_release_in *inarg = &req->misc.release.in;
inarg->fh = ff->fh; inarg->fh = ff->fh;
inarg->flags = flags; inarg->flags = flags;
...@@ -153,13 +154,14 @@ int fuse_release_common(struct inode *inode, struct file *file, int isdir) ...@@ -153,13 +154,14 @@ int fuse_release_common(struct inode *inode, struct file *file, int isdir)
struct fuse_file *ff = file->private_data; struct fuse_file *ff = file->private_data;
if (ff) { if (ff) {
struct fuse_conn *fc = get_fuse_conn(inode); struct fuse_conn *fc = get_fuse_conn(inode);
struct fuse_req *req = ff->reserved_req;
fuse_release_fill(ff, get_node_id(inode), file->f_flags, fuse_release_fill(ff, get_node_id(inode), file->f_flags,
isdir ? FUSE_RELEASEDIR : FUSE_RELEASE); isdir ? FUSE_RELEASEDIR : FUSE_RELEASE);
/* Hold vfsmount and dentry until release is finished */ /* Hold vfsmount and dentry until release is finished */
ff->reserved_req->vfsmount = mntget(file->f_path.mnt); req->misc.release.vfsmount = mntget(file->f_path.mnt);
ff->reserved_req->dentry = dget(file->f_path.dentry); req->misc.release.dentry = dget(file->f_path.dentry);
spin_lock(&fc->lock); spin_lock(&fc->lock);
list_del(&ff->write_entry); list_del(&ff->write_entry);
......
...@@ -215,7 +215,11 @@ struct fuse_req { ...@@ -215,7 +215,11 @@ struct fuse_req {
/** Data for asynchronous requests */ /** Data for asynchronous requests */
union { union {
struct fuse_forget_in forget_in; struct fuse_forget_in forget_in;
struct fuse_release_in release_in; struct {
struct fuse_release_in in;
struct vfsmount *vfsmount;
struct dentry *dentry;
} release;
struct fuse_init_in init_in; struct fuse_init_in init_in;
struct fuse_init_out init_out; struct fuse_init_out init_out;
struct fuse_read_in read_in; struct fuse_read_in read_in;
...@@ -238,12 +242,6 @@ struct fuse_req { ...@@ -238,12 +242,6 @@ struct fuse_req {
/** File used in the request (or NULL) */ /** File used in the request (or NULL) */
struct fuse_file *ff; struct fuse_file *ff;
/** vfsmount used in release */
struct vfsmount *vfsmount;
/** dentry used in release */
struct dentry *dentry;
/** Request completion callback */ /** Request completion callback */
void (*end)(struct fuse_conn *, struct fuse_req *); void (*end)(struct fuse_conn *, struct fuse_req *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment