diff mbox

[7/9] rbd: drop dev registration check for new snap

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

Commit Message

Alex Elder Sept. 7, 2012, 3:45 p.m. UTC
By the time rbd_dev_snaps_register() gets called during rbd device
initialization, the main device will have already been registered.
Similarly, a header refresh will only occur for an rbd device whose
Linux device is registered.  There is therefore no need to verify
the main device is registered when registering a snapshot device.

For the time being, turn the check into a WARN_ON(), but it can
eventually just go away.

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

 		if (!rbd_snap_registered(snap)) {

Comments

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

On 09/07/2012 08:45 AM, Alex Elder wrote:
> By the time rbd_dev_snaps_register() gets called during rbd device
> initialization, the main device will have already been registered.
> Similarly, a header refresh will only occur for an rbd device whose
> Linux device is registered.  There is therefore no need to verify
> the main device is registered when registering a snapshot device.
>
> For the time being, turn the check into a WARN_ON(), but it can
> eventually just go away.
>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
>   drivers/block/rbd.c |    4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 8e82610..e6af38f 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -2253,8 +2253,8 @@ static int rbd_dev_snaps_register(struct
> rbd_device *rbd_dev)
>   	int ret = 0;
>
>   	dout("%s called\n", __func__);
> -	if (!device_is_registered(&rbd_dev->dev))
> -		return 0;
> +	if (WARN_ON(!device_is_registered(&rbd_dev->dev)))
> +		return -EIO;
>
>   	list_for_each_entry(snap, &rbd_dev->snaps, node) {
>   		if (!rbd_snap_registered(snap)) {
>

--
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 8e82610..e6af38f 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -2253,8 +2253,8 @@  static int rbd_dev_snaps_register(struct
rbd_device *rbd_dev)
 	int ret = 0;

 	dout("%s called\n", __func__);
-	if (!device_is_registered(&rbd_dev->dev))
-		return 0;
+	if (WARN_ON(!device_is_registered(&rbd_dev->dev)))
+		return -EIO;

 	list_for_each_entry(snap, &rbd_dev->snaps, node) {