All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH REPOST 0/5] rbd: drop some unneeded parameters
@ 2013-01-03 23:17 Alex Elder
  2013-01-03 23:18 ` [PATCH REPOST 1/5] rbd: drop oid parameters from ceph_osdc_build_request() Alex Elder
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Alex Elder @ 2013-01-03 23:17 UTC (permalink / raw)
  To: ceph-devel@vger.kernel.org

This series cleans up some parameter lists, eliminating parameters
that don't need to be used.

					-Alex

[PATCH REPOST 1/5] rbd: drop oid parameters from ceph_osdc_build_request()
[PATCH REPOST 2/5] rbd: drop snapid parameter from rbd_req_sync_read()
[PATCH REPOST 3/5] rbd: drop flags parameter from rbd_req_sync_exec()
[PATCH REPOST 4/5] rbd: kill rbd_req_sync_op() snapc and snapid parameters
[PATCH REPOST 5/5] rbd: don't bother setting snapid in rbd_do_request()

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH REPOST 1/5] rbd: drop oid parameters from ceph_osdc_build_request()
  2013-01-03 23:17 [PATCH REPOST 0/5] rbd: drop some unneeded parameters Alex Elder
@ 2013-01-03 23:18 ` Alex Elder
  2013-01-03 23:18 ` [PATCH REPOST 2/5] rbd: drop snapid parameter from rbd_req_sync_read() Alex Elder
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alex Elder @ 2013-01-03 23:18 UTC (permalink / raw)
  To: ceph-devel@vger.kernel.org

The last two parameters to ceph_osd_build_request() describe the
object id, but the values passed always come from the osd request
structure whose address is also provided.  Get rid of those last
two parameters.

Signed-off-by: Alex Elder <elder@inktank.com>
---
 drivers/block/rbd.c             |    6 +-----
 include/linux/ceph/osd_client.h |    4 +---
 net/ceph/osd_client.c           |   13 +++++--------
 3 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 8e030d1..5bca129 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1176,11 +1176,7 @@ static int rbd_do_request(struct request *rq,
 				snapid, ofs, &len, &bno, osd_req, ops);
 	rbd_assert(ret == 0);

-	ceph_osdc_build_request(osd_req, ofs, &len,
-				ops,
-				snapc,
-				&mtime,
-				osd_req->r_oid, osd_req->r_oid_len);
+	ceph_osdc_build_request(osd_req, ofs, &len, ops, snapc, &mtime);

 	if (linger_req) {
 		ceph_osdc_set_request_linger(osdc, osd_req);
diff --git a/include/linux/ceph/osd_client.h
b/include/linux/ceph/osd_client.h
index d9b880e..f2e5d2c 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -227,9 +227,7 @@ extern void ceph_osdc_build_request(struct
ceph_osd_request *req,
 				    u64 off, u64 *plen,
 				    struct ceph_osd_req_op *src_ops,
 				    struct ceph_snap_context *snapc,
-				    struct timespec *mtime,
-				    const char *oid,
-				    int oid_len);
+				    struct timespec *mtime);

 extern struct ceph_osd_request *ceph_osdc_new_request(struct
ceph_osd_client *,
 				      struct ceph_file_layout *layout,
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 5f9f65a..89e7587 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -368,9 +368,7 @@ void ceph_osdc_build_request(struct ceph_osd_request
*req,
 			     u64 off, u64 *plen,
 			     struct ceph_osd_req_op *src_ops,
 			     struct ceph_snap_context *snapc,
-			     struct timespec *mtime,
-			     const char *oid,
-			     int oid_len)
+			     struct timespec *mtime)
 {
 	struct ceph_msg *msg = req->r_request;
 	struct ceph_osd_request_head *head;
@@ -397,9 +395,9 @@ void ceph_osdc_build_request(struct ceph_osd_request
*req,


 	/* fill in oid */
-	head->object_len = cpu_to_le32(oid_len);
-	memcpy(p, oid, oid_len);
-	p += oid_len;
+	head->object_len = cpu_to_le32(req->r_oid_len);
+	memcpy(p, req->r_oid, req->r_oid_len);
+	p += req->r_oid_len;

 	src_op = src_ops;
 	while (src_op->op) {
@@ -498,8 +496,7 @@ struct ceph_osd_request
*ceph_osdc_new_request(struct ceph_osd_client *osdc,

 	ceph_osdc_build_request(req, off, plen, ops,
 				snapc,
-				mtime,
-				req->r_oid, req->r_oid_len);
+				mtime);

 	return req;
 }
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH REPOST 2/5] rbd: drop snapid parameter from rbd_req_sync_read()
  2013-01-03 23:17 [PATCH REPOST 0/5] rbd: drop some unneeded parameters Alex Elder
  2013-01-03 23:18 ` [PATCH REPOST 1/5] rbd: drop oid parameters from ceph_osdc_build_request() Alex Elder
