fuse: reduce size of struct fuse_request
Reduce the size of struct fuse_request by removing cuse_init_out from the request structure and allocating it dinamically instead. CC: Tejun Heo <tj@kernel.org> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
This commit is contained in:
@@ -305,7 +305,7 @@ static void cuse_gendev_release(struct device *dev)
|
|||||||
static void cuse_process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
|
static void cuse_process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
|
||||||
{
|
{
|
||||||
struct cuse_conn *cc = fc_to_cc(fc);
|
struct cuse_conn *cc = fc_to_cc(fc);
|
||||||
struct cuse_init_out *arg = &req->misc.cuse_init_out;
|
struct cuse_init_out *arg = req->out.args[0].value;
|
||||||
struct page *page = req->pages[0];
|
struct page *page = req->pages[0];
|
||||||
struct cuse_devinfo devinfo = { };
|
struct cuse_devinfo devinfo = { };
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
@@ -384,6 +384,7 @@ static void cuse_process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
|
|||||||
dev_set_uevent_suppress(dev, 0);
|
dev_set_uevent_suppress(dev, 0);
|
||||||
kobject_uevent(&dev->kobj, KOBJ_ADD);
|
kobject_uevent(&dev->kobj, KOBJ_ADD);
|
||||||
out:
|
out:
|
||||||
|
kfree(arg);
|
||||||
__free_page(page);
|
__free_page(page);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -405,6 +406,7 @@ static int cuse_send_init(struct cuse_conn *cc)
|
|||||||
struct page *page;
|
struct page *page;
|
||||||
struct fuse_conn *fc = &cc->fc;
|
struct fuse_conn *fc = &cc->fc;
|
||||||
struct cuse_init_in *arg;
|
struct cuse_init_in *arg;
|
||||||
|
void *outarg;
|
||||||
|
|
||||||
BUILD_BUG_ON(CUSE_INIT_INFO_MAX > PAGE_SIZE);
|
BUILD_BUG_ON(CUSE_INIT_INFO_MAX > PAGE_SIZE);
|
||||||
|
|
||||||
@@ -419,6 +421,10 @@ static int cuse_send_init(struct cuse_conn *cc)
|
|||||||
if (!page)
|
if (!page)
|
||||||
goto err_put_req;
|
goto err_put_req;
|
||||||
|
|
||||||
|
outarg = kzalloc(sizeof(struct cuse_init_out), GFP_KERNEL);
|
||||||
|
if (!outarg)
|
||||||
|
goto err_free_page;
|
||||||
|
|
||||||
arg = &req->misc.cuse_init_in;
|
arg = &req->misc.cuse_init_in;
|
||||||
arg->major = FUSE_KERNEL_VERSION;
|
arg->major = FUSE_KERNEL_VERSION;
|
||||||
arg->minor = FUSE_KERNEL_MINOR_VERSION;
|
arg->minor = FUSE_KERNEL_MINOR_VERSION;
|
||||||
@@ -429,7 +435,7 @@ static int cuse_send_init(struct cuse_conn *cc)
|
|||||||
req->in.args[0].value = arg;
|
req->in.args[0].value = arg;
|
||||||
req->out.numargs = 2;
|
req->out.numargs = 2;
|
||||||
req->out.args[0].size = sizeof(struct cuse_init_out);
|
req->out.args[0].size = sizeof(struct cuse_init_out);
|
||||||
req->out.args[0].value = &req->misc.cuse_init_out;
|
req->out.args[0].value = outarg;
|
||||||
req->out.args[1].size = CUSE_INIT_INFO_MAX;
|
req->out.args[1].size = CUSE_INIT_INFO_MAX;
|
||||||
req->out.argvar = 1;
|
req->out.argvar = 1;
|
||||||
req->out.argpages = 1;
|
req->out.argpages = 1;
|
||||||
@@ -440,6 +446,8 @@ static int cuse_send_init(struct cuse_conn *cc)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err_free_page:
|
||||||
|
__free_page(page);
|
||||||
err_put_req:
|
err_put_req:
|
||||||
fuse_put_request(fc, req);
|
fuse_put_request(fc, req);
|
||||||
err:
|
err:
|
||||||
|
@@ -272,7 +272,6 @@ struct fuse_req {
|
|||||||
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 cuse_init_in cuse_init_in;
|
struct cuse_init_in cuse_init_in;
|
||||||
struct cuse_init_out cuse_init_out;
|
|
||||||
struct {
|
struct {
|
||||||
struct fuse_read_in in;
|
struct fuse_read_in in;
|
||||||
u64 attr_ver;
|
u64 attr_ver;
|
||||||
|
Reference in New Issue
Block a user