Commit 25058d1c authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Mike Snitzer

dm integrity: use bvec_kmap_local in __journal_read_write

Using local kmaps slightly reduces the chances to stray writes, and
the bvec interface cleans up the code a little bit.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent c12d205d
...@@ -1963,7 +1963,7 @@ static bool __journal_read_write(struct dm_integrity_io *dio, struct bio *bio, ...@@ -1963,7 +1963,7 @@ static bool __journal_read_write(struct dm_integrity_io *dio, struct bio *bio,
n_sectors -= bv.bv_len >> SECTOR_SHIFT; n_sectors -= bv.bv_len >> SECTOR_SHIFT;
bio_advance_iter(bio, &bio->bi_iter, bv.bv_len); bio_advance_iter(bio, &bio->bi_iter, bv.bv_len);
retry_kmap: retry_kmap:
mem = kmap_atomic(bv.bv_page); mem = bvec_kmap_local(&bv);
if (likely(dio->op == REQ_OP_WRITE)) if (likely(dio->op == REQ_OP_WRITE))
flush_dcache_page(bv.bv_page); flush_dcache_page(bv.bv_page);
...@@ -1977,7 +1977,7 @@ static bool __journal_read_write(struct dm_integrity_io *dio, struct bio *bio, ...@@ -1977,7 +1977,7 @@ static bool __journal_read_write(struct dm_integrity_io *dio, struct bio *bio,
if (unlikely(journal_entry_is_inprogress(je))) { if (unlikely(journal_entry_is_inprogress(je))) {
flush_dcache_page(bv.bv_page); flush_dcache_page(bv.bv_page);
kunmap_atomic(mem); kunmap_local(mem);
__io_wait_event(ic->copy_to_journal_wait, !journal_entry_is_inprogress(je)); __io_wait_event(ic->copy_to_journal_wait, !journal_entry_is_inprogress(je));
goto retry_kmap; goto retry_kmap;
...@@ -2070,7 +2070,7 @@ static bool __journal_read_write(struct dm_integrity_io *dio, struct bio *bio, ...@@ -2070,7 +2070,7 @@ static bool __journal_read_write(struct dm_integrity_io *dio, struct bio *bio,
if (unlikely(dio->op == REQ_OP_READ)) if (unlikely(dio->op == REQ_OP_READ))
flush_dcache_page(bv.bv_page); flush_dcache_page(bv.bv_page);
kunmap_atomic(mem); kunmap_local(mem);
} while (n_sectors); } while (n_sectors);
if (likely(dio->op == REQ_OP_WRITE)) { if (likely(dio->op == REQ_OP_WRITE)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment