Re: [PATCH v4 08/25] fsverity: calculate readahead in bytes instead of pages

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

 



On Mon, Feb 12, 2024 at 05:58:05PM +0100, Andrey Albershteyn wrote:
> +		u64 block_offset;

'hblock_pos', to make it clear that it's in bytes, and that it's for the hash
block, not the data block.

> +		u64 ra_bytes = 0;
> +		u64 tree_size;
>  
>  		/*
>  		 * The index of the block in the current level; also the index
> @@ -105,18 +106,20 @@ verify_data_block(struct inode *inode, struct fsverity_info *vi,
>  		/* Index of the hash block in the tree overall */
>  		hblock_idx = params->level_start[level] + next_hidx;
>  
> -		/* Index of the hash page in the tree overall */
> -		hpage_idx = hblock_idx >> params->log_blocks_per_page;
> +		/* Offset of the Merkle tree block into the tree */
> +		block_offset = hblock_idx << params->log_blocksize;
>  
>  		/* Byte offset of the hash within the block */
>  		hoffset = (hidx << params->log_digestsize) &
>  			  (params->block_size - 1);
>  
> -		num_ra_pages = level == 0 ?
> -			min(max_ra_pages, params->tree_pages - hpage_idx) : 0;
> +		if (level == 0) {
> +			tree_size = params->tree_pages << PAGE_SHIFT;
> +			ra_bytes = min(max_ra_bytes, (tree_size - block_offset));
> +		}

How about:

		ra_bytes = level == 0 ?
			min(max_ra_bytes, params->tree_size - hblock_pos) : 0;

- Eric




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux