Re: [PATCH 2/2] dm-verity: prefetch all hash blocks in verity_ctr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Wed, 2 Apr 2025, LongPing Wei wrote:

> At this time, all bios for hash blocks should eventually
> be merged into a single large bio.
> 
> Signed-off-by: LongPing Wei <weilongping@xxxxxxxx>
> ---
>  drivers/md/dm-verity-target.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
> index 3c427f18a04b..813d5cfc7ffa 100644
> --- a/drivers/md/dm-verity-target.c
> +++ b/drivers/md/dm-verity-target.c
> @@ -1683,6 +1683,10 @@ static int verity_ctr(struct dm_target *ti, unsigned int argc, char **argv)
>  
>  	verity_verify_sig_opts_cleanup(&verify_args);
>  
> +	dm_bufio_prefetch_with_ioprio(v->bufio, v->hash_start,
> +		v->hash_blocks - v->hash_start,
> +		IOPRIO_PRIO_VALUE(IOPRIO_CLASS_RT, 0));
> +
>  	dm_audit_log_ctr(DM_MSG_PREFIX, ti, 1);
>  
>  	return 0;
> -- 
> 2.34.1

Hi

I would move it into the "resume" callback, so that if the user 
reconfigures the device stack between "ctr" and "resume", it won't read 
the data too early.

Don't use IOPRIO_CLASS_RT, this is not real-time requirement, 
IOPRIO_CLASS_RT would slow down concurrent I/O.

Another problem with this approach is that when the verity device is big 
and system memory is small, it just causes I/O churn - new bufio blocks 
will be displacing old blocks - and it will degrade performance, not 
improve it.

Please, describe some scenario, where this prefetch actually helps. What 
is the size of the metadata that you are prefetching? What is the total 
memory size? Is there any benchmark that shows the advantage of this 
patch?

Mikulas





[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux