From: Alex Elder <elder@inktank.com>
To: "ceph-devel@vger.kernel.org" <ceph-devel@vger.kernel.org>
Subject: [PATCH 2/3] rbd: standardize ceph_osd_request variable names
Date: Thu, 08 Nov 2012 08:08:29 -0600 [thread overview]
Message-ID: <509BBCDD.80309@inktank.com> (raw)
In-Reply-To: <509BBC83.1020203@inktank.com>
There are spots where a ceph_osds_request pointer variable is given
the name "req". Since we're dealing with (at least) three types of
requests (block layer, rbd, and osd), I find this slightly
distracting.
Change such instances to use "osd_req" consistently to make the
abstraction represented a little more obvious.
Signed-off-by: Alex Elder <elder@inktank.com>
---
drivers/block/rbd.c | 60
++++++++++++++++++++++++++-------------------------
1 file changed, 31 insertions(+), 29 deletions(-)
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 9d8b406..caff180 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1113,12 +1113,12 @@ static int rbd_do_request(struct request *rq,
struct ceph_osd_req_op *ops,
struct rbd_req_coll *coll,
int coll_index,
- void (*rbd_cb)(struct ceph_osd_request *req,
- struct ceph_msg *msg),
+ void (*rbd_cb)(struct ceph_osd_request *,
+ struct ceph_msg *),
struct ceph_osd_request **linger_req,
u64 *ver)
{
- struct ceph_osd_request *req;
+ struct ceph_osd_request *osd_req;
struct ceph_file_layout *layout;
int ret;
u64 bno;
@@ -1145,67 +1145,68 @@ static int rbd_do_request(struct request *rq,
(unsigned long long) len, coll, coll_index);
osdc = &rbd_dev->rbd_client->client->osdc;
- req = ceph_osdc_alloc_request(osdc, flags, snapc, ops,
+ osd_req = ceph_osdc_alloc_request(osdc, flags, snapc, ops,
false, GFP_NOIO, pages, bio);
- if (!req) {
+ if (!osd_req) {
ret = -ENOMEM;
goto done_pages;
}
- req->r_callback = rbd_cb;
+ osd_req->r_callback = rbd_cb;
rbd_req->rq = rq;
rbd_req->bio = bio;
rbd_req->pages = pages;
rbd_req->len = len;
- req->r_priv = rbd_req;
+ osd_req->r_priv = rbd_req;
- reqhead = req->r_request->front.iov_base;
+ reqhead = osd_req->r_request->front.iov_base;
reqhead->snapid = cpu_to_le64(CEPH_NOSNAP);
- strncpy(req->r_oid, object_name, sizeof(req->r_oid));
- req->r_oid_len = strlen(req->r_oid);
+ strncpy(osd_req->r_oid, object_name, sizeof(osd_req->r_oid));
+ osd_req->r_oid_len = strlen(osd_req->r_oid);
- layout = &req->r_file_layout;
+ layout = &osd_req->r_file_layout;
memset(layout, 0, sizeof(*layout));
layout->fl_stripe_unit = cpu_to_le32(1 << RBD_MAX_OBJ_ORDER);
layout->fl_stripe_count = cpu_to_le32(1);
layout->fl_object_size = cpu_to_le32(1 << RBD_MAX_OBJ_ORDER);
layout->fl_pg_pool = cpu_to_le32((int) rbd_dev->spec->pool_id);
ret = ceph_calc_raw_layout(osdc, layout, snapid, ofs, &len, &bno,
- req, ops);
+ osd_req, ops);
rbd_assert(ret == 0);
- ceph_osdc_build_request(req, ofs, &len,
+ ceph_osdc_build_request(osd_req, ofs, &len,
ops,
snapc,
&mtime,
- req->r_oid, req->r_oid_len);
+ osd_req->r_oid, osd_req->r_oid_len);
if (linger_req) {
- ceph_osdc_set_request_linger(osdc, req);
- *linger_req = req;
+ ceph_osdc_set_request_linger(osdc, osd_req);
+ *linger_req = osd_req;
}
- ret = ceph_osdc_start_request(osdc, req, false);
+ ret = ceph_osdc_start_request(osdc, osd_req, false);
if (ret < 0)
goto done_err;
if (!rbd_cb) {
- ret = ceph_osdc_wait_request(osdc, req);
+ u64 version;
+
+ ret = ceph_osdc_wait_request(osdc, osd_req);
+ version = le64_to_cpu(osd_req->r_reassert_version.version);
if (ver)
- *ver = le64_to_cpu(req->r_reassert_version.version);
- dout("reassert_ver=%llu\n",
- (unsigned long long)
- le64_to_cpu(req->r_reassert_version.version));
- ceph_osdc_put_request(req);
+ *ver = version;
+ dout("reassert_ver=%llu\n", (unsigned long long) version);
+ ceph_osdc_put_request(osd_req);
}
return ret;
done_err:
bio_chain_put(rbd_req->bio);
- ceph_osdc_put_request(req);
+ ceph_osdc_put_request(osd_req);
done_pages:
rbd_coll_end_req(rbd_req, ret, len);
kfree(rbd_req);
@@ -1215,9 +1216,9 @@ done_pages:
/*
* Ceph osd op callback
*/
-static void rbd_req_cb(struct ceph_osd_request *req, struct ceph_msg *msg)
+static void rbd_req_cb(struct ceph_osd_request *osd_req, struct
ceph_msg *msg)
{
- struct rbd_request *rbd_req = req->r_priv;
+ struct rbd_request *rbd_req = osd_req->r_priv;
struct ceph_osd_reply_head *replyhead;
struct ceph_osd_op *op;
__s32 rc;
@@ -1248,13 +1249,14 @@ static void rbd_req_cb(struct ceph_osd_request
*req, struct ceph_msg *msg)
if (rbd_req->bio)
bio_chain_put(rbd_req->bio);
- ceph_osdc_put_request(req);
+ ceph_osdc_put_request(osd_req);
kfree(rbd_req);
}
-static void rbd_simple_req_cb(struct ceph_osd_request *req, struct
ceph_msg *msg)
+static void rbd_simple_req_cb(struct ceph_osd_request *osd_req,
+ struct ceph_msg *msg)
{
- ceph_osdc_put_request(req);
+ ceph_osdc_put_request(osd_req);
}
/*
--
1.7.9.5
next prev parent reply other threads:[~2012-11-08 14:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-08 14:06 [PATCH 0/3] rbd: a few picky changes Alex Elder
2012-11-08 14:08 ` [PATCH 1/3] rbd: standardize rbd_request variable names Alex Elder
2012-11-08 14:08 ` Alex Elder [this message]
2012-11-08 14:08 ` [PATCH 3/3] rbd: be picky about osd request status type Alex Elder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=509BBCDD.80309@inktank.com \
--to=elder@inktank.com \
--cc=ceph-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox