Re: [PATCH v14 05/21] fsverity: improve flushing performance of fsverity_fill_zerohash

Christoph Hellwig <[email protected]> Tue, 4 Aug 2026 19:42:23 +0200
Newsgroups gmane.linux.file-systems.f2fs,gmane.linux.file-systems,gmane.comp.file-systems.ext4,gmane.comp.file-systems.btrfs
Message-ID <[email protected]>
On Mon, Aug 03, 2026 at 10:07:55PM +0200, Andrey Albershteyn wrote:
> The current version calls flush_dcache_folio(), in memcpy_to_folio(), to
> flush whole folio on every digest (which is 128 for 4k) on the HIGHMEM
> systems. Open code folio mapping and flushing to copy all digests at
> once.

This looks correct, although to me optimizing for this feels like
premature optimizations not worth the ugly code unless we have numbers
to justify it.

If Eric wants it:

Reviewed-by: Christoph Hellwig <[email protected]>

> +		if (folio_test_partial_kmap(folio) &&
> +		    off > PAGE_SIZE - offset_in_page(offset))
> +			off = PAGE_SIZE - offset_in_page(offset);
> +		for (; to < (vaddr + off); to += vi->tree_params.digest_size)

Style nitpick: no need for braces when comparing with simple
integer arithmetics like this.

> +	for (off = offset; off < (offset + len);

Same here.