@ 2013-01-03 23:18 ` Alex Elder
  2013-01-03 23:19 ` [PATCH REPOST 3/5] rbd: drop flags parameter from rbd_req_sync_exec() Alex Elder
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alex Elder @ 2013-01-03 23:18 UTC (permalink / raw)
  To: ceph-devel@vger.kernel.org

There is only one caller of rbd_req_sync_read(), and it passes
CEPH_NOSNAP as the snapshot id argument.  Delete that parameter
and just use CEPH_NOSNAP within the function.

Signed-off-by: Alex Elder <elder@inktank.com>
---
 drivers/block/rbd.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 5bca129..b86289f 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1368,7 +1368,6 @@ done:
  * Request sync osd read
  */
 static int rbd_req_sync_read(struct rbd_device *rbd_dev,
-			  u64 snapid,
 			  const char *object_name,
 			  u64 ofs, u64 len,
 			  char *buf,
@@ -1382,7 +1381,7 @@ static int rbd_req_sync_read(struct rbd_device
*rbd_dev,
 		return -ENOMEM;

 	ret = rbd_req_sync_op(rbd_dev, NULL,
-			       snapid,
+			       CEPH_NOSNAP,
 			       CEPH_OSD_FLAG_READ,
 			       ops, object_name, ofs, len, buf, NULL, ver);
 	rbd_destroy_ops(ops);
@@ -1797,8 +1796,7 @@ rbd_dev_v1_header_read(struct rbd_device *rbd_dev,
u64 *version)
 		if (!ondisk)
 			return ERR_PTR(-ENOMEM);

-		ret = rbd_req_sync_read(rbd_dev, CEPH_NOSNAP,
-				       rbd_dev->header_name,
+		ret = rbd_req_sync_read(rbd_dev, rbd_dev->header_name,
 				       0, size,
 				       (char *) ondisk, version);

-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH REPOST 3/5] rbd: drop flags parameter from rbd_req_sync_exec()
  2013-01-03 23:17 [PATCH REPOST 0/5] rbd: drop some unneeded parameters Alex Elder
  2013-01-03 23:18 ` [PATCH REPOST 1/5] rbd: drop oid parameters from ceph_osdc_build_request() Alex Elder
  2013-01-03 23:18 ` [PATCH REPOST 2/5] rbd: drop snapid parameter from rbd_req_sync_read() Alex Elder
@ 2013-01-03 23:19 ` Alex Elder
  2013-01-03 23:19 ` [PATCH REPOST 4/5] rbd: kill rbd_req_sync_op() snapc and snapid parameters Alex Elder
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alex Elder @ 2013-01-03 23:19 UTC (permalink / raw)
  To: ceph-devel@vger.kernel.org

All callers of rbd_req_sync_exec() pass CEPH_OSD_FLAG_READ as their
flags argument.  Delete that parameter and use CEPH_OSD_FLAG_READ
within the function.  If we find a need to support write operations
we can add it back again.

Signed-off-by: Alex Elder <elder@inktank.com>
---
 drivers/block/rbd.c |   27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index b86289f..126d5c0 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1524,7 +1524,6 @@ static int rbd_req_sync_exec(struct rbd_device
*rbd_dev,
 			     size_t outbound_size,
 			     char *inbound,
 			     size_t inbound_size,
-			     int flags,
 			     u64 *ver)
 {
 	struct ceph_osd_req_op *ops;
@@ -1555,8 +1554,7 @@ static int rbd_req_sync_exec(struct rbd_device
*rbd_dev,
 	ops[0].cls.indata_len = outbound_size;

 	ret = rbd_req_sync_op(rbd_dev, NULL,
-			       CEPH_NOSNAP,
-			       flags, ops,
+			       CEPH_NOSNAP, CEPH_OSD_FLAG_READ, ops,
 			       object_name, 0, inbound_size, inbound,
 			       NULL, ver);

@@ -2416,8 +2414,7 @@ static int _rbd_dev_v2_snap_size(struct rbd_device
*rbd_dev, u64 snap_id,
 	ret = rbd_req_sync_exec(rbd_dev, rbd_dev->header_name,
 				"rbd", "get_size",
 				(char *) &snapid, sizeof (snapid),
-				(char *) &size_buf, sizeof (size_buf),
-				CEPH_OSD_FLAG_READ, NULL);
+				(char *) &size_buf, sizeof (size_buf), NULL);
 	dout("%s: rbd_req_sync_exec returned %d\n", __func__, ret);
 	if (ret < 0)
 		return ret;
@@ -2452,8 +2449,7 @@ static int rbd_dev_v2_object_prefix(struct
rbd_device *rbd_dev)
 	ret = rbd_req_sync_exec(rbd_dev, rbd_dev->header_name,
 				"rbd", "get_object_prefix",
 				NULL, 0,
-				reply_buf, RBD_OBJ_PREFIX_LEN_MAX,
-				CEPH_OSD_FLAG_READ, NULL);
+				reply_buf, RBD_OBJ_PREFIX_LEN_MAX, NULL);
 	dout("%s: rbd_req_sync_exec returned %d\n", __func__, ret);
 	if (ret < 0)
 		goto out;
@@ -2492,7 +2488,7 @@ static int _rbd_dev_v2_snap_features(struct
rbd_device *rbd_dev, u64 snap_id,
 				"rbd", "get_features",
 				(char *) &snapid, sizeof (snapid),
 				(char *) &features_buf, sizeof (features_buf),
-				CEPH_OSD_FLAG_READ, NULL);
+				NULL);
 	dout("%s: rbd_req_sync_exec returned %d\n", __func__, ret);
 	if (ret < 0)
 		return ret;
@@ -2547,8 +2543,7 @@ static int rbd_dev_v2_parent_info(struct
rbd_device *rbd_dev)
 	ret = rbd_req_sync_exec(rbd_dev, rbd_dev->header_name,
 				"rbd", "get_parent",
 				(char *) &snapid, sizeof (snapid),
-				(char *) reply_buf, size,
-				CEPH_OSD_FLAG_READ, NULL);
+				(char *) reply_buf, size, NULL);
 	dout("%s: rbd_req_sync_exec returned %d\n", __func__, ret);
 	if (ret < 0)
 		goto out_err;
@@ -2613,8 +2608,7 @@ static char *rbd_dev_image_name(struct rbd_device
*rbd_dev)
 	ret = rbd_req_sync_exec(rbd_dev, RBD_DIRECTORY,
 				"rbd", "dir_get_name",
 				image_id, image_id_size,
-				(char *) reply_buf, size,
-				CEPH_OSD_FLAG_READ, NULL);
+				(char *) reply_buf, size, NULL);
 	if (ret < 0)
 		goto out;
 	p = reply_buf;
