diff mbox

[3/9] rbd: call set_snap() before snap_devs_update()

Message ID 504A1669.7030300@inktank.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Elder Sept. 7, 2012, 3:44 p.m. UTC
rbd_header_set_snap() is a simple initialization routine for an rbd
device's mapping.  It has to be called after the snapshot context
for the rbd_dev has been updated, but can be done before snapshot
devices have been registered.

Change the name to rbd_dev_set_mapping() to better reflect its
purpose, and call it a little sooner, before registering snapshot
devices.

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


@@ -2621,11 +2621,12 @@ static ssize_t rbd_add(struct bus_type *bus,
 	rc = rbd_dev_snaps_update(rbd_dev);
 	if (rc)
 		goto err_out_unlock;
-	rc = rbd_dev_snaps_register(rbd_dev);
+
+	rc = rbd_dev_set_mapping(rbd_dev, snap_name);
 	if (rc)
 		goto err_out_unlock;

-	rc = rbd_header_set_snap(rbd_dev, snap_name);
+	rc = rbd_dev_snaps_register(rbd_dev);
 	if (rc)
 		goto err_out_unlock;

Comments

Josh Durgin Sept. 11, 2012, 2:58 p.m. UTC | #1
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>

On 09/07/2012 08:44 AM, Alex Elder wrote:
> rbd_header_set_snap() is a simple initialization routine for an rbd
> device's mapping.  It has to be called after the snapshot context
> for the rbd_dev has been updated, but can be done before snapshot
> devices have been registered.
>
> Change the name to rbd_dev_set_mapping() to better reflect its
> purpose, and call it a little sooner, before registering snapshot
> devices.
>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
>   drivers/block/rbd.c |    7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index d03fb0f..d60db25 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -640,7 +640,7 @@ static int snap_by_name(struct rbd_device *rbd_dev,
> const char *snap_name)
>   	return -ENOENT;
>   }
>
> -static int rbd_header_set_snap(struct rbd_device *rbd_dev, char *snap_name)
> +static int rbd_dev_set_mapping(struct rbd_device *rbd_dev, char *snap_name)
>   {
>   	int ret;
>
> @@ -2621,11 +2621,12 @@ static ssize_t rbd_add(struct bus_type *bus,
>   	rc = rbd_dev_snaps_update(rbd_dev);
>   	if (rc)
>   		goto err_out_unlock;
> -	rc = rbd_dev_snaps_register(rbd_dev);
> +
> +	rc = rbd_dev_set_mapping(rbd_dev, snap_name);
>   	if (rc)
>   		goto err_out_unlock;
>
> -	rc = rbd_header_set_snap(rbd_dev, snap_name);
> +	rc = rbd_dev_snaps_register(rbd_dev);
>   	if (rc)
>   		goto err_out_unlock;
>

--
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 d03fb0f..d60db25 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -640,7 +640,7 @@  static int snap_by_name(struct rbd_device *rbd_dev,
const char *snap_name)
 	return -ENOENT;
 }

-static int rbd_header_set_snap(struct rbd_device *rbd_dev, char *snap_name)
+static int rbd_dev_set_mapping(struct rbd_device *rbd_dev, char *snap_name)
 {
 	int ret;