]> git.ipfire.org Git - people/arne_f/kernel.git/commit - drivers/block/rbd.c
rbd: use snaps list in rbd_snap_by_name()
authorAlex Elder <elder@inktank.com>
Wed, 11 Jul 2012 01:30:11 +0000 (20:30 -0500)
committerAlex Elder <elder@inktank.com>
Mon, 1 Oct 2012 19:30:52 +0000 (14:30 -0500)
commite86924a8092fda66b859f12a4d7d37a4a458d74a
treef6b012ea7de1127798d08969e4f9b09cf9989175
parentcd789ab9cacbda1aad43304b89cff29004b793ea
rbd: use snaps list in rbd_snap_by_name()

An rbd_dev structure maintains a list of current snapshots that have
already been fully initialized.  The entries on the list have type
struct rbd_snap, and each entry contains a copy of information
that's found in the rbd_dev's snapshot context and header.

The only caller of snap_by_name() is rbd_header_set_snap().  In that
call site any positive return value (the index in the snapshot
array) is ignored, so there's no need to return the index in
the snapshot context's id array when it's found.

rbd_header_set_snap() also has only one caller--rbd_add()--and that
call is made after a call to rbd_dev_snap_devs_update().  Because
the rbd_snap structures are initialized in that function, the
current snapshot list can be used instead of the snapshot context to
look up a snapshot's information by name.

Change snap_by_name() so it uses the snapshot list rather than the
rbd_dev's snapshot context in looking up snapshot information.
Return 0 if it's found rather than the snapshot id.

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