@@ -2720,8 +2714,7 @@ static int rbd_dev_v2_snap_context(struct
rbd_device *rbd_dev, u64 *ver)
 	ret = rbd_req_sync_exec(rbd_dev, rbd_dev->header_name,
 				"rbd", "get_snapcontext",
 				NULL, 0,
-				reply_buf, size,
-				CEPH_OSD_FLAG_READ, ver);
+				reply_buf, size, ver);
 	dout("%s: rbd_req_sync_exec returned %d\n", __func__, ret);
 	if (ret < 0)
 		goto out;
@@ -2790,8 +2783,7 @@ static char *rbd_dev_v2_snap_name(struct
rbd_device *rbd_dev, u32 which)
 	ret = rbd_req_sync_exec(rbd_dev, rbd_dev->header_name,
 				"rbd", "get_snapshot_name",
 				(char *) &snap_id, sizeof (snap_id),
-				reply_buf, size,
-				CEPH_OSD_FLAG_READ, NULL);
+				reply_buf, size, NULL);
 	dout("%s: rbd_req_sync_exec returned %d\n", __func__, ret);
 	if (ret < 0)
 		goto out;
@@ -3399,8 +3391,7 @@ static int rbd_dev_image_id(struct rbd_device
*rbd_dev)
 	ret = rbd_req_sync_exec(rbd_dev, object_name,
 				"rbd", "get_id",
 				NULL, 0,
-				response, RBD_IMAGE_ID_LEN_MAX,
-				CEPH_OSD_FLAG_READ, NULL);
+				response, RBD_IMAGE_ID_LEN_MAX, NULL);
 	dout("%s: rbd_req_sync_exec returned %d\n", __func__, ret);
 	if (ret < 0)
 		goto out;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH REPOST 4/5] rbd: kill rbd_req_sync_op() snapc and snapid parameters
  2013-01-03 23:17 [PATCH REPOST 0/5] rbd: drop some unneeded parameters Alex Elder
                   ` (2 preceding siblings ...)
  2013-01-03 23:19 ` [PATCH REPOST 3/5] rbd: drop flags parameter from rbd_req_sync_exec() Alex Elder
