aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-verity.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2013-04-02 04:04:39 -0400
committerJens Axboe <axboe@kernel.dk>2013-04-02 04:04:39 -0400
commit64f8de4da7d3962632f152d3d702d68bb8accc29 (patch)
treec90a872a6d91c824635d59572e1e578980f4bc98 /drivers/md/dm-verity.c
parentf1fb3449efd5c49b48e35746bc7283eb9c73e3a0 (diff)
parentb5c872ddb7083c7909fb76a170c3807e04564bb3 (diff)
Merge branch 'writeback-workqueue' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq into for-3.10/core
Tejun writes: ----- This is the pull request for the earlier patchset[1] with the same name. It's only three patches (the first one was committed to workqueue tree) but the merge strategy is a bit involved due to the dependencies. * Because the conversion needs features from wq/for-3.10, block/for-3.10/core is based on rc3, and wq/for-3.10 has conflicts with rc3, I pulled mainline (rc5) into wq/for-3.10 to prevent those workqueue conflicts from flaring up in block tree. * Resolving the issue that Jan and Dave raised about debugging requires arch-wide changes. The patchset is being worked on[2] but it'll have to go through -mm after these changes show up in -next, and not included in this pull request. The three commits are located in the following git branch. git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git writeback-workqueue Pulling it into block/for-3.10/core produces a conflict in drivers/md/raid5.c between the following two commits. e3620a3ad5 ("MD RAID5: Avoid accessing gendisk or queue structs when not available") 2f6db2a707 ("raid5: use bio_reset()") The conflict is trivial - one removes an "if ()" conditional while the other removes "rbi->bi_next = NULL" right above it. We just need to remove both. The merged branch is available at git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git block-test-merge so that you can use it for verification. The test merge commit has proper merge description. While these changes are a bit of pain to route, they make code simpler and even have, while minute, measureable performance gain[3] even on a workload which isn't particularly favorable to showing the benefits of this conversion. ---- Fixed up the conflict. Conflicts: drivers/md/raid5.c Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/md/dm-verity.c')
-rw-r--r--drivers/md/dm-verity.c39
1 files changed, 34 insertions, 5 deletions
diff --git a/drivers/md/dm-verity.c b/drivers/md/dm-verity.c
index 4f06d9adf1ed..b948fd864d45 100644
--- a/drivers/md/dm-verity.c
+++ b/drivers/md/dm-verity.c
@@ -93,6 +93,13 @@ struct dm_verity_io {
93 */ 93 */
94}; 94};
95 95
96struct dm_verity_prefetch_work {
97 struct work_struct work;
98 struct dm_verity *v;
99 sector_t block;
100 unsigned n_blocks;
101};
102
96static struct shash_desc *io_hash_desc(struct dm_verity *v, struct dm_verity_io *io) 103static struct shash_desc *io_hash_desc(struct dm_verity *v, struct dm_verity_io *io)
97{ 104{
98 return (struct shash_desc *)(io + 1); 105 return (struct shash_desc *)(io + 1);
@@ -424,15 +431,18 @@ static void verity_end_io(struct bio *bio, int error)
424 * The root buffer is not prefetched, it is assumed that it will be cached 431 * The root buffer is not prefetched, it is assumed that it will be cached
425 * all the time. 432 * all the time.
426 */ 433 */
427static void verity_prefetch_io(struct dm_verity *v, struct dm_verity_io *io) 434static void verity_prefetch_io(struct work_struct *work)
428{ 435{
436 struct dm_verity_prefetch_work *pw =
437 container_of(work, struct dm_verity_prefetch_work, work);
438 struct dm_verity *v = pw->v;
429 int i; 439 int i;
430 440
431 for (i = v->levels - 2; i >= 0; i--) { 441 for (i = v->levels - 2; i >= 0; i--) {
432 sector_t hash_block_start; 442 sector_t hash_block_start;
433 sector_t hash_block_end; 443 sector_t hash_block_end;
434 verity_hash_at_level(v, io->block, i, &hash_block_start, NULL); 444 verity_hash_at_level(v, pw->block, i, &hash_block_start, NULL);
435 verity_hash_at_level(v, io->block + io->n_blocks - 1, i, &hash_block_end, NULL); 445 verity_hash_at_level(v, pw->block + pw->n_blocks - 1, i, &hash_block_end, NULL);
436 if (!i) { 446 if (!i) {
437 unsigned cluster = ACCESS_ONCE(dm_verity_prefetch_cluster); 447 unsigned cluster = ACCESS_ONCE(dm_verity_prefetch_cluster);
438 448
@@ -452,6 +462,25 @@ no_prefetch_cluster:
452 dm_bufio_prefetch(v->bufio, hash_block_start, 462 dm_bufio_prefetch(v->bufio, hash_block_start,
453 hash_block_end - hash_block_start + 1); 463 hash_block_end - hash_block_start + 1);
454 } 464 }
465
466 kfree(pw);
467}
468
469static void verity_submit_prefetch(struct dm_verity *v, struct dm_verity_io *io)
470{
471 struct dm_verity_prefetch_work *pw;
472
473 pw = kmalloc(sizeof(struct dm_verity_prefetch_work),
474 GFP_NOIO | __GFP_NORETRY | __GFP_NOMEMALLOC | __GFP_NOWARN);
475
476 if (!pw)
477 return;
478
479 INIT_WORK(&pw->work, verity_prefetch_io);
480 pw->v = v;
481 pw->block = io->block;
482 pw->n_blocks = io->n_blocks;
483 queue_work(v->verify_wq, &pw->work);
455} 484}
456 485
457/* 486/*
@@ -498,7 +527,7 @@ static int verity_map(struct dm_target *ti, struct bio *bio)
498 memcpy(io->io_vec, bio_iovec(bio), 527 memcpy(io->io_vec, bio_iovec(bio),
499 io->io_vec_size * sizeof(struct bio_vec)); 528 io->io_vec_size * sizeof(struct bio_vec));
500 529
501 verity_prefetch_io(v, io); 530 verity_submit_prefetch(v, io);
502 531
503 generic_make_request(bio); 532 generic_make_request(bio);
504 533
@@ -858,7 +887,7 @@ bad:
858 887
859static struct target_type verity_target = { 888static struct target_type verity_target = {
860 .name = "verity", 889 .name = "verity",
861 .version = {1, 1, 1}, 890 .version = {1, 2, 0},
862 .module = THIS_MODULE, 891 .module = THIS_MODULE,
863 .ctr = verity_ctr, 892 .ctr = verity_ctr,
864 .dtr = verity_dtr, 893 .dtr = verity_dtr,