move space maps to their own sub directory

This commit is contained in:
Joe Thornber
2013-01-10 21:36:38 +00:00
parent 6a4facf03b
commit 326fd3408b
15 changed files with 31 additions and 29 deletions

View File

@@ -16,7 +16,7 @@
// with thin-provisioning-tools. If not, see
// <http://www.gnu.org/licenses/>.
#include "persistent-data/space_map_careful_alloc.h"
#include "persistent-data/space-maps/careful_alloc.h"
#include <set>

View File

@@ -19,7 +19,7 @@
#ifndef SPACE_MAP_CAREFUL_ALLOC_H
#define SPACE_MAP_CAREFUL_ALLOC_H
#include "space_map.h"
#include "persistent-data/space_map.h"
//----------------------------------------------------------------

View File

@@ -19,7 +19,7 @@
#ifndef CORE_MAP_H
#define CORE_MAP_H
#include "space_map.h"
#include "persistent-data/space_map.h"
//----------------------------------------------------------------

View File

@@ -16,15 +16,15 @@
// with thin-provisioning-tools. If not, see
// <http://www.gnu.org/licenses/>.
#include "space_map_disk.h"
#include "disk.h"
#include "disk_structures.h"
#include "recursive.h"
#include "careful_alloc.h"
#include "checksum.h"
#include "endian_utils.h"
#include "math_utils.h"
#include "space_map_disk_structures.h"
#include "space_map_recursive.h"
#include "space_map_careful_alloc.h"
#include "transaction_manager.h"
#include "persistent-data/checksum.h"
#include "persistent-data/endian_utils.h"
#include "persistent-data/math_utils.h"
#include "persistent-data/transaction_manager.h"
using namespace boost;
using namespace persistent_data;

View File

@@ -19,8 +19,9 @@
#ifndef SPACE_MAP_DISK_H
#define SPACE_MAP_DISK_H
#include "btree_checker.h"
#include "space_map.h"
// FIXME: why is btree_checker needed?
#include "persistent-data/btree_checker.h"
#include "persistent-data/space_map.h"
//----------------------------------------------------------------

View File

@@ -0,0 +1,116 @@
// Copyright (C) 2011 Red Hat, Inc. All rights reserved.
//
// This file is part of the thin-provisioning-tools source.
//
// thin-provisioning-tools is free software: you can redistribute it
// and/or modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// thin-provisioning-tools is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with thin-provisioning-tools. If not, see
// <http://www.gnu.org/licenses/>.
#ifndef SPACE_MAP_DISK_STRUCTURES_H
#define SPACE_MAP_DISK_STRUCTURES_H
#include "persistent-data/endian_utils.h"
#include "persistent-data/btree.h"
//----------------------------------------------------------------
namespace persistent_data {
using namespace base;
namespace sm_disk_detail {
struct index_entry_disk {
__le64 blocknr_;
__le32 nr_free_;
__le32 none_free_before_;
} __attribute__ ((packed));
struct index_entry {
uint64_t blocknr_;
uint32_t nr_free_;
uint32_t none_free_before_;
};
struct index_entry_traits {
typedef index_entry_disk disk_type;
typedef index_entry value_type;
typedef NoOpRefCounter<index_entry> ref_counter;
static void unpack(disk_type const &disk, value_type &value) {
value.blocknr_ = to_cpu<uint64_t>(disk.blocknr_);
value.nr_free_ = to_cpu<uint32_t>(disk.nr_free_);
value.none_free_before_ = to_cpu<uint32_t>(disk.none_free_before_);
}
static void pack(value_type const &value, disk_type &disk) {
disk.blocknr_ = to_disk<__le64>(value.blocknr_);
disk.nr_free_ = to_disk<__le32>(value.nr_free_);
disk.none_free_before_ = to_disk<__le32>(value.none_free_before_);
}
};
unsigned const MAX_METADATA_BITMAPS = 255;
unsigned const ENTRIES_PER_BYTE = 4;
struct metadata_index {
__le32 csum_;
__le32 padding_;
__le64 blocknr_;
struct index_entry_disk index[MAX_METADATA_BITMAPS];
} __attribute__ ((packed));
struct sm_root_disk {
__le64 nr_blocks_;
__le64 nr_allocated_;
__le64 bitmap_root_;
__le64 ref_count_root_;
} __attribute__ ((packed));
struct sm_root {
uint64_t nr_blocks_;
uint64_t nr_allocated_;
uint64_t bitmap_root_;
uint64_t ref_count_root_;
};
struct sm_root_traits {
typedef sm_root_disk disk_type;
typedef sm_root value_type;
typedef NoOpRefCounter<sm_root> ref_counter;
static void unpack(disk_type const &disk, value_type &value) {
value.nr_blocks_ = to_cpu<uint64_t>(disk.nr_blocks_);
value.nr_allocated_ = to_cpu<uint64_t>(disk.nr_allocated_);
value.bitmap_root_ = to_cpu<uint64_t>(disk.bitmap_root_);
value.ref_count_root_ = to_cpu<uint64_t>(disk.ref_count_root_);
}
static void pack(value_type const &value, disk_type &disk) {
disk.nr_blocks_ = to_disk<__le64>(value.nr_blocks_);
disk.nr_allocated_ = to_disk<__le64>(value.nr_allocated_);
disk.bitmap_root_ = to_disk<__le64>(value.bitmap_root_);
disk.ref_count_root_ = to_disk<__le64>(value.ref_count_root_);
}
};
struct bitmap_header {
__le32 csum;
__le32 not_used;
__le64 blocknr;
} __attribute__ ((packed));
}
}
//----------------------------------------------------------------
#endif

View File

@@ -16,7 +16,7 @@
// with thin-provisioning-tools. If not, see
// <http://www.gnu.org/licenses/>.
#include "persistent-data/space_map_recursive.h"
#include "persistent-data/space-maps/recursive.h"
using namespace persistent_data;

View File

@@ -19,7 +19,7 @@
#ifndef SPACE_MAP_RECURSIVE_H
#define SPACE_MAP_RECURSIVE_H
#include "space_map.h"
#include "persistent-data/space_map.h"
//----------------------------------------------------------------