Skip to content

Commit 8911b29

Browse files
committed
crimson/os/seastore/cache: throw enospc when failed to alloc new extents
Signed-off-by: Xuehan Xu <[email protected]>
1 parent 4cb1243 commit 8911b29

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/crimson/os/seastore/cache.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,8 @@ class Cache {
978978
auto result = epm.alloc_new_non_data_extent(t, T::TYPE, length, hint, gen);
979979
#endif
980980
if (!result) {
981-
return nullptr;
981+
SUBERRORT(seastore_cache, "insufficient space", t);
982+
std::rethrow_exception(crimson::ct_error::enospc::exception_ptr());
982983
}
983984
auto ret = CachedExtent::make_cached_extent_ref<T>(std::move(result->bp));
984985
ret->init(CachedExtent::extent_state_t::INITIAL_WRITE_PENDING,
@@ -1019,6 +1020,10 @@ class Cache {
10191020
#else
10201021
auto results = epm.alloc_new_data_extents(t, T::TYPE, length, hint, gen);
10211022
#endif
1023+
if (results.empty()) {
1024+
SUBERRORT(seastore_cache, "insufficient space", t);
1025+
std::rethrow_exception(crimson::ct_error::enospc::exception_ptr());
1026+
}
10221027
std::vector<TCachedExtentRef<T>> extents;
10231028
for (auto &result : results) {
10241029
auto ret = CachedExtent::make_cached_extent_ref<T>(std::move(result.bp));

src/crimson/os/seastore/transaction_manager.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -304,10 +304,6 @@ class TransactionManager : public ExtentCallbackInterface {
304304
len,
305305
placement_hint,
306306
INIT_GENERATION);
307-
if (!ext) {
308-
SUBERRORT(seastore_tm, "insufficient space!", t);
309-
return crimson::ct_error::enospc::make();
310-
}
311307
return lba_manager->alloc_extent(
312308
t,
313309
laddr_hint,
@@ -343,10 +339,6 @@ class TransactionManager : public ExtentCallbackInterface {
343339
len,
344340
placement_hint,
345341
INIT_GENERATION);
346-
if (exts.empty()) {
347-
SUBERRORT(seastore_tm, "insufficient space!", t);
348-
return crimson::ct_error::enospc::make();
349-
}
350342
return lba_manager->alloc_extents(
351343
t,
352344
laddr_hint,

0 commit comments

Comments
 (0)