Get rid of the trivial wrapper functions rbd_dev_v1_refresh() and
rbd_dev_v1_probe(), substituting rbd_dev_v1_header_read() calls
in their place.
Rename rbd_dev_v1_header_read() to be rbd_dev_v1_header_info(), to
be more generic (it will better reflect what happens with format 2
images).
Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
* Copy the names, and fill in each snapshot's id
* and size.
*
* Copy the names, and fill in each snapshot's id
* and size.
*
- * Note that rbd_dev_v1_header_read() guarantees the
+ * Note that rbd_dev_v1_header_info() guarantees the
* ondisk buffer we're working with has
* snap_names_len bytes beyond the end of the
* snapshot id array, this memcpy() is safe.
* ondisk buffer we're working with has
* snap_names_len bytes beyond the end of the
* snapshot id array, this memcpy() is safe.
* return, the rbd_dev->header field will contain up-to-date
* information about the image.
*/
* return, the rbd_dev->header field will contain up-to-date
* information about the image.
*/
-static int rbd_dev_v1_header_read(struct rbd_device *rbd_dev)
+static int rbd_dev_v1_header_info(struct rbd_device *rbd_dev)
{
struct rbd_image_header_ondisk *ondisk = NULL;
u32 snap_count = 0;
{
struct rbd_image_header_ondisk *ondisk = NULL;
u32 snap_count = 0;
-/*
- * only read the first part of the ondisk header, without the snaps info
- */
-static int rbd_dev_v1_refresh(struct rbd_device *rbd_dev)
-{
- return rbd_dev_v1_header_read(rbd_dev);
-}
-
/*
* Clear the rbd device's EXISTS flag if the snapshot it's mapped to
* has disappeared from the (just updated) snapshot context.
/*
* Clear the rbd device's EXISTS flag if the snapshot it's mapped to
* has disappeared from the (just updated) snapshot context.
mapping_size = rbd_dev->mapping.size;
mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING);
if (rbd_dev->image_format == 1)
mapping_size = rbd_dev->mapping.size;
mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING);
if (rbd_dev->image_format == 1)
- ret = rbd_dev_v1_refresh(rbd_dev);
+ ret = rbd_dev_v1_header_info(rbd_dev);
else
ret = rbd_dev_v2_refresh(rbd_dev);
else
ret = rbd_dev_v2_refresh(rbd_dev);
memset(header, 0, sizeof (*header));
}
memset(header, 0, sizeof (*header));
}
-static int rbd_dev_v1_probe(struct rbd_device *rbd_dev)
-{
- return rbd_dev_v1_header_read(rbd_dev);
-}
-
static int rbd_dev_v2_probe(struct rbd_device *rbd_dev)
{
int ret;
static int rbd_dev_v2_probe(struct rbd_device *rbd_dev)
{
int ret;
goto out_header_name;
if (rbd_dev->image_format == 1)
goto out_header_name;
if (rbd_dev->image_format == 1)
- ret = rbd_dev_v1_probe(rbd_dev);
+ ret = rbd_dev_v1_header_info(rbd_dev);
else
ret = rbd_dev_v2_probe(rbd_dev);
if (ret)
else
ret = rbd_dev_v2_probe(rbd_dev);
if (ret)