Skip to content

Commit c19525b

Browse files
mbrozMikulas Patocka
authored andcommitted
dm-integrity: Do not emit journal configuration in DM table for Inline mode
The Inline mode does not use a journal; it makes no sense to print journal information in DM table. Print it only if the journal is used. The same applies to interleave_sectors (unused for Inline mode). Also, add comments for arg_count, as the current calculation is quite obscure. Signed-off-by: Milan Broz <gmazyland@gmail.com> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
1 parent 7fb3988 commit c19525b

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

drivers/md/dm-integrity.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3790,16 +3790,18 @@ static void dm_integrity_status(struct dm_target *ti, status_type_t type,
37903790
break;
37913791

37923792
case STATUSTYPE_TABLE: {
3793-
arg_count = 3;
3793+
arg_count = 1; /* buffer_sectors */
37943794
arg_count += !!ic->meta_dev;
37953795
arg_count += ic->sectors_per_block != 1;
37963796
arg_count += !!(ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING));
37973797
arg_count += ic->reset_recalculate_flag;
37983798
arg_count += ic->discard;
3799-
arg_count += ic->mode == 'J';
3800-
arg_count += ic->mode == 'J';
3801-
arg_count += ic->mode == 'B';
3802-
arg_count += ic->mode == 'B';
3799+
arg_count += ic->mode != 'I'; /* interleave_sectors */
3800+
arg_count += ic->mode == 'J'; /* journal_sectors */
3801+
arg_count += ic->mode == 'J'; /* journal_watermark */
3802+
arg_count += ic->mode == 'J'; /* commit_time */
3803+
arg_count += ic->mode == 'B'; /* sectors_per_bit */
3804+
arg_count += ic->mode == 'B'; /* bitmap_flush_interval */
38033805
arg_count += !!ic->internal_hash_alg.alg_string;
38043806
arg_count += !!ic->journal_crypt_alg.alg_string;
38053807
arg_count += !!ic->journal_mac_alg.alg_string;
@@ -3818,14 +3820,15 @@ static void dm_integrity_status(struct dm_target *ti, status_type_t type,
38183820
DMEMIT(" reset_recalculate");
38193821
if (ic->discard)
38203822
DMEMIT(" allow_discards");
3821-
DMEMIT(" journal_sectors:%u", ic->initial_sectors - SB_SECTORS);
3822-
DMEMIT(" interleave_sectors:%u", 1U << ic->sb->log2_interleave_sectors);
3823+
if (ic->mode != 'I')
3824+
DMEMIT(" interleave_sectors:%u", 1U << ic->sb->log2_interleave_sectors);
38233825
DMEMIT(" buffer_sectors:%u", 1U << ic->log2_buffer_sectors);
38243826
if (ic->mode == 'J') {
38253827
__u64 watermark_percentage = (__u64)(ic->journal_entries - ic->free_sectors_threshold) * 100;
38263828

38273829
watermark_percentage += ic->journal_entries / 2;
38283830
do_div(watermark_percentage, ic->journal_entries);
3831+
DMEMIT(" journal_sectors:%u", ic->initial_sectors - SB_SECTORS);
38293832
DMEMIT(" journal_watermark:%u", (unsigned int)watermark_percentage);
38303833
DMEMIT(" commit_time:%u", ic->autocommit_msec);
38313834
}

0 commit comments

Comments
 (0)