Commit 54a54007 authored by Alex Elder's avatar Alex Elder

libceph: don't set pages or bio in ceph_osdc_alloc_request()

Only one of the two callers of ceph_osdc_alloc_request() provides
page or bio data for its payload.  And essentially all that function
was doing with those arguments was assigning them to fields in the
osd request structure.

Simplify ceph_osdc_alloc_request() by having the caller take care of
making those assignments
Signed-off-by: default avatarAlex Elder <elder@inktank.com>
Reviewed-by: default avatarJosh Durgin <josh.durgin@inktank.com>
parent d178a9e7
...@@ -1148,14 +1148,18 @@ static int rbd_do_request(struct request *rq, ...@@ -1148,14 +1148,18 @@ static int rbd_do_request(struct request *rq,
(unsigned long long) len, coll, coll_index); (unsigned long long) len, coll, coll_index);
osdc = &rbd_dev->rbd_client->client->osdc; osdc = &rbd_dev->rbd_client->client->osdc;
osd_req = ceph_osdc_alloc_request(osdc, snapc, ops, osd_req = ceph_osdc_alloc_request(osdc, snapc, ops, false, GFP_NOIO);
false, GFP_NOIO, pages, bio);
if (!osd_req) { if (!osd_req) {
ret = -ENOMEM; ret = -ENOMEM;
goto done_pages; goto done_pages;
} }
osd_req->r_flags = flags; osd_req->r_flags = flags;
osd_req->r_pages = pages;
if (bio) {
osd_req->r_bio = bio;
bio_get(osd_req->r_bio);
}
osd_req->r_callback = rbd_cb; osd_req->r_callback = rbd_cb;
rbd_req->rq = rq; rbd_req->rq = rq;
......
...@@ -216,9 +216,7 @@ extern struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client * ...@@ -216,9 +216,7 @@ extern struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *
struct ceph_snap_context *snapc, struct ceph_snap_context *snapc,
struct ceph_osd_req_op *ops, struct ceph_osd_req_op *ops,
bool use_mempool, bool use_mempool,
gfp_t gfp_flags, gfp_t gfp_flags);
struct page **pages,
struct bio *bio);
extern void ceph_osdc_build_request(struct ceph_osd_request *req, extern void ceph_osdc_build_request(struct ceph_osd_request *req,
u64 off, u64 len, u64 off, u64 len,
......
...@@ -174,9 +174,7 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc, ...@@ -174,9 +174,7 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
struct ceph_snap_context *snapc, struct ceph_snap_context *snapc,
struct ceph_osd_req_op *ops, struct ceph_osd_req_op *ops,
bool use_mempool, bool use_mempool,
gfp_t gfp_flags, gfp_t gfp_flags)
struct page **pages,
struct bio *bio)
{ {
struct ceph_osd_request *req; struct ceph_osd_request *req;
struct ceph_msg *msg; struct ceph_msg *msg;
...@@ -237,13 +235,6 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc, ...@@ -237,13 +235,6 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
memset(msg->front.iov_base, 0, msg->front.iov_len); memset(msg->front.iov_base, 0, msg->front.iov_len);
req->r_request = msg; req->r_request = msg;
req->r_pages = pages;
#ifdef CONFIG_BLOCK
if (bio) {
req->r_bio = bio;
bio_get(req->r_bio);
}
#endif
return req; return req;
} }
...@@ -439,9 +430,7 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc, ...@@ -439,9 +430,7 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
} else } else
ops[1].op = 0; ops[1].op = 0;
req = ceph_osdc_alloc_request(osdc, snapc, ops, req = ceph_osdc_alloc_request(osdc, snapc, ops, use_mempool, GFP_NOFS);
use_mempool,
GFP_NOFS, NULL, NULL);
if (!req) if (!req)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
req->r_flags = flags; req->r_flags = flags;
......
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