| 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 GPL. | 7 * This file is released under the GPL. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 #include <asm/atomic.h> | 10 #include <asm/atomic.h> |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 * The number of updated entries is NOT tracked. | 760 * The number of updated entries is NOT tracked. |
| 761 */ | 761 */ |
| 762 if (state == DM_BHT_ENTRY_UNALLOCATED) { | 762 if (state == DM_BHT_ENTRY_UNALLOCATED) { |
| 763 node_page = (struct page *) mempool_alloc(bht->entry_pool, | 763 node_page = (struct page *) mempool_alloc(bht->entry_pool, |
| 764 GFP_KERNEL); | 764 GFP_KERNEL); |
| 765 if (!node_page) { | 765 if (!node_page) { |
| 766 atomic_set(&entry->state, DM_BHT_ENTRY_ERROR); | 766 atomic_set(&entry->state, DM_BHT_ENTRY_ERROR); |
| 767 return -ENOMEM; | 767 return -ENOMEM; |
| 768 } | 768 } |
| 769 entry->nodes = page_address(node_page); | 769 entry->nodes = page_address(node_page); |
| 770 memset(entry->nodes, 0, PAGE_SIZE); |
| 770 /* TODO(wad) could expose this to the caller to that they | 771 /* TODO(wad) could expose this to the caller to that they |
| 771 * can transition from unallocated to ready manually. | 772 * can transition from unallocated to ready manually. |
| 772 */ | 773 */ |
| 773 atomic_set(&entry->state, DM_BHT_ENTRY_READY); | 774 atomic_set(&entry->state, DM_BHT_ENTRY_READY); |
| 774 } else if (state <= DM_BHT_ENTRY_ERROR) { | 775 } else if (state <= DM_BHT_ENTRY_ERROR) { |
| 775 DMCRIT("leaf entry for block %u is invalid", | 776 DMCRIT("leaf entry for block %u is invalid", |
| 776 block_index); | 777 block_index); |
| 777 return state; | 778 return state; |
| 778 } else if (state == DM_BHT_ENTRY_PENDING) { | 779 } else if (state == DM_BHT_ENTRY_PENDING) { |
| 779 DMERR("leaf data is pending for block %u", block_index); | 780 DMERR("leaf data is pending for block %u", block_index); |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1191 DMERR("no root digest exists to export"); | 1192 DMERR("no root digest exists to export"); |
| 1192 if (available > 0) | 1193 if (available > 0) |
| 1193 *hexdigest = 0; | 1194 *hexdigest = 0; |
| 1194 return -1; | 1195 return -1; |
| 1195 } | 1196 } |
| 1196 dm_bht_bin_to_hex(bht->root_digest, hexdigest, bht->digest_size); | 1197 dm_bht_bin_to_hex(bht->root_digest, hexdigest, bht->digest_size); |
| 1197 return 0; | 1198 return 0; |
| 1198 } | 1199 } |
| 1199 EXPORT_SYMBOL(dm_bht_root_hexdigest); | 1200 EXPORT_SYMBOL(dm_bht_root_hexdigest); |
| 1200 | 1201 |
| OLD | NEW |