Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Side by Side Diff: dm-bht.c

Issue 6675057: verity: only requeue if necessary (Closed) Base URL: http://git.chromium.org/git/dm-verity.git@master
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « dm-bht.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 } 913 }
914 sector += to_sector(PAGE_SIZE); 914 sector += to_sector(PAGE_SIZE);
915 } 915 }
916 } 916 }
917 917
918 return 0; 918 return 0;
919 } 919 }
920 EXPORT_SYMBOL(dm_bht_sync); 920 EXPORT_SYMBOL(dm_bht_sync);
921 921
922 /** 922 /**
923 * dm_bht_is_populated - check that entries from disk needed to verify a given
924 * block are all ready
925 * @bht: pointer to a dm_bht_create()d bht
926 * @block_index:specific block data is expected from
927 *
928 * Callers may wish to call dm_bht_is_populated() when checking an io
929 * for which entries were already pending.
930 */
931 bool dm_bht_is_populated(struct dm_bht *bht, unsigned int block_index)
932 {
933 unsigned int depth;
934
935 if (atomic_read(&bht->root_state) < DM_BHT_ENTRY_READY)
936 return false;
937
938 for (depth = bht->depth - 1; depth > 0; depth--) {
939 struct dm_bht_entry *entry = dm_bht_get_entry(bht, depth,
940 block_index);
941 if (atomic_read(&entry->state) < DM_BHT_ENTRY_READY)
942 return false;
943 }
944
945 return true;
946 }
947 EXPORT_SYMBOL(dm_bht_is_populated);
948
949 /**
923 * dm_bht_populate - reads entries from disk needed to verify a given block 950 * dm_bht_populate - reads entries from disk needed to verify a given block
924 * @bht: pointer to a dm_bht_create()d bht 951 * @bht: pointer to a dm_bht_create()d bht
925 * @read_cb_ctx:context used for all read_cb calls on this request 952 * @read_cb_ctx:context used for all read_cb calls on this request
926 * @block_index:specific block data is expected from 953 * @block_index:specific block data is expected from
927 * 954 *
928 * Callers may wish to call dm_bht_populate(0) immediately after initialization 955 * Callers may wish to call dm_bht_populate(0) immediately after initialization
929 * to start loading in all the level[0] entries. 956 * to start loading in all the level[0] entries.
930 */ 957 */
931 int dm_bht_populate(struct dm_bht *bht, void *read_cb_ctx, 958 int dm_bht_populate(struct dm_bht *bht, void *read_cb_ctx,
932 unsigned int block_index) 959 unsigned int block_index)
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 DMERR("no root digest exists to export"); 1219 DMERR("no root digest exists to export");
1193 if (available > 0) 1220 if (available > 0)
1194 *hexdigest = 0; 1221 *hexdigest = 0;
1195 return -1; 1222 return -1;
1196 } 1223 }
1197 dm_bht_bin_to_hex(bht->root_digest, hexdigest, bht->digest_size); 1224 dm_bht_bin_to_hex(bht->root_digest, hexdigest, bht->digest_size);
1198 return 0; 1225 return 0;
1199 } 1226 }
1200 EXPORT_SYMBOL(dm_bht_root_hexdigest); 1227 EXPORT_SYMBOL(dm_bht_root_hexdigest);
1201 1228
OLDNEW
« no previous file with comments | « dm-bht.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698