Re: [PATCH 1/3] block: bio-integrity: add PI iovec to bio

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

 



On Thu, Oct 28, 2021 at 02:24:04PM +0300, Alexander V. Buev wrote:
>   * Written by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
>   */
> -
>  #include <linux/blkdev.h>

Spurious whitespace change.

> +void bio_integrity_payload_release_pages(struct bio_integrity_payload *bip)
> +{
> +	unsigned short i;
> +	struct bio_vec *bv;
> +
> +	for (i = 0; i < bip->bip_vcnt; ++i) {
> +		bv = bip->bip_vec + i;
> +		put_page(bv->bv_page);
> +	}

The bv declaration can move into the loop (or we can just nuke the
single use local variable entirely).

> +	nr_vec_page = (pi_iov->iov_len + PAGE_SIZE - 1) >> PAGE_SHIFT;
> +	nr_vec_page += 1; // we need this die to data of size N pages can be pinned to N+1 page

Pleae avoid overly long line and //-style comments.

> +	size = iov_iter_get_pages(&pi_iter, pi_page, LONG_MAX, nr_vec_page, &offset);
> +	if (unlikely(size < 0)) {
> +		pr_err("Failed to pin PI buffer to page");
> +		ret = -EFAULT;
> +		goto exit;
> +	}

Instead of the local page this should use the same scheme as
__bio_iov_iter_get_pages.

> +
> +	// calc count of pined pages
> +	if (size > (PAGE_SIZE-offset)) {
> +		size = DIV_ROUND_UP(size - (PAGE_SIZE-offset), PAGE_SIZE)+1;
> +	} else

No need for braces around single line statements, please always
put whitespaces around your operators.

> +EXPORT_SYMBOL(bio_integrity_add_pi_iovec);

EXPORT_SYMBOL_GPL, please.



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux