]> Pileus Git - ~andy/linux/commit
rbd: use snap_id not index to look up snap info
authorAlex Elder <elder@inktank.com>
Tue, 30 Apr 2013 05:44:33 +0000 (00:44 -0500)
committerSage Weil <sage@inktank.com>
Thu, 2 May 2013 04:20:19 +0000 (21:20 -0700)
commit54cac61fb6b3bacecf5367d3838307b1dd69ace2
treede7d9b8a50637f1d02c289379fbe6d5cb22f635b
parent9682fc6d3a8b63f58fbfc5084f32c038170cfd6b
rbd: use snap_id not index to look up snap info

In order to align with what was needed for format 1 rbd images,
rbd_dev_v2_snap_info() was set up to take as argument an index into
the array of snapshot ids in a rbd device's snapshot context.

This switches that around, so we pass the snapshot id instead.
In doing this, rbd_snap_name() now returns a dynamically-allocated
string rather than a fixed one, so there's no need to make a
duplicate in its caller, rbd_dev_spec_update().

This means the following functions take a snapshot id where they
previously used an index value:
    rbd_dev_snap_info()
    rbd_dev_v1_snap_info()
    rbd_dev_v2_snap_info()

A new function, rbd_dev_snap_index(), determines the snap index for
format 1 images and uses it to look up the name.

Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
drivers/block/rbd.c