Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright (C) 2011 Red Hat, Inc.
0003  *
0004  * This file is released under the GPL.
0005  */
0006 
0007 #ifndef DM_SPACE_MAP_METADATA_H
0008 #define DM_SPACE_MAP_METADATA_H
0009 
0010 #include "dm-transaction-manager.h"
0011 
0012 #define DM_SM_METADATA_BLOCK_SIZE (4096 >> SECTOR_SHIFT)
0013 
0014 /*
0015  * The metadata device is currently limited in size.
0016  *
0017  * We have one block of index, which can hold 255 index entries.  Each
0018  * index entry contains allocation info about ~16k metadata blocks.
0019  */
0020 #define DM_SM_METADATA_MAX_BLOCKS (255 * ((1 << 14) - 64))
0021 #define DM_SM_METADATA_MAX_SECTORS (DM_SM_METADATA_MAX_BLOCKS * DM_SM_METADATA_BLOCK_SIZE)
0022 
0023 /*
0024  * Unfortunately we have to use two-phase construction due to the cycle
0025  * between the tm and sm.
0026  */
0027 struct dm_space_map *dm_sm_metadata_init(void);
0028 
0029 /*
0030  * Create a fresh space map.
0031  */
0032 int dm_sm_metadata_create(struct dm_space_map *sm,
0033               struct dm_transaction_manager *tm,
0034               dm_block_t nr_blocks,
0035               dm_block_t superblock);
0036 
0037 /*
0038  * Open from a previously-recorded root.
0039  */
0040 int dm_sm_metadata_open(struct dm_space_map *sm,
0041             struct dm_transaction_manager *tm,
0042             void *root_le, size_t len);
0043 
0044 #endif  /* DM_SPACE_MAP_METADATA_H */