@ 2013-01-03 23:19 ` Alex Elder
  2013-01-03 23:19 ` [PATCH REPOST 5/5] rbd: don't bother setting snapid in rbd_do_request() Alex Elder
  2013-01-16  1:46 ` [PATCH REPOST 0/5] rbd: drop some unneeded parameters Josh Durgin
  5 siblings, 0 replies; 7+ messages in thread
From: Alex Elder @ 2013-01-03 23:19 UTC (permalink / raw)
  To: ceph-devel@vger.kernel.org

The snapc and snapid parameters to rbd_req_sync_op() always take
the values NULL and CEPH_NOSNAP, respectively.  So just get rid
of them and use those values where needed.

Signed-off-by: Alex Elder <elder@inktank.com>
---
 drivers/block/rbd.c |   17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 126d5c0..821d93c 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1257,8 +1257,6 @@ static void rbd_simple_req_cb(struct
ceph_osd_request *osd_req,
  * Do a synchronous ceph osd operation
  */
 static int rbd_req_sync_op(struct rbd_device *rbd_dev,
-			   struct ceph_snap_context *snapc,
-			   u64 snapid,
 			   int flags,
 			   struct ceph_osd_req_op *ops,
 			   const char *object_name,
@@ -1278,7 +1276,7 @@ static int rbd_req_sync_op(struct rbd_device *rbd_dev,
 	if (IS_ERR(pages))
 		return PTR_ERR(pages);

-	ret = rbd_do_request(NULL, rbd_dev, snapc, snapid,
+	ret = rbd_do_request(NULL, rbd_dev, NULL, CEPH_NOSNAP,
 			  object_name, ofs, inbound_size, NULL,
 			  pages, num_pages,
 			  flags,
@@ -1380,9 +1378,7 @@ static int rbd_req_sync_read(struct rbd_device
*rbd_dev,
 	if (!ops)
 		return -ENOMEM;

-	ret = rbd_req_sync_op(rbd_dev, NULL,
-			       CEPH_NOSNAP,
-			       CEPH_OSD_FLAG_READ,
+	ret = rbd_req_sync_op(rbd_dev, CEPH_OSD_FLAG_READ,
 			       ops, object_name, ofs, len, buf, NULL, ver);
 	rbd_destroy_ops(ops);

@@ -1461,8 +1457,7 @@ static int rbd_req_sync_watch(struct rbd_device
*rbd_dev)
 	ops[0].watch.cookie = cpu_to_le64(rbd_dev->watch_event->cookie);
 	ops[0].watch.flag = 1;

-	ret = rbd_req_sync_op(rbd_dev, NULL,
-			      CEPH_NOSNAP,
+	ret = rbd_req_sync_op(rbd_dev,
 			      CEPH_OSD_FLAG_WRITE | CEPH_OSD_FLAG_ONDISK,
 			      ops,
 			      rbd_dev->header_name,
@@ -1499,8 +1494,7 @@ static int rbd_req_sync_unwatch(struct rbd_device
*rbd_dev)
 	ops[0].watch.cookie = cpu_to_le64(rbd_dev->watch_event->cookie);
 	ops[0].watch.flag = 0;

-	ret = rbd_req_sync_op(rbd_dev, NULL,
-			      CEPH_NOSNAP,
+	ret = rbd_req_sync_op(rbd_dev,
 			      CEPH_OSD_FLAG_WRITE | CEPH_OSD_FLAG_ONDISK,
 			      ops,
 			      rbd_dev->header_name,
@@ -1553,8 +1547,7 @@ static int rbd_req_sync_exec(struct rbd_device
*rbd_dev,
 	ops[0].cls.indata = outbound;
 	ops[0].cls.indata_len = outbound_size;

-	ret = rbd_req_sync_op(rbd_dev, NULL,
-			       CEPH_NOSNAP, CEPH_OSD_FLAG_READ, ops,
+	ret = rbd_req_sync_op(rbd_dev, CEPH_OSD_FLAG_READ, ops,
 			       object_name, 0, inbound_size, inbound,
 			       NULL, ver);

-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH REPOST 5/5] rbd: don't bother setting snapid in rbd_do_request()
  2013-01-03 23:17 [PATCH REPOST 0/5] rbd: drop some unneeded parameters Alex Elder
                   ` (3 preceding siblings ...)
  2013-01-03 23:19 ` [PATCH REPOST 4/5] rbd: kill rbd_req_sync_op() snapc and snapid parameters Alex Elder
@ 2013-01-03 23:19 ` Alex Elder
  2013-01-16  1:46 ` [PATCH REPOST 0/5] rbd: drop some unneeded parameters Josh Durgin
  5 siblings, 0 replies; 7+ messages in thread
From: Alex Elder @ 2013-01-03 23:19 UTC (permalink / raw)
  To: ceph-devel@vger.kernel.org

For some reason, the snapid field of the osd request header is
explicitly set to CEPH_NOSNAP in rbd_do_request().  Just a few lines
later--with no code that would access this field in between--a call
is made to ceph_calc_raw_layout() passing the snapid provided to
rbd_do_request(), which encodes the snapid value it is provided into
that field instead.

In other words, there is no need to fill in CEPH_NOSNAP, and doing
so suggests it might be necessary.  Don't do that any more.

Signed-off-by: Alex Elder <elder@inktank.com>
---
 drivers/block/rbd.c |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 821d93c..cc12154 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1132,7 +1132,6 @@ static int rbd_do_request(struct request *rq,
 	u64 bno;
 	struct timespec mtime = CURRENT_TIME;
 	struct rbd_request *rbd_req;
-	struct ceph_osd_request_head *reqhead;
 	struct ceph_osd_client *osdc;

 	rbd_req = kzalloc(sizeof(*rbd_req), GFP_NOIO);
@@ -1165,9 +1164,6 @@ static int rbd_do_request(struct request *rq,

 	osd_req->r_priv = rbd_req;

-	reqhead = osd_req->r_request->front.iov_base;
-	reqhead->snapid = cpu_to_le64(CEPH_NOSNAP);
-
 	strncpy(osd_req->r_oid, object_name, sizeof(osd_req->r_oid));
 	osd_req->r_oid_len = strlen(osd_req->r_oid);

-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH REPOST 0/5] rbd: drop some unneeded parameters
  2013-01-03 23:17 [PATCH REPOST 0/5] rbd: drop some unneeded parameters Alex Elder
                   ` (4 preceding siblings ...)
  2013-01-03 23:19 ` [PATCH REPOST 5/5] rbd: don't bother setting snapid in rbd_do_request() Alex Elder
@ 2013-01-16  1:46 ` Josh Durgin
  5 siblings, 0 replies; 7+ messages in thread
