rbd: handle online resize of underlying rbd image
authorSage Weil <sage@newdream.net>
Wed, 20 Apr 2011 05:49:06 +0000 (22:49 -0700)
committerSage Weil <sage@newdream.net>
Tue, 24 May 2011 18:52:08 +0000 (11:52 -0700)
If we get a notification that the image header has changed, check for
a change in the image size.

Signed-off-by: Sage Weil <sage@newdream.net>
drivers/block/rbd.c

index d833d02b321f239b840266f739a6a878eb47cacf..1278098624e6382ab77522c68535d39b3c863916 100644 (file)
@@ -1664,6 +1664,9 @@ static int __rbd_update_snaps(struct rbd_device *rbd_dev)
        if (ret < 0)
                return ret;
 
+       /* resized? */
+       set_capacity(rbd_dev->disk, h.image_size / 512ULL);
+
        down_write(&rbd_dev->header.snap_rwsem);
 
        snap_seq = rbd_dev->header.snapc->seq;