diff mbox

[1/8] rbd: get rid of snap_name_len

Message ID 508B15FA.7040008@inktank.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Elder Oct. 26, 2012, 11 p.m. UTC
The value returned in the "snap_name_len" argument to
rbd_add_parse_args() is never actually used, so get rid of it.

The snap_name_len recorded in *rbd_dev_v2_snap_name() is not
useful either, so get rid of that too.

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

 	size = sizeof (__le32) + RBD_MAX_SNAP_NAME_LEN;
@@ -2428,9 +2427,7 @@ static char *rbd_dev_v2_snap_name(struct
rbd_device *rbd_dev, u32 which)

 	p = reply_buf;
 	end = (char *) reply_buf + size;
-	snap_name_len = 0;
-	snap_name = ceph_extract_encoded_string(&p, end, &snap_name_len,
-				GFP_KERNEL);
+	snap_name = ceph_extract_encoded_string(&p, end, NULL, GFP_KERNEL);
 	if (IS_ERR(snap_name)) {
 		ret = PTR_ERR(snap_name);
 		goto out;
@@ -2849,8 +2846,7 @@ static struct ceph_options
*rbd_add_parse_args(struct rbd_device *rbd_dev,
 						const char *buf,
 						char *options,
 						size_t options_size,
-						char **snap_name,
-						size_t *snap_name_len)
+						char **snap_name)
 {
 	size_t len;
 	const char *mon_addrs;
@@ -2898,7 +2894,7 @@ static struct ceph_options
*rbd_add_parse_args(struct rbd_device *rbd_dev,
 		goto out_err;
 	memcpy(*snap_name, buf, len);
 	*(*snap_name + len) = '\0';
-	*snap_name_len = len;
+
 	/* Initialize all rbd options to the defaults */

 	rbd_opts.read_only = RBD_READ_ONLY_DEFAULT;
@@ -3131,7 +3127,6 @@ static ssize_t rbd_add(struct bus_type *bus,
 	char *options;
 	struct rbd_device *rbd_dev = NULL;
 	char *snap_name;
-	size_t snap_name_len = 0;
 	struct ceph_options *ceph_opts;
 	struct ceph_osd_client *osdc;
 	int rc = -ENOMEM;
@@ -3154,7 +3149,7 @@ static ssize_t rbd_add(struct bus_type *bus,

 	/* parse add command */
 	ceph_opts = rbd_add_parse_args(rbd_dev, buf, options, count,
-				&snap_name, &snap_name_len);
+				&snap_name);
 	if (IS_ERR(ceph_opts)) {
 		rc = PTR_ERR(ceph_opts);
 		goto err_out_mem;

Comments

Josh Durgin Oct. 29, 2012, 9:14 p.m. UTC | #1
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>

On 10/26/2012 04:00 PM, Alex Elder wrote:
> The value returned in the "snap_name_len" argument to
> rbd_add_parse_args() is never actually used, so get rid of it.
>
> The snap_name_len recorded in *rbd_dev_v2_snap_name() is not
> useful either, so get rid of that too.
>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
>   drivers/block/rbd.c |   13 ++++---------
>   1 file changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 4fe14ff..cae7423 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -2408,7 +2408,6 @@ static char *rbd_dev_v2_snap_name(struct
> rbd_device *rbd_dev, u32 which)
>   	int ret;
>   	void *p;
>   	void *end;
> -	size_t snap_name_len;
>   	char *snap_name;
>
>   	size = sizeof (__le32) + RBD_MAX_SNAP_NAME_LEN;
> @@ -2428,9 +2427,7 @@ static char *rbd_dev_v2_snap_name(struct
> rbd_device *rbd_dev, u32 which)
>
>   	p = reply_buf;
>   	end = (char *) reply_buf + size;
> -	snap_name_len = 0;
> -	snap_name = ceph_extract_encoded_string(&p, end, &snap_name_len,
> -				GFP_KERNEL);
> +	snap_name = ceph_extract_encoded_string(&p, end, NULL, GFP_KERNEL);
>   	if (IS_ERR(snap_name)) {
>   		ret = PTR_ERR(snap_name);
>   		goto out;
> @@ -2849,8 +2846,7 @@ static struct ceph_options
> *rbd_add_parse_args(struct rbd_device *rbd_dev,
>   						const char *buf,
>   						char *options,
>   						size_t options_size,
> -						char **snap_name,
> -						size_t *snap_name_len)
> +						char **snap_name)
>   {
>   	size_t len;
>   	const char *mon_addrs;
> @@ -2898,7 +2894,7 @@ static struct ceph_options
> *rbd_add_parse_args(struct rbd_device *rbd_dev,
>   		goto out_err;
>   	memcpy(*snap_name, buf, len);
>   	*(*snap_name + len) = '\0';
> -	*snap_name_len = len;
> +
>   	/* Initialize all rbd options to the defaults */
>
>   	rbd_opts.read_only = RBD_READ_ONLY_DEFAULT;
> @@ -3131,7 +3127,6 @@ static ssize_t rbd_add(struct bus_type *bus,
>   	char *options;
>   	struct rbd_device *rbd_dev = NULL;
>   	char *snap_name;
> -	size_t snap_name_len = 0;
>   	struct ceph_options *ceph_opts;
>   	struct ceph_osd_client *osdc;
>   	int rc = -ENOMEM;
> @@ -3154,7 +3149,7 @@ static ssize_t rbd_add(struct bus_type *bus,
>
>   	/* parse add command */
>   	ceph_opts = rbd_add_parse_args(rbd_dev, buf, options, count,
> -				&snap_name, &snap_name_len);
> +				&snap_name);
>   	if (IS_ERR(ceph_opts)) {
>   		rc = PTR_ERR(ceph_opts);
>   		goto err_out_mem;
>

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 4fe14ff..cae7423 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -2408,7 +2408,6 @@  static char *rbd_dev_v2_snap_name(struct
rbd_device *rbd_dev, u32 which)
 	int ret;
 	void *p;
 	void *end;
-	size_t snap_name_len;
 	char *snap_name;