OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 The Chromium OS Authors <chromium-os-dev@chromium.org> | 2 * Copyright (C) 2010 The Chromium OS Authors <chromium-os-dev@chromium.org> |
3 * | 3 * |
4 * Device-Mapper block hash tree interface. | 4 * Device-Mapper block hash tree interface. |
5 * See Documentation/device-mapper/dm-bht.txt for details. | 5 * See Documentation/device-mapper/dm-bht.txt for details. |
6 * | 6 * |
7 * This file is released under the GPLv2. | 7 * This file is released under the GPLv2. |
8 */ | 8 */ |
9 #ifndef __LINUX_DM_BHT_H | 9 #ifndef __LINUX_DM_BHT_H |
10 #define __LINUX_DM_BHT_H | 10 #define __LINUX_DM_BHT_H |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 /* Computed values */ | 93 /* Computed values */ |
94 unsigned int node_count; /* Data size (in hashes) for each entry */ | 94 unsigned int node_count; /* Data size (in hashes) for each entry */ |
95 unsigned int node_count_shift; /* first bit set - 1 */ | 95 unsigned int node_count_shift; /* first bit set - 1 */ |
96 /* There is one per CPU so that verified can be simultaneous. */ | 96 /* There is one per CPU so that verified can be simultaneous. */ |
97 struct hash_desc *hash_desc; /* Container for the hash alg */ | 97 struct hash_desc *hash_desc; /* Container for the hash alg */ |
98 unsigned int digest_size; | 98 unsigned int digest_size; |
99 sector_t sectors; /* Number of disk sectors used */ | 99 sector_t sectors; /* Number of disk sectors used */ |
100 | 100 |
101 /* bool verified; Full tree is verified */ | 101 /* bool verified; Full tree is verified */ |
102 u8 *root_digest; /* hash_alg(levels[0].entries[*].nodes) */ | 102 u8 *root_digest; /* hash_alg(levels[0].entries[*].nodes) */ |
103 atomic_t root_state; /* Uses UNALLOCATED, REQUESTED, and VERIFIED */ | |
104 struct dm_bht_level *levels; /* in reverse order */ | 103 struct dm_bht_level *levels; /* in reverse order */ |
105 mempool_t *entry_pool; | 104 mempool_t *entry_pool; |
106 /* Callbacks for reading and/or writing to the hash device */ | 105 /* Callbacks for reading and/or writing to the hash device */ |
107 dm_bht_callback read_cb; | 106 dm_bht_callback read_cb; |
108 dm_bht_callback write_cb; | 107 dm_bht_callback write_cb; |
109 }; | 108 }; |
110 | 109 |
111 /* Constructor for struct dm_bht instances. */ | 110 /* Constructor for struct dm_bht instances. */ |
112 int dm_bht_create(struct dm_bht *bht, | 111 int dm_bht_create(struct dm_bht *bht, |
113 unsigned int block_count, | 112 unsigned int block_count, |
(...skipping 21 matching lines...) Expand all Loading... |
135 */ | 134 */ |
136 int dm_bht_compute(struct dm_bht *bht, void *read_cb_ctx); | 135 int dm_bht_compute(struct dm_bht *bht, void *read_cb_ctx); |
137 int dm_bht_sync(struct dm_bht *bht, void *write_cb_ctx); | 136 int dm_bht_sync(struct dm_bht *bht, void *write_cb_ctx); |
138 int dm_bht_store_block(struct dm_bht *bht, unsigned int block_index, | 137 int dm_bht_store_block(struct dm_bht *bht, unsigned int block_index, |
139 u8 *block_data); | 138 u8 *block_data); |
140 int dm_bht_zeroread_callback(void *ctx, sector_t start, u8 *dst, sector_t count, | 139 int dm_bht_zeroread_callback(void *ctx, sector_t start, u8 *dst, sector_t count, |
141 struct dm_bht_entry *entry); | 140 struct dm_bht_entry *entry); |
142 void dm_bht_read_completed(struct dm_bht_entry *entry, int status); | 141 void dm_bht_read_completed(struct dm_bht_entry *entry, int status); |
143 void dm_bht_write_completed(struct dm_bht_entry *entry, int status); | 142 void dm_bht_write_completed(struct dm_bht_entry *entry, int status); |
144 #endif /* __LINUX_DM_BHT_H */ | 143 #endif /* __LINUX_DM_BHT_H */ |
OLD | NEW |