rbd: consolidate rbd_do_op() calls
authorAlex Elder <elder@inktank.com>
Thu, 11 Oct 2012 01:59:29 +0000 (18:59 -0700)
committerAlex Elder <elder@inktank.com>
Fri, 26 Oct 2012 22:18:08 +0000 (17:18 -0500)
commit4634246db8cb2e5117ef7c682efcc383fa3354f8
treecf1e34687cad2c8058b8c6004c2f03ef8cc071cb
parentff2e4bb5b32f89c455979a4222a9b78007cde254
rbd: consolidate rbd_do_op() calls

The two calls to rbd_do_op() from rbd_rq_fn() differ only in the
value passed for the snapshot id and the snapshot context.

For reads the snapshot always comes from the mapping, and for writes
the snapshot id is always CEPH_NOSNAP.

The snapshot context is always null for reads.  For writes, the
snapshot context always comes from the rbd header, but it is
acquired under protection of header semaphore and could change
thereafter, so we can't simply use what's available inside
rbd_do_op().

Eliminate the snapid parameter from rbd_do_op(), and set it
based on the I/O direction inside that function instead.  Always
pass the snapshot context acquired in the caller, but reset it
to a null pointer inside rbd_do_op() if the operation is a read.

As a result, there is no difference in the read and write calls
to rbd_do_op() made in rbd_rq_fn(), so just call it unconditionally.

Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
drivers/block/rbd.c
This page took 0.027245 seconds and 5 git commands to generate.