]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
krbd: rename should_match_minor() to have_minor_attr()
authorIlya Dryomov <idryomov@gmail.com>
Wed, 15 Apr 2015 14:18:05 +0000 (17:18 +0300)
committerIlya Dryomov <idryomov@gmail.com>
Sun, 19 Apr 2015 11:41:53 +0000 (14:41 +0300)
Rename and clarify why simply checking kernel version doesn't work.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
src/krbd.cc

index 04f40047542984f9c546a5ab5d01e24b61cb2a9f..da426b188c6ef6cee3d5c3a62a134be186f08637 100644 (file)
@@ -93,12 +93,15 @@ static int sysfs_write_rbd_remove(const string& buf)
   return sysfs_write_rbd("remove", buf);
 }
 
-static int should_match_minor(void)
+static int have_minor_attr(void)
 {
   /*
    * 'minor' attribute was added as part of single_major merge, which
    * exposed the 'single_major' parameter.  'minor' is always present,
    * regardless of whether single-major scheme is turned on or not.
+   *
+   * (Something like ver >= KERNEL_VERSION(3, 14, 0) is a no-go because
+   * this has to work with rbd.ko backported to various kernels.)
    */
   return access("/sys/module/rbd/parameters/single_major", F_OK) == 0;
 }
@@ -217,7 +220,7 @@ static int wait_for_udev_add(struct udev_monitor *mon, const char *pool,
         const char *this_major = udev_device_get_property_value(dev, "MAJOR");
         const char *this_minor = udev_device_get_property_value(dev, "MINOR");
 
-        assert(!minor ^ should_match_minor());
+        assert(!minor ^ have_minor_attr());
 
         if (strcmp(this_major, major) == 0 &&
             (!minor || strcmp(this_minor, minor) == 0)) {
@@ -338,7 +341,7 @@ static int devno_to_krbd_id(struct udev *udev, dev_t devno, string *pid)
   if (r < 0)
     goto out_enm;
 
-  if (should_match_minor()) {
+  if (have_minor_attr()) {
     r = udev_enumerate_add_match_sysattr(enm, "minor",
                                          stringify(minor(devno)).c_str());
     if (r < 0)