8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 14:03:07 +01:00
This commit is contained in:
asfernandes 2007-09-19 01:46:45 +00:00
parent d792faaf49
commit 96a6ad5863
4 changed files with 17 additions and 11 deletions

View File

@ -4612,4 +4612,3 @@ static processing_state show_users()
return rc; return rc;
} }

View File

@ -525,7 +525,7 @@ USHORT PIO_init_data(Database* dbb, jrd_file* main_file, ISC_STATUS* status_vect
// we need a class here only to return memory on shutdown and avoid // we need a class here only to return memory on shutdown and avoid
// false memory leak reports // false memory leak reports
static Firebird::Array<char> zero_array(*getDefaultMemoryPool()); static Firebird::Array<char> zero_array(*getDefaultMemoryPool());
static char *zero_buff = NULL; static char* zero_buff = NULL;
const int zero_buf_size = 1024 * 128; const int zero_buf_size = 1024 * 128;
if (!zero_buff) if (!zero_buff)
{ {
@ -559,7 +559,8 @@ USHORT PIO_init_data(Database* dbb, jrd_file* main_file, ISC_STATUS* status_vect
if (write_pages > leftPages) if (write_pages > leftPages)
write_pages = leftPages; write_pages = leftPages;
SLONG to_write = write_pages * dbb->dbb_page_size, written; SLONG to_write = write_pages * dbb->dbb_page_size;
SLONG written;
{ {
for (int r = 0; r < IO_RETRY; r++) for (int r = 0; r < IO_RETRY; r++)
@ -586,6 +587,7 @@ USHORT PIO_init_data(Database* dbb, jrd_file* main_file, ISC_STATUS* status_vect
leftPages -= write_pages; leftPages -= write_pages;
i += write_pages; i += write_pages;
} }
return (initPages - leftPages); return (initPages - leftPages);
***/ ***/
} }
@ -1311,4 +1313,3 @@ static int raw_devices_unlink_database (
return 0; return 0;
} }
#endif // SUPPORT_RAW_DEVICES #endif // SUPPORT_RAW_DEVICES

View File

@ -110,7 +110,7 @@ void FileExtendLock::release(thread_db* tdbb, bool exclusive)
class FileExtendLockGuard class FileExtendLockGuard
{ {
public: public:
FileExtendLockGuard(thread_db* tdbb, FileExtendLock *lock, bool exclusive) : FileExtendLockGuard(thread_db* tdbb, FileExtendLock* lock, bool exclusive) :
m_tdbb(tdbb), m_lock(lock), m_exclusive(exclusive) m_tdbb(tdbb), m_lock(lock), m_exclusive(exclusive)
{ {
if (exclusive) { if (exclusive) {
@ -364,7 +364,7 @@ void PIO_extend(jrd_file* main_file, const ULONG extPages, const USHORT pageSize
LARGE_INTEGER newSize; LARGE_INTEGER newSize;
newSize.QuadPart = (ULONGLONG) (filePages + extendBy) * pageSize; newSize.QuadPart = (ULONGLONG) (filePages + extendBy) * pageSize;
if (ostype == OS_CHICAGO) { if (ostype == OS_CHICAGO) { // WIN95
file->fil_mutex.enter(); file->fil_mutex.enter();
} }
@ -385,6 +385,7 @@ void PIO_extend(jrd_file* main_file, const ULONG extPages, const USHORT pageSize
if (ostype == OS_CHICAGO) { if (ostype == OS_CHICAGO) {
file->fil_mutex.leave(); file->fil_mutex.leave();
} }
leftPages -= extendBy; leftPages -= extendBy;
} }
} }
@ -591,7 +592,7 @@ USHORT PIO_init_data(Database* dbb, jrd_file* main_file, ISC_STATUS* status_vect
// we need a class here only to return memory on shutdown and avoid // we need a class here only to return memory on shutdown and avoid
// false memory leak reports // false memory leak reports
static Firebird::Array<char> zero_array(*getDefaultMemoryPool()); static Firebird::Array<char> zero_array(*getDefaultMemoryPool());
static char *zero_buff = NULL; static char* zero_buff = NULL;
const int zero_buf_size = 1024 * 128; const int zero_buf_size = 1024 * 128;
if (!zero_buff) if (!zero_buff)
{ {
@ -608,7 +609,8 @@ USHORT PIO_init_data(Database* dbb, jrd_file* main_file, ISC_STATUS* status_vect
bdb.bdb_dbb = dbb; bdb.bdb_dbb = dbb;
bdb.bdb_page = PageNumber(0, startPage); bdb.bdb_page = PageNumber(0, startPage);
OVERLAPPED overlapped, *overlapped_ptr; OVERLAPPED overlapped;
OVERLAPPED* overlapped_ptr;
jrd_file* file = jrd_file* file =
seek_file(main_file, &bdb, status_vector, &overlapped, &overlapped_ptr); seek_file(main_file, &bdb, status_vector, &overlapped, &overlapped_ptr);
@ -632,7 +634,8 @@ USHORT PIO_init_data(Database* dbb, jrd_file* main_file, ISC_STATUS* status_vect
seek_file(main_file, &bdb, status_vector, &overlapped, &overlapped_ptr); seek_file(main_file, &bdb, status_vector, &overlapped, &overlapped_ptr);
DWORD to_write = (DWORD) write_pages * dbb->dbb_page_size, written; DWORD to_write = (DWORD) write_pages * dbb->dbb_page_size;
DWORD written;
if (!WriteFile(file->fil_desc, zero_buff, to_write, &written, overlapped_ptr) || if (!WriteFile(file->fil_desc, zero_buff, to_write, &written, overlapped_ptr) ||
to_write != written) to_write != written)
@ -650,6 +653,7 @@ USHORT PIO_init_data(Database* dbb, jrd_file* main_file, ISC_STATUS* status_vect
leftPages -= write_pages; leftPages -= write_pages;
i += write_pages; i += write_pages;
} }
return (initPages - leftPages); return (initPages - leftPages);
} }
@ -1351,4 +1355,3 @@ static bool nt_error(TEXT* string,
return true; return true;
} }

View File

@ -851,6 +851,7 @@ PAG PAG_allocate(WIN * window)
} }
fb_assert(new_page); fb_assert(new_page);
} }
if (!(dbb->dbb_flags & DBB_no_reserve)) if (!(dbb->dbb_flags & DBB_no_reserve))
{ {
const ULONG initialized = const ULONG initialized =
@ -858,7 +859,7 @@ PAG PAG_allocate(WIN * window)
// At this point we ensure database has at least "initialized" pages // At this point we ensure database has at least "initialized" pages
// allocated. To avoid file growth by few pages when all this space // allocated. To avoid file growth by few pages when all this space
// will be used extend file up to initialized + next_init_pages now // will be used, extend file up to initialized + next_init_pages now
pageSpace->extend(tdbb, initialized + next_init_pages); pageSpace->extend(tdbb, initialized + next_init_pages);
} }
} }
@ -2420,10 +2421,12 @@ void PageManager::closeAll()
void PageManager::releaseLocks() void PageManager::releaseLocks()
{ {
for (size_t i = 0; i < pageSpaces.getCount(); i++) for (size_t i = 0; i < pageSpaces.getCount(); i++)
{
if (pageSpaces[i]->file && pageSpaces[i]->file->fil_ext_lock) { if (pageSpaces[i]->file && pageSpaces[i]->file->fil_ext_lock) {
delete pageSpaces[i]->file->fil_ext_lock; delete pageSpaces[i]->file->fil_ext_lock;
pageSpaces[i]->file->fil_ext_lock = NULL; pageSpaces[i]->file->fil_ext_lock = NULL;
} }
}
} }
USHORT PageManager::getTempPageSpaceID(thread_db* tdbb) USHORT PageManager::getTempPageSpaceID(thread_db* tdbb)