From: Josh Durgin @ 2013-01-16  1:46 UTC (permalink / raw)
  To: Alex Elder; +Cc: ceph-devel@vger.kernel.org

On 01/03/2013 03:17 PM, Alex Elder wrote:
> This series cleans up some parameter lists, eliminating parameters
> that don't need to be used.
>
> 					-Alex
>
> [PATCH REPOST 1/5] rbd: drop oid parameters from ceph_osdc_build_request()
> [PATCH REPOST 2/5] rbd: drop snapid parameter from rbd_req_sync_read()
> [PATCH REPOST 3/5] rbd: drop flags parameter from rbd_req_sync_exec()
> [PATCH REPOST 4/5] rbd: kill rbd_req_sync_op() snapc and snapid parameters
> [PATCH REPOST 5/5] rbd: don't bother setting snapid in rbd_do_request()

These look good to me.

Reviewed-by: Josh Durgin <josh.durgin@inktank.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-01-16  1:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-03 23:17 [PATCH REPOST 0/5] rbd: drop some unneeded parameters Alex Elder
2013-01-03 23:18 ` [PATCH REPOST 1/5] rbd: drop oid parameters from ceph_osdc_build_request() Alex Elder
2013-01-03 23:18 ` [PATCH REPOST 2/5] rbd: drop snapid parameter from rbd_req_sync_read() Alex Elder
2013-01-03 23:19 ` [PATCH REPOST 3/5] rbd: drop flags parameter from rbd_req_sync_exec() Alex Elder
2013-01-03 23:19 ` [PATCH REPOST 4/5] rbd: kill rbd_req_sync_op() snapc and snapid parameters Alex Elder
2013-01-03 23:19 ` [PATCH REPOST 5/5] rbd: don't bother setting snapid in rbd_do_request() Alex Elder
2013-01-16  1:46 ` [PATCH REPOST 0/5] rbd: drop some unneeded parameters Josh Durgin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.