[go: up one dir, main page]

Menu

[461a73]: / mng / mng.cpp  Maximize  Restore  History

Download this file

53 lines (44 with data), 1.6 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/***************************************************************************
* mng/mng.cpp
*
* Part of the STXXL. See http://stxxl.sourceforge.net
*
* Copyright (C) 2002-2004 Roman Dementiev <dementiev@mpi-sb.mpg.de>
* Copyright (C) 2008, 2010 Andreas Beckmann <beckmann@cs.uni-frankfurt.de>
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
**************************************************************************/
#include <stxxl/bits/mng/mng.h>
__STXXL_BEGIN_NAMESPACE
block_manager::block_manager()
{
config * cfg = config::get_instance();
ndisks = cfg->disks_number();
disk_allocators = new DiskAllocator *[ndisks];
disk_files = new file *[ndisks];
for (unsigned i = 0; i < ndisks; ++i)
{
disk_files[i] = create_file(cfg->disk_io_impl(i),
cfg->disk_path(i),
file::CREAT | file::RDWR | file::DIRECT,
i, // physical_device_id
i); // allocator_id
disk_allocators[i] = new DiskAllocator(disk_files[i], cfg->disk_size(i));
}
}
block_manager::~block_manager()
{
STXXL_VERBOSE1("Block manager destructor");
for (unsigned i = ndisks; i > 0; )
{
--i;
delete disk_allocators[i];
delete disk_files[i];
}
delete[] disk_allocators;
delete[] disk_files;
}
__STXXL_END_NAMESPACE
// vim: et:ts=4:sw=4