]> Pileus Git - ~andy/linux/commit
rbd: fix up some sysfs stuff
authorAlex Elder <elder@inktank.com>
Fri, 26 Apr 2013 20:44:36 +0000 (15:44 -0500)
committerSage Weil <sage@inktank.com>
Thu, 2 May 2013 04:19:46 +0000 (21:19 -0700)
commitfc71d8330e39ef3af816a9c869150250952cb712
treef77e909f0d41ce244342e316b4478cdf2098e66c
parente28626a08b3e7412158551a639dd36887e2d728d
rbd: fix up some sysfs stuff

This just tweaks a few things in the routines that implement
rbd sysfs files.

All of the entries for an rbd device in /sys/bus/rbd/devices/<id>/
will represent information whose valid values are known by the time
they are accessible.

Right now we get the size of the mapped image by a call to
get_capacity().  There's no need to do this, because that will
return what we last set the capacity to, which is just the size
recorded for the mapping.  So just show that value instead.

We also get this under protection of the header semaphore, in order
to provide a precisely correct value.  This isn't really necessary;
these files are really informational only and it's not necessary to
be so careful.

Finally, print a special value in case the major device number is
not recorded.  Right now that won't matter much but soon the parent
images won't have devices associated with them.

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