Linux Audio

Check our new training course

Loading...
v6.8
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/*
 3 * Copyright (C) 2011 Red Hat, Inc.
 4 *
 5 * This file is released under the GPL.
 6 */
 7
 8#ifndef DM_SPACE_MAP_METADATA_H
 9#define DM_SPACE_MAP_METADATA_H
10
11#include "dm-transaction-manager.h"
12
13#define DM_SM_METADATA_BLOCK_SIZE (4096 >> SECTOR_SHIFT)
14
15/*
16 * The metadata device is currently limited in size.
17 *
18 * We have one block of index, which can hold 255 index entries.  Each
19 * index entry contains allocation info about ~16k metadata blocks.
20 */
21#define DM_SM_METADATA_MAX_BLOCKS (255 * ((1 << 14) - 64))
22#define DM_SM_METADATA_MAX_SECTORS (DM_SM_METADATA_MAX_BLOCKS * DM_SM_METADATA_BLOCK_SIZE)
23
24/*
25 * Unfortunately we have to use two-phase construction due to the cycle
26 * between the tm and sm.
27 */
28struct dm_space_map *dm_sm_metadata_init(void);
29
30/*
31 * Create a fresh space map.
32 */
33int dm_sm_metadata_create(struct dm_space_map *sm,
34			  struct dm_transaction_manager *tm,
35			  dm_block_t nr_blocks,
36			  dm_block_t superblock);
37
38/*
39 * Open from a previously-recorded root.
40 */
41int dm_sm_metadata_open(struct dm_space_map *sm,
42			struct dm_transaction_manager *tm,
43			void *root_le, size_t len);
44
45#endif	/* DM_SPACE_MAP_METADATA_H */
v4.17
 
 1/*
 2 * Copyright (C) 2011 Red Hat, Inc.
 3 *
 4 * This file is released under the GPL.
 5 */
 6
 7#ifndef DM_SPACE_MAP_METADATA_H
 8#define DM_SPACE_MAP_METADATA_H
 9
10#include "dm-transaction-manager.h"
11
12#define DM_SM_METADATA_BLOCK_SIZE (4096 >> SECTOR_SHIFT)
13
14/*
15 * The metadata device is currently limited in size.
16 *
17 * We have one block of index, which can hold 255 index entries.  Each
18 * index entry contains allocation info about ~16k metadata blocks.
19 */
20#define DM_SM_METADATA_MAX_BLOCKS (255 * ((1 << 14) - 64))
21#define DM_SM_METADATA_MAX_SECTORS (DM_SM_METADATA_MAX_BLOCKS * DM_SM_METADATA_BLOCK_SIZE)
22
23/*
24 * Unfortunately we have to use two-phase construction due to the cycle
25 * between the tm and sm.
26 */
27struct dm_space_map *dm_sm_metadata_init(void);
28
29/*
30 * Create a fresh space map.
31 */
32int dm_sm_metadata_create(struct dm_space_map *sm,
33			  struct dm_transaction_manager *tm,
34			  dm_block_t nr_blocks,
35			  dm_block_t superblock);
36
37/*
38 * Open from a previously-recorded root.
39 */
40int dm_sm_metadata_open(struct dm_space_map *sm,
41			struct dm_transaction_manager *tm,
42			void *root_le, size_t len);
43
44#endif	/* DM_SPACE_MAP_METADATA_H */