rbd: switch to strict_strtol for major parsing

Use common/strict_strtol, which actually parses integers in a proper
way, instead of atoi for parsing /sys/bus/rbd/devices/<id>/major.  This
is important, because the kernel apparently can write things like
"(none)" into that file, and in general is more bulletproof.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
rbd: match against whole disks on unmap

Currently the way 'rbd unmap' translates a user-provided block device
into an rbd id is it matches the major number of the specified device
against /sys/bus/rbd/devices/<id>/major for each rbd mapping and
declares success on the first match.  This works for both entire disks
and partitions, because under the current device number allocation
scheme, each mapping means a new major number.

In preparation for support for single-major device number allocation
scheme, which would require matching both major and minor numbers, make
sure to always match against entire disk device numbers, by converting
the specified device major:minor pair into wholdedisk major:minor pair.
To achive that, use the libblkid library, which accomplishes this goal
by walking stable sysfs structures.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
rbd: match against both major and minor on unmap on newer kernels

As described in commit "rbd: match against wholedisk device numbers on
unmap", currently we only match against major numbers.  In preparation
for support for single-major device number allocation scheme, start
matching against minor numbers also, which newer kernels provide in
a /sys/bus/rbd/devices/<id>/minor sysfs attribute.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
rbd: add support for single-major device number allocation scheme

With the preparatory commits ("rbd: match against wholedisk device
numbers on unmap" and "rbd: match against both major and minor on unmap
on kernels >= 3.14") in, this amounts to chosing to work with new rbd
bus interfaces (/sys/bus/rbd/{add,remove}_single_major) if they are
available, instead of the old ones (/sys/bus/rbd/{add,remove}).

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
rbd: modprobe with single_major=Y on newer kernels

On kernels that support it, and if 'rbd map' is given a chance to
modprobe, turn on single-major device number allocation scheme.  For
users who for some reason don't want it, the workaround is to insert
the rbd module manually before executing the first 'rbd map' command.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Merge pull request #936 from ceph/wip-rbd-single-major

rbd: support for single-major device number allocation scheme

Reviewed-by: Josh Durgin <josh.durgin@inktank.com>