📄 evms_snapshot.h
字号:
/* -*- linux-c -*- *//* * * Copyright (c) International Business Machines Corp., 2000 * * This program 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 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *//* * linux/include/linux/evms_snapshot.h * * EVMS Snapshot Feature kernel header file * */#ifndef __EVMS_SNAPSHOT_INCLUDED__#define __EVMS_SNAPSHOT_INCLUDED__#define EVMS_SNAPSHOT_VERSION_MAJOR 2#define EVMS_SNAPSHOT_VERSION_MINOR 0#define EVMS_SNAPSHOT_VERSION_PATCHLEVEL 0#define EVMS_SNAPSHOT_FEATURE_ID 104#define EVMS_SNAPSHOT_SIGNATURE 0x536e4170 // SnAp#define MAX_HASH_CHAIN_ENTRIES 10#define EVMS_SNAPSHOT 0x01 // Status flags#define EVMS_SNAPSHOT_ORG 0x02#define EVMS_SNAPSHOT_DISABLED 0x04#define EVMS_SNAPSHOT_FULL 0x08#define EVMS_SNAPSHOT_QUIESCED 0x10#define EVMS_SNAPSHOT_WRITEABLE 0x20 // option definitions#define SNAP_OPTION_ORG_VOLUME_NAME "original" // original volume #define SNAP_OPTION_ORG_VOLUME_INDEX 0 // original volume #define SNAP_OPTION_SNAPSHOT_NAME "snapshot" // snapshot volume #define SNAP_OPTION_SNAPSHOT_INDEX 1 // snapshot volume #define SNAP_OPTION_CHUNKSIZE_NAME "chunksize" // chunksize #define SNAP_OPTION_CHUNKSIZE_INDEX 2 // chunksize #define SNAP_OPTION_WRITEABLE_NAME "writeable" // writeable snapshot#define SNAP_OPTION_WRITEABLE_INDEX 3 // writeable snapshot#define SNAPSHOT_DEFAULT_CHUNK_SIZE 128 //sectors#define SNAPSHOT_MIN_CHUNK_SIZE 16 // 8k#define SNAPSHOT_MAX_CHUNK_SIZE 2048 // = 1Meg#define SNAPSHOT_CHUNK_BUFFER_SIZE 128 // copy buffer#define SNAPSHOT_QUERY_PERCENT_FULL 1 // ioctl internal command to query percent full#define SECTOR_SIZE 512// description of on disk meta data sector for snapshot featuretypedef struct _snapshot_metadata {/* 0*/ u_int32_t signature;/* 4*/ u_int32_t CRC;/* 8*/ evms_version_t version; /* structure version *//*12*/ u_int32_t flags;/*16*/ char original_volume[128];/*144*/ u_int64_t original_size;/*152*/ u_int64_t lba_of_COW_table;/*160*/ u_int64_t lba_of_first_chunk;/*168*/ u_int32_t chunk_size; // in sectors/*172*/ u_int32_t total_chunks; } snapshot_metadata_t;#ifdef __KERNEL__// Entries in the snapshot remapping structuretypedef struct _snapshot_hash_entry { unsigned long long org_chunk; unsigned long long snap_chunk; struct _snapshot_hash_entry * next; struct _snapshot_hash_entry * prev;} snapshot_hash_entry_t;typedef struct _snapshot_volume { evms_logical_node_t * logical_node; // node below us unsigned long chunk_size; // Sectors unsigned long chunk_shift; // shift value for chunk size unsigned long num_chunks; // in this volume unsigned long next_cow_entry; // Index into current COW table unsigned long long current_cow_sector; // LOGICAL sector of current COW table unsigned long next_free_chunk; // index of next free chunk (not LBA!) u_int64_t cow_table[64]; // Pointer to one sector's worth of COW tables unsigned long hash_table_size; // size of the hash table for the remap unsigned long flags; // status flags snapshot_hash_entry_t ** snapshot_map; // array of remapped chunks struct _snapshot_volume * snapshot_next; // Linked list of volumes snapshotting this original struct _snapshot_volume * snapshot_org; // Pointer to volume being snapshotted struct semaphore snap_semaphore; // Semaphore for locking of snapshots unsigned char * chunk_data_buffer; // Buffer for reading data when doing a copy-on-write} snapshot_volume_t;#elsetypedef struct _snapshot_volume { storage_object_t * object; // our exported object storage_object_t * child_object; // our child object unsigned long chunk_size; // Sectors unsigned long num_chunks; // in this volume unsigned long next_cow_entry; // Index into current COW table unsigned long long current_cow_sector; // LOGICAL sector of current COW table unsigned long next_free_chunk; // index of next free chunk (not LBA!) u_int64_t cow_table[64]; // Pointer to one sector's worth of COW tables unsigned long hash_table_size; // size of the hash table for the remap unsigned long flags; // status flags// snapshot_hash_entry_t ** snapshot_map; // array of remapped chunks struct _snapshot_volume * snapshot_next; // Linked list of volumes snapshotting this original struct _snapshot_volume * snapshot_org; // Pointer to volume being snapshotted// struct semaphore snap_semaphore; // Semaphore for locking of snapshots// unsigned char * chunk_data_buffer; // Buffer for reading data when doing a copy-on-write snapshot_metadata_t meta_data; // copy of metadata if not original} snapshot_volume_t;#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -