]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/bluefs: Fix volume selection / accounting
authorAdam Kupczyk <akupczyk@redhat.com>
Sat, 23 Oct 2021 18:28:25 +0000 (18:28 +0000)
committerIgor Fedotov <igor.fedotov@croit.io>
Tue, 27 Jun 2023 10:56:17 +0000 (13:56 +0300)
BlueFS fine grain lock refactor did break accounting in volume selection module.
It caused ceph_test_objectstore to fail on SpilloverFixedTest test.

Signed-off-by: Adam Kupczyk <akupczyk@redhat.com>
(cherry picked from commit 41eb537489b790be620b1c29b121f4fb044089f1)

src/os/bluestore/BlueFS.cc

index cab97907badaed00c418eddae1e8ea468da414b3..3ea840294e8bbb0344d6a7ad3fd4008704a298ad 100644 (file)
@@ -3014,7 +3014,9 @@ int BlueFS::_flush_range_F(FileWriter *h, uint64_t offset, uint64_t length)
   }
 
   dout(20) << __func__ << " file now, unflushed " << h->file->fnode << dendl;
-  return _flush_data(h, offset, length, buffered);
+  int res = _flush_data(h, offset, length, buffered);
+  vselector->add_usage(h->file->vselector_hint, h->file->fnode);
+  return res;
 }
 
 int BlueFS::_flush_data(FileWriter *h, uint64_t offset, uint64_t length, bool buffered)
@@ -3093,7 +3095,6 @@ int BlueFS::_flush_data(FileWriter *h, uint64_t offset, uint64_t length, bool bu
       }
     }
   }
-  vselector->add_usage(h->file->vselector_hint, h->file->fnode);
   dout(20) << __func__ << " h " << h << " pos now 0x"
            << std::hex << h->pos << std::dec << dendl;
   return 0;
@@ -3219,7 +3220,9 @@ int BlueFS::_flush_special(FileWriter *h)
   uint64_t offset = h->pos;
   ceph_assert(length + offset <= h->file->fnode.get_allocated());
   if (h->file->fnode.size < offset + length) {
+    vselector->sub_usage(h->file->vselector_hint, h->file->fnode.size);
     h->file->fnode.size = offset + length;
+    vselector->add_usage(h->file->vselector_hint, h->file->fnode.size);
   }
   return _flush_data(h, offset, length, false);
 }