--- drivers/md/dm-integrity.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) Index: linux-2.6/drivers/md/dm-integrity.c =================================================================== --- linux-2.6.orig/drivers/md/dm-integrity.c 2019-04-18 16:11:05.000000000 +0200 +++ linux-2.6/drivers/md/dm-integrity.c 2019-04-18 19:27:30.000000000 +0200 @@ -2332,7 +2332,7 @@ static void integrity_recalc(struct work int r; unsigned super_counter = 0; - printk("start recalculation... (position %llx)\n", le64_to_cpu(ic->sb->recalc_sector)); + DEBUG_print("start recalculation... (position %llx)\n", le64_to_cpu(ic->sb->recalc_sector)); spin_lock_irq(&ic->endio_wait.lock); @@ -2344,7 +2344,7 @@ next_chunk: range.logical_sector = le64_to_cpu(ic->sb->recalc_sector); if (unlikely(range.logical_sector >= ic->provided_data_sectors)) { if (ic->mode == 'B') { - printk("queue_delayed_work: bitmap_flush_work\n"); + DEBUG_print("queue_delayed_work: bitmap_flush_work\n"); queue_delayed_work(ic->commit_wq, &ic->bitmap_flush_work, 1); } goto unlock_ret; @@ -2376,7 +2376,7 @@ next_chunk: get_area_and_offset(ic, logical_sector, &area, &offset); } - printk("recalculating: %lx, %lx\n", logical_sector, n_sectors); + DEBUG_print("recalculating: %lx, %lx\n", logical_sector, n_sectors); if (unlikely(++super_counter == RECALC_WRITE_SUPER)) { recalc_write_super(ic); @@ -2505,7 +2505,7 @@ static void bitmap_flush_work(struct wor >> (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit) << (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit); } - printk("zeroing journal\n"); + DEBUG_print("zeroing journal\n"); block_bitmap_op(ic, ic->journal, 0, limit, BITMAP_OP_CLEAR); block_bitmap_op(ic, ic->may_write_bitmap, 0, limit, BITMAP_OP_CLEAR); @@ -2738,7 +2738,7 @@ static void dm_integrity_postsuspend(str if (ic->mode == 'B') { dm_integrity_flush_buffers(ic); /* !!! FIXME: enable this */ -#if 0 +#if 1 init_journal(ic, 0, ic->journal_sections, 0); ic->sb->flags &= ~cpu_to_le32(SB_FLAG_DIRTY_BITMAP); r = sync_rw_sb(ic, REQ_OP_WRITE, REQ_FUA); @@ -2758,7 +2758,7 @@ static void dm_integrity_resume(struct d { struct dm_integrity_c *ic = (struct dm_integrity_c *)ti->private; int r; - printk("resume\n"); + DEBUG_print("resume\n"); if (ic->mode == 'B') { block_bitmap_op(ic, ic->recalc_bitmap, 0, ic->provided_data_sectors, BITMAP_OP_CLEAR); @@ -2766,7 +2766,7 @@ static void dm_integrity_resume(struct d } if (ic->sb->flags & cpu_to_le32(SB_FLAG_DIRTY_BITMAP)) { - printk("resume dirty_bitmap\n"); + DEBUG_print("resume dirty_bitmap\n"); ic->sb->flags |= cpu_to_le32(SB_FLAG_RECALCULATING); ic->sb->recalc_sector = cpu_to_le64(0); if (ic->mode == 'B') { @@ -2776,7 +2776,7 @@ static void dm_integrity_resume(struct d block_bitmap_copy(ic, ic->recalc_bitmap, ic->journal); block_bitmap_copy(ic, ic->may_write_bitmap, ic->journal); } else { - printk("non-matching blocks_per_bitmap_bit: %u, %u\n", ic->sb->log2_blocks_per_bitmap_bit, ic->log2_blocks_per_bitmap_bit); + DEBUG_print("non-matching blocks_per_bitmap_bit: %u, %u\n", ic->sb->log2_blocks_per_bitmap_bit, ic->log2_blocks_per_bitmap_bit); ic->sb->log2_blocks_per_bitmap_bit = ic->log2_blocks_per_bitmap_bit; block_bitmap_op(ic, ic->recalc_bitmap, 0, ic->provided_data_sectors, BITMAP_OP_SET); block_bitmap_op(ic, ic->may_write_bitmap, 0, ic->provided_data_sectors, BITMAP_OP_SET); @@ -2803,10 +2803,10 @@ static void dm_integrity_resume(struct d } } - printk("testing recalc: %x %x", ic->sb->flags, ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING)); + DEBUG_print("testing recalc: %x %x", ic->sb->flags, ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING)); if (ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING)) { __u64 recalc_pos = le64_to_cpu(ic->sb->recalc_sector); - printk("recalc pos: %lx / %lx\n", (long)recalc_pos, ic->provided_data_sectors); + DEBUG_print("recalc pos: %lx / %lx\n", (long)recalc_pos, ic->provided_data_sectors); if (recalc_pos < ic->provided_data_sectors) { queue_work(ic->recalc_wq, &ic->recalc_work); } else if (recalc_pos > ic->provided_data_sectors) { @@ -2869,7 +2869,7 @@ static void dm_integrity_status(struct d DMEMIT(" commit_time:%u", ic->autocommit_msec); } if (ic->mode == 'B') { - DMEMIT(" blocks_per_bit:%llu", 1ULL << ic->log2_blocks_per_bitmap_bit); + DMEMIT(" sectors_per_bit:%llu", (unsigned long long)ic->sectors_per_block << ic->log2_blocks_per_bitmap_bit); DMEMIT(" bitmap_flush_interval:%u", jiffies_to_msecs(ic->bitmap_flush_interval)); } @@ -3980,7 +3980,10 @@ try_smaller_buffer: } if (ic->mode == 'B') { unsigned max_io_len = ((sector_t)ic->sectors_per_block << ic->log2_blocks_per_bitmap_bit) * (BITMAP_BLOCK_SIZE * 8); - if (ti->max_io_len < max_io_len) { + if (!max_io_len) + max_io_len = 1U << 31; + DEBUG_print("max_io_len: old %u, new %u\n", ti->max_io_len, max_io_len); + if (!ti->max_io_len || ti->max_io_len > max_io_len) { r = dm_set_target_max_io_len(ti, max_io_len); if (r) goto bad;