fuse: categorize fuse_get_req()
The patch categorizes all fuse_get_req() invocations into two categories: - fuse_get_req_nopages(fc) - when caller doesn't care about req->pages - fuse_get_req(fc, n) - when caller need n page pointers (n > 0) Adding fuse_get_req_nopages() helps to avoid numerous fuse_get_req(fc, 0) scattered over code. Now it's clear from the first glance when a caller need fuse_req with page pointers. The patch doesn't make any logic changes. In multi-page case, it silly allocates array of FUSE_MAX_PAGES_PER_REQ page pointers. This will be amended by future patches. Signed-off-by: Maxim Patlasov <mpatlasov@parallels.com> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
This commit is contained in:
parent
4250c0668e
commit
b111c8c0e3
6 changed files with 57 additions and 45 deletions
|
@ -118,7 +118,7 @@ static void fuse_req_init_context(struct fuse_req *req)
|
|||
req->in.h.pid = current->pid;
|
||||
}
|
||||
|
||||
struct fuse_req *fuse_get_req(struct fuse_conn *fc)
|
||||
struct fuse_req *fuse_get_req(struct fuse_conn *fc, unsigned npages)
|
||||
{
|
||||
struct fuse_req *req;
|
||||
sigset_t oldset;
|
||||
|
@ -137,7 +137,7 @@ struct fuse_req *fuse_get_req(struct fuse_conn *fc)
|
|||
if (!fc->connected)
|
||||
goto out;
|
||||
|
||||
req = fuse_request_alloc(FUSE_MAX_PAGES_PER_REQ);
|
||||
req = fuse_request_alloc(npages);
|
||||
err = -ENOMEM;
|
||||
if (!req)
|
||||
goto out;
|
||||
|
@ -207,13 +207,14 @@ static void put_reserved_req(struct fuse_conn *fc, struct fuse_req *req)
|
|||
* filesystem should not have it's own file open. If deadlock is
|
||||
* intentional, it can still be broken by "aborting" the filesystem.
|
||||
*/
|
||||
struct fuse_req *fuse_get_req_nofail(struct fuse_conn *fc, struct file *file)
|
||||
struct fuse_req *fuse_get_req_nofail_nopages(struct fuse_conn *fc,
|
||||
struct file *file)
|
||||
{
|
||||
struct fuse_req *req;
|
||||
|
||||
atomic_inc(&fc->num_waiting);
|
||||
wait_event(fc->blocked_waitq, !fc->blocked);
|
||||
req = fuse_request_alloc(FUSE_MAX_PAGES_PER_REQ);
|
||||
req = fuse_request_alloc(0);
|
||||
if (!req)
|
||||
req = get_reserved_req(fc, file);
|
||||
|
||||
|
@ -521,7 +522,7 @@ void fuse_force_forget(struct file *file, u64 nodeid)
|
|||
|
||||
memset(&inarg, 0, sizeof(inarg));
|
||||
inarg.nlookup = 1;
|
||||
req = fuse_get_req_nofail(fc, file);
|
||||
req = fuse_get_req_nofail_nopages(fc, file);
|
||||
req->in.h.opcode = FUSE_FORGET;
|
||||
req->in.h.nodeid = nodeid;
|
||||
req->in.numargs = 1;
|
||||
|
@ -1577,7 +1578,7 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode,
|
|||
unsigned int offset;
|
||||
size_t total_len = 0;
|
||||
|
||||
req = fuse_get_req(fc);
|
||||
req = fuse_get_req(fc, FUSE_MAX_PAGES_PER_REQ);
|
||||
if (IS_ERR(req))
|
||||
return PTR_ERR(req);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue