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

Unified 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, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dm-bht.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm-bht.c
diff --git a/dm-bht.c b/dm-bht.c
index 83c9b8c09c51a7a53933ade6c404e516d03cb743..5078b274eac2c0dd9bf8f943d2a17828485cb5ba 100644
--- a/dm-bht.c
+++ b/dm-bht.c
@@ -920,6 +920,33 @@ int dm_bht_sync(struct dm_bht *bht, void *write_cb_ctx)
EXPORT_SYMBOL(dm_bht_sync);
/**
+ * dm_bht_is_populated - check that entries from disk needed to verify a given
+ * block are all ready
+ * @bht: pointer to a dm_bht_create()d bht
+ * @block_index:specific block data is expected from
+ *
+ * Callers may wish to call dm_bht_is_populated() when checking an io
+ * for which entries were already pending.
+ */
+bool dm_bht_is_populated(struct dm_bht *bht, unsigned int block_index)
+{
+ unsigned int depth;
+
+ if (atomic_read(&bht->root_state) < DM_BHT_ENTRY_READY)
+ return false;
+
+ for (depth = bht->depth - 1; depth > 0; depth--) {
+ struct dm_bht_entry *entry = dm_bht_get_entry(bht, depth,
+ block_index);
+ if (atomic_read(&entry->state) < DM_BHT_ENTRY_READY)
+ return false;
+ }
+
+ return true;
+}
+EXPORT_SYMBOL(dm_bht_is_populated);
+
+/**
* dm_bht_populate - reads entries from disk needed to verify a given block
* @bht: pointer to a dm_bht_create()d bht
* @read_cb_ctx:context used for all read_cb calls on this request
« 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