diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2019-09-10 15:04:09 +0200 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2019-09-10 16:29:49 +0200 |
commit | 4c4f03f78ca9ce41a158710b87ad7e6d363e881a (patch) | |
tree | 8e29dd28a0ed27ee3f6030162ebf546c76428846 /fs/fuse | |
parent | 4c29afece8729c6f6c1dd4865b6b7c972b7b3bbd (diff) |
fuse: move page alloc
fuse_req_pages_alloc() is moved to file.c, since its internal use by the
device code will eventually be removed.
Rename to fuse_pages_alloc() to signify that it's not only usable for
fuse_req page array.
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/fuse')
-rw-r--r-- | fs/fuse/dev.c | 17 | ||||
-rw-r--r-- | fs/fuse/file.c | 12 | ||||
-rw-r--r-- | fs/fuse/fuse_i.h | 2 |
3 files changed, 16 insertions, 15 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 3ef85c957122..0a6624aeced9 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -54,18 +54,6 @@ static void fuse_request_init(struct fuse_req *req, struct page **pages, __set_bit(FR_PENDING, &req->flags); } -static struct page **fuse_req_pages_alloc(unsigned int npages, gfp_t flags, - struct fuse_page_desc **desc) -{ - struct page **pages; - - pages = kzalloc(npages * (sizeof(struct page *) + - sizeof(struct fuse_page_desc)), flags); - *desc = (void *) pages + npages * sizeof(struct page *); - - return pages; -} - static struct fuse_req *__fuse_request_alloc(unsigned npages, gfp_t flags) { struct fuse_req *req = kmem_cache_zalloc(fuse_req_cachep, flags); @@ -75,8 +63,7 @@ static struct fuse_req *__fuse_request_alloc(unsigned npages, gfp_t flags) WARN_ON(npages > FUSE_MAX_MAX_PAGES); if (npages > FUSE_REQ_INLINE_PAGES) { - pages = fuse_req_pages_alloc(npages, flags, - &page_descs); + pages = fuse_pages_alloc(npages, flags, &page_descs); if (!pages) { kmem_cache_free(fuse_req_cachep, req); return NULL; @@ -120,7 +107,7 @@ bool fuse_req_realloc_pages(struct fuse_conn *fc, struct fuse_req *req, fc->max_pages); WARN_ON(npages <= req->max_pages); - pages = fuse_req_pages_alloc(npages, flags, &page_descs); + pages = fuse_pages_alloc(npages, flags, &page_descs); if (!pages) return false; diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 53f2cc6970f1..c3e95002f489 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -19,6 +19,18 @@ #include <linux/falloc.h> #include <linux/uio.h> +struct page **fuse_pages_alloc(unsigned int npages, gfp_t flags, + struct fuse_page_desc **desc) +{ + struct page **pages; + + pages = kzalloc(npages * (sizeof(struct page *) + + sizeof(struct fuse_page_desc)), flags); + *desc = (void *) (pages + npages); + + return pages; +} + static int fuse_send_open(struct fuse_conn *fc, u64 nodeid, struct file *file, int opcode, struct fuse_open_out *outargp) { diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 1998d6ab4025..b62a3e37ea4c 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -909,6 +909,8 @@ struct fuse_req *fuse_request_alloc(unsigned npages); struct fuse_req *fuse_request_alloc_nofs(unsigned npages); +struct page **fuse_pages_alloc(unsigned int npages, gfp_t flags, + struct fuse_page_desc **desc); bool fuse_req_realloc_pages(struct fuse_conn *fc, struct fuse_req *req, gfp_t flags); |