]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/bluefs: Fix vselector 44955/head
authorAdam Kupczyk <akupczyk@redhat.com>
Tue, 15 Feb 2022 22:13:59 +0000 (23:13 +0100)
committerAdam Kupczyk <akupczyk@redhat.com>
Tue, 15 Feb 2022 22:31:53 +0000 (23:31 +0100)
Fix bluefs volume selector in device_migrate_to_existing.
Fix bluefs volume selector in _rewrite_log_and_layout_sync_LNF_LD.

Fixes: https://tracker.ceph.com/issues/54248
Signed-off-by: Adam Kupczyk <akupczyk@redhat.com>
src/os/bluestore/BlueFS.cc

index 3b7d329f79d9796dae230e208370442a81870487..0b9bb0bba8e9842eec0cc9f7bb0944220cc27a01 100644 (file)
@@ -1729,6 +1729,7 @@ int BlueFS::device_migrate_to_existing(
     dout(10) << __func__ << " " << ino << " " << file_ref->fnode << dendl;
 
     auto& fnode_extents = file_ref->fnode.extents;
+    vselector->sub_usage(file_ref->vselector_hint, file_ref->fnode);
 
     bool rewrite = std::any_of(
       fnode_extents.begin(),
@@ -1804,6 +1805,7 @@ int BlueFS::device_migrate_to_existing(
        }
       }
     }
+    vselector->add_usage(file_ref->vselector_hint, file_ref->fnode);
   }
   // new logging device in the current naming scheme
   int new_log_dev_cur = bdev[BDEV_WAL] ?
@@ -2469,6 +2471,7 @@ void BlueFS::_rewrite_log_and_layout_sync_LNF_LD(bool allocate_with_fallback,
 
   bluefs_fnode_t old_fnode;
   int r;
+  vselector->sub_usage(log_file->vselector_hint, log_file->fnode);
   log_file->fnode.swap_extents(old_fnode);
   if (allocate_with_fallback) {
     r = _allocate(log_dev, need, &log_file->fnode);
@@ -2490,13 +2493,11 @@ void BlueFS::_rewrite_log_and_layout_sync_LNF_LD(bool allocate_with_fallback,
   // we will write it to super
   log_file->fnode.reset_delta();
   log_file->fnode.size = bl.length();
-  vselector->sub_usage(log_file->vselector_hint, old_fnode);
-  vselector->add_usage(log_file->vselector_hint, log_file->fnode);
 
   log.writer = _create_writer(log_file);
   log.writer->append(bl);
-  uint64_t new_data = _flush_special(log.writer);
-  vselector->add_usage(log_file->vselector_hint, new_data);
+  _flush_special(log.writer);
+  vselector->add_usage(log_file->vselector_hint, log_file->fnode);
 #ifdef HAVE_LIBAIO
   if (!cct->_conf->bluefs_sync_write) {
     list<aio_t> completed_ios;