]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
seastore/rbm: replace blk_paddr_t with size_t in free_extent()
authormyoungwon oh <ohmyoungwon@gmail.com>
Fri, 11 Jun 2021 13:17:23 +0000 (22:17 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Tue, 15 Jun 2021 02:09:06 +0000 (11:09 +0900)
Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
src/crimson/os/seastore/random_block_manager.h
src/crimson/os/seastore/random_block_manager/nvme_manager.cc
src/crimson/os/seastore/random_block_manager/nvme_manager.h
src/test/crimson/seastore/test_randomblock_manager.cc

index 8efca624fc25bcb7559faaf8659d28cb88a61448..a25ec5ba99c252529dfed7ae68c263f8364db7dc 100644 (file)
@@ -79,7 +79,7 @@ public:
     crimson::ct_error::invarg
     >;
   // TODO: will include trim if necessary
-  virtual free_block_ertr::future<> free_extent(Transaction &t, blk_paddr_t from, blk_paddr_t to) = 0;
+  virtual free_block_ertr::future<> free_extent(Transaction &t, blk_paddr_t from, size_t len) = 0;
 
   using abort_allocation_ertr = crimson::errorator<
     crimson::ct_error::input_output_error,
index f22b8e4c52dd6b01cd045784c9bae043f86f1dd3..5207dbee4ae89f99b623007082257245c6ebd3ee 100644 (file)
@@ -294,13 +294,13 @@ NVMeManager::allocate_ertr::future<> NVMeManager::alloc_extent(
 }
 
 NVMeManager::free_block_ertr::future<> NVMeManager::free_extent(
-    Transaction &t, blk_paddr_t from, blk_paddr_t to)
+    Transaction &t, blk_paddr_t from, size_t len)
 {
+  ceph_assert(!(len % super.block_size));
   blk_id_t blk_id_start = from / super.block_size;
-  blk_id_t blk_id_end = to / super.block_size;
 
   interval_set<blk_id_t> free_extent;
-  free_extent.insert(blk_id_start, blk_id_end - blk_id_start + 1);
+  free_extent.insert(blk_id_start, len / super.block_size);
   rbm_alloc_delta_t alloc_info {
     extent_types_t::RBM_ALLOC_INFO,
     free_extent,
index e8745ddca3517329221e3d2a696222d86277d350..7015e351e30b74851f14a8859f1f9e38b17276f3 100644 (file)
@@ -212,7 +212,7 @@ public:
    */
   // TODO: will include trim if necessary
   free_block_ertr::future<> free_extent(
-      Transaction &t, blk_paddr_t from, blk_paddr_t to) final;
+      Transaction &t, blk_paddr_t from, size_t len) final;
   abort_allocation_ertr::future<> abort_allocation(Transaction &t) final;
   write_ertr::future<> complete_allocation(Transaction &t) final;
 
index 8ea9a502b5099293486c6647cf68ba954843712d..994a9b8afdf4c24f5fcb579095aba7ad70ea10e2 100644 (file)
@@ -93,10 +93,10 @@ struct rbm_test_t : public  seastar_test_suite_t,
 
   auto free_extent(Transaction &t, interval_set<blk_id_t> range) {
     for (auto r : range) {
-      logger().debug("free_extent: start {} end {}", r.first * DEFAULT_BLOCK_SIZE,
-                     (r.first + r.second - 1) * DEFAULT_BLOCK_SIZE);
+      logger().debug("free_extent: start {} len {}", r.first * DEFAULT_BLOCK_SIZE,
+                     r.second * DEFAULT_BLOCK_SIZE);
       return rbm_manager->free_extent(t, r.first * DEFAULT_BLOCK_SIZE,
-             (r.first + r.second - 1) * DEFAULT_BLOCK_SIZE).unsafe_get0();
+            r.second * DEFAULT_BLOCK_SIZE).unsafe_get0();
     }
   }