struct fuse_req *fuse_request_alloc_nofs(void) { struct fuse_req *req = kmem_cache_alloc(fuse_req_cachep, GFP_NOFS); if (req) fuse_request_init(req); return req; }
struct fuse_req *fuse_request_alloc(void) { struct fuse_req *req = kmem_cache_alloc(fuse_req_cachep, GFP_KERNEL); if (req) fuse_request_init(req); return req; }
static struct fuse_req *__fuse_request_alloc(unsigned npages, gfp_t flags) { struct fuse_req *req = kmem_cache_alloc(fuse_req_cachep, flags); if (req) { struct page **pages; struct fuse_page_desc *page_descs; if (npages <= FUSE_REQ_INLINE_PAGES) { pages = req->inline_pages; page_descs = req->inline_page_descs; } else { pages = kmalloc(sizeof(struct page *) * npages, flags); page_descs = kmalloc(sizeof(struct fuse_page_desc) * npages, flags); } if (!pages || !page_descs) { kfree(pages); kfree(page_descs); kmem_cache_free(fuse_req_cachep, req); return NULL; } fuse_request_init(req, pages, page_descs, npages); } return req; }
/* * Put stolen request back into fuse_file->reserved_req */ static void put_reserved_req(struct fuse_conn *fc, struct fuse_req *req) { struct file *file = req->stolen_file; struct fuse_file *ff = file->private_data; spin_lock(&fc->lock); fuse_request_init(req); BUG_ON(ff->reserved_req); ff->reserved_req = req; wake_up_all(&fc->reserved_req_waitq); spin_unlock(&fc->lock); fput(file); }