@@ -266,69 +266,69 @@ namespace
266266 CCH_RELEASE (tdbb, &window);
267267 }
268268
269- ULONG ensureDiskSpace (thread_db* tdbb, WIN* pip_window , const PageNumber page_num , const ULONG pip_used )
269+ ULONG ensureDiskSpace (thread_db* tdbb, WIN* pipWindow , const PageNumber pageNum , const ULONG pipUsed )
270270 {
271271 const auto * dbb = tdbb->getDatabase ();
272272 const PageManager& pageMgr = dbb->dbb_page_manager ;
273- PageSpace* const pageSpace = pageMgr.findPageSpace (page_num .getPageSpaceID ());
273+ PageSpace* const pageSpace = pageMgr.findPageSpace (pageNum .getPageSpaceID ());
274274
275- const ULONG sequence = page_num .getPageNum () / pageMgr.pagesPerPIP ;
276- const ULONG relative_bit = page_num .getPageNum () - sequence * pageMgr.pagesPerPIP ;
275+ const ULONG sequence = pageNum .getPageNum () / pageMgr.pagesPerPIP ;
276+ const ULONG relativeBit = pageNum .getPageNum () - sequence * pageMgr.pagesPerPIP ;
277277
278- if (relative_bit + 1 <= pip_used )
279- return pip_used ;
280- fb_assert (relative_bit >= pip_used );
278+ if (relativeBit + 1 <= pipUsed )
279+ return pipUsed ;
280+ fb_assert (relativeBit >= pipUsed );
281281
282282 BackupManager::StateReadGuard stateGuard (tdbb);
283283
284284 if (dbb->dbb_backup_manager ->getState () == Ods::hdr_nbak_stalled)
285285 {
286286 // Our file is locked, so we can't extend it anyway.
287287 // Delta will be extended via simple `write` syscalls.
288- return relative_bit + 1 ;
288+ return relativeBit + 1 ;
289289 }
290290
291- USHORT init_pages = 1 ;
291+ USHORT initPages = 1 ;
292292
293293 if (!(dbb->dbb_flags & DBB_no_reserve))
294294 {
295- const unsigned min_extend_pages = MIN_EXTEND_BYTES / dbb->dbb_page_size ;
295+ const unsigned minExtendPages = MIN_EXTEND_BYTES / dbb->dbb_page_size ;
296296
297297 constexpr ULONG MAX_PAGES_IN_EXTENT = 64 ;
298- init_pages = sequence ? MAX_PAGES_IN_EXTENT : MIN (pip_used / 16 , MAX_PAGES_IN_EXTENT);
298+ initPages = sequence ? MAX_PAGES_IN_EXTENT : MIN (pipUsed / 16 , MAX_PAGES_IN_EXTENT);
299299
300300 // don't touch pages belongs to the next PIP
301- init_pages = MIN (init_pages , pageMgr.pagesPerPIP - pip_used );
301+ initPages = MIN (initPages , pageMgr.pagesPerPIP - pipUsed );
302302
303- if (init_pages < min_extend_pages )
304- init_pages = 1 ;
303+ if (initPages < minExtendPages )
304+ initPages = 1 ;
305305 }
306306
307- if (init_pages < relative_bit + 1 - pip_used )
308- init_pages = relative_bit + 1 - pip_used ;
307+ if (initPages < relativeBit + 1 - pipUsed )
308+ initPages = relativeBit + 1 - pipUsed ;
309309
310310 // init_pages = FB_ALIGN(init_pages, PAGES_IN_EXTENT);
311311
312312 FbLocalStatus status;
313- const ULONG used_pages = sequence * pageMgr.pagesPerPIP + pip_used ;
313+ const ULONG usedPages = sequence * pageMgr.pagesPerPIP + pipUsed ;
314314
315- const bool allocate_exact_number_of_pages = dbb->dbb_flags & DBB_no_reserve;
316- const auto extension_result = pageSpace->extend (tdbb, used_pages + init_pages, allocate_exact_number_of_pages );
317- if (extension_result .success )
318- init_pages = extension_result. pages_allocated ;
315+ const bool allocateExactNumberOfPages = dbb->dbb_flags & DBB_no_reserve;
316+ const auto extensionResult = pageSpace->extend (tdbb, usedPages + initPages, allocateExactNumberOfPages );
317+ if (extensionResult .success )
318+ initPages = extensionResult. pagesAllocated ;
319319 else
320320 {
321321 // For some reason fast file extension failed, maybe it is not supported by filesystem, or
322322 // there is not enough space. Try the old way with writing zeroes to extend file.
323- init_pages = PIO_init_data (tdbb, pageSpace->file , &status, used_pages, init_pages );
323+ initPages = PIO_init_data (tdbb, pageSpace->file , &status, usedPages, initPages );
324324 }
325325
326- if (!init_pages )
326+ if (!initPages )
327327 {
328328 // Zero pages was allocated - perhaps it is not supported,
329329 // no space left on disk or IO error occurred. Try to write
330330 // one page and handle IO errors if any.
331- WIN window (page_num );
331+ WIN window (pageNum );
332332 CCH_fake (tdbb, &window, 1 );
333333 CCH_must_write (tdbb, &window);
334334 try
@@ -343,17 +343,17 @@ namespace
343343 // normally all page buffers now released by CCH_unwind
344344 // only exception is when TDBB_no_cache_unwind flag is set
345345 if (tdbb->tdbb_flags & TDBB_no_cache_unwind)
346- CCH_RELEASE (tdbb, pip_window );
346+ CCH_RELEASE (tdbb, pipWindow );
347347
348348 throw ;
349349 }
350350
351- return relative_bit + 1 ;
351+ return relativeBit + 1 ;
352352 }
353353
354354 // We can allocate more pages than we requested, so don't return value bigger
355355 // than PIP can handle (`pagesPerPIP` is limit)
356- return MIN (pip_used + init_pages , pageMgr.pagesPerPIP );
356+ return MIN (pipUsed + initPages , pageMgr.pagesPerPIP );
357357 }
358358
359359} // namespace
@@ -1963,7 +1963,7 @@ PageSpace::ExtendResult PageSpace::extend(thread_db* tdbb, const ULONG pageNum,
19631963
19641964 // First, check it with the cached `maxPageNumber` value.
19651965 if (pageNum < maxPageNumber || pageNum < maxAlloc ())
1966- return {.success = true , .pages_allocated = maxPageNumber - pageNum};
1966+ return {.success = true , .pagesAllocated = maxPageNumber - pageNum};
19671967
19681968 const ULONG MAX_EXTEND_BYTES = static_cast <ULONG>(dbb->dbb_config ->getDatabaseGrowthIncrement ());
19691969 if (MAX_EXTEND_BYTES < MIN_EXTEND_BYTES)
@@ -1995,7 +1995,7 @@ PageSpace::ExtendResult PageSpace::extend(thread_db* tdbb, const ULONG pageNum,
19951995 // File was extended, reset cached value
19961996 maxPageNumber = 0 ;
19971997
1998- return {.success = true , .pages_allocated = extPages};
1998+ return {.success = true , .pagesAllocated = extPages};
19991999 }
20002000 catch (const status_exception&)
20012001 {
@@ -2006,7 +2006,7 @@ PageSpace::ExtendResult PageSpace::extend(thread_db* tdbb, const ULONG pageNum,
20062006 // if file was extended, return, else try to extend by less pages
20072007
20082008 if (const auto newMaxPageNumber = maxAlloc (); oldMaxPageNumber < newMaxPageNumber)
2009- return {.success = true , .pages_allocated = newMaxPageNumber - oldMaxPageNumber};
2009+ return {.success = true , .pagesAllocated = newMaxPageNumber - oldMaxPageNumber};
20102010
20112011 extPages = MAX (reqPages, extPages / 2 );
20122012 }
0 commit comments