Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 518748b1 authored by Mikulas Patocka's avatar Mikulas Patocka Committed by Mike Snitzer
Browse files

dm integrity: decouple common code in dm_integrity_map_continue()



Decouple how dm_integrity_map_continue() responds to being out of free
sectors and when add_new_range() fails.

This has no functional change, but helps prepare for the next commit.

Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent c21b1639
Loading
Loading
Loading
Loading
+7 −3
Original line number Original line Diff line number Diff line
@@ -1599,8 +1599,12 @@ static void dm_integrity_map_continue(struct dm_integrity_io *dio, bool from_map


			dio->range.n_sectors = min(dio->range.n_sectors,
			dio->range.n_sectors = min(dio->range.n_sectors,
						   ic->free_sectors << ic->sb->log2_sectors_per_block);
						   ic->free_sectors << ic->sb->log2_sectors_per_block);
			if (unlikely(!dio->range.n_sectors))
			if (unlikely(!dio->range.n_sectors)) {
				goto sleep;
				if (from_map)
					goto offload_to_thread;
				sleep_on_endio_wait(ic);
				goto retry;
			}
			range_sectors = dio->range.n_sectors >> ic->sb->log2_sectors_per_block;
			range_sectors = dio->range.n_sectors >> ic->sb->log2_sectors_per_block;
			ic->free_sectors -= range_sectors;
			ic->free_sectors -= range_sectors;
			journal_section = ic->free_section;
			journal_section = ic->free_section;
@@ -1660,8 +1664,8 @@ static void dm_integrity_map_continue(struct dm_integrity_io *dio, bool from_map
		 * stall bios on current->bio_list.
		 * stall bios on current->bio_list.
		 * So, we offload the bio to a workqueue if we have to sleep.
		 * So, we offload the bio to a workqueue if we have to sleep.
		 */
		 */
sleep:
		if (from_map) {
		if (from_map) {
offload_to_thread:
			spin_unlock_irq(&ic->endio_wait.lock);
			spin_unlock_irq(&ic->endio_wait.lock);
			INIT_WORK(&dio->work, integrity_bio_wait);
			INIT_WORK(&dio->work, integrity_bio_wait);
			queue_work(ic->wait_wq, &dio->work);
			queue_work(ic->wait_wq, &dio->work);