]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
blk/kernel: use uint64_t for bdev_flock_retry
authorKefu Chai <kchai@redhat.com>
Mon, 21 Sep 2020 12:01:25 +0000 (20:01 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 21 Sep 2020 12:17:36 +0000 (20:17 +0800)
also drop bdev_flock_retry and bdev_flock_retry_interval from
legacy_config_opts.h, as `KernelDevice::_lock()` is not in the critical
path, there is no need to access these settings via member variables --
get_val<> would just suffice.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/blk/kernel/KernelDevice.cc
src/common/legacy_config_opts.h
src/common/options.cc

index a0a2e8a06f9c772f266ff4a7ef999d7d6c44dab9..f79fae351c18c8beab5300c84b86070d0449c647 100644 (file)
@@ -86,11 +86,11 @@ int KernelDevice::_lock()
 {
   dout(10) << __func__ << " " << fd_directs[WRITE_LIFE_NOT_SET] << dendl;
   double retry_interval = cct->_conf.get_val<double>("bdev_flock_retry_interval");
-
+  uint64_t max_retry = cct->_conf.get_val<uint64_t>("bdev_flock_retry");
   // When the block changes, systemd-udevd will open the block,
   // read some information and close it. Then a failure occurs here.
   // So we need to try again here.
-  for (int i = 0; i < cct->_conf->bdev_flock_retry + 1; i++) {
+  for (uint64_t i = 0; i < max_retry + 1; i++) {
     int r = ::flock(fd_directs[WRITE_LIFE_NOT_SET], LOCK_EX | LOCK_NB);
     if (r < 0 && errno == EAGAIN) {
       dout(1) << __func__ << " flock busy on " << path << dendl;
index ea16bc85cd71033284c341bdd7593daa68b15080..32e6838f68f8391c626621cc5e80dd9f796f3133 100644 (file)
@@ -897,8 +897,6 @@ OPTION(bdev_debug_aio_log_age, OPT_DOUBLE)
 OPTION(bdev_nvme_unbind_from_kernel, OPT_BOOL)
 OPTION(bdev_enable_discard, OPT_BOOL)
 OPTION(bdev_async_discard, OPT_BOOL)
-OPTION(bdev_flock_retry_interval, OPT_FLOAT)
-OPTION(bdev_flock_retry, OPT_INT)
 
 OPTION(objectstore_blackhole, OPT_BOOL)
 
index 286d5bf7719dd6c8a155b5d0c80dbb66ce82a44a..6e73fb942dd0d733f8334af00ff8663534384e6f 100644 (file)
@@ -4070,7 +4070,7 @@ std::vector<Option> get_global_options() {
     .set_default(0.1)
     .set_description("interval to retry the flock"),
     
-    Option("bdev_flock_retry", Option::TYPE_INT, Option::LEVEL_ADVANCED)
+    Option("bdev_flock_retry", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
     .set_default(3)
     .set_description("times to retry the flock"),