Re: [PATCHv3 2/4] block: __blkdev_issue_write_zeroes cleanup

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

 



On Thu, Feb 22, 2024 at 11:19:20AM -0800, Keith Busch wrote:
> From: Keith Busch <kbusch@xxxxxxxxxx>
> 
> Use min to calculate the next number of sectors like everyone else.
> 
> Signed-off-by: Keith Busch <kbusch@xxxxxxxxxx>
> ---
>  block/blk-lib.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/block/blk-lib.c b/block/blk-lib.c
> index 91770da2239f2..d4c476cf3784a 100644
> --- a/block/blk-lib.c
> +++ b/block/blk-lib.c
> @@ -132,19 +132,16 @@ static int __blkdev_issue_write_zeroes(struct block_device *bdev,
>  		return -EOPNOTSUPP;
>  
>  	while (nr_sects) {
> +		unsigned int len = min_t(sector_t, nr_sects, max_write_zeroes_sectors);

Please avoid the overly long line.

> +		bio->bi_iter.bi_size = len << 9;

And if you touch this anyway use SECTOR_SHIFT here.

Otherwise this looks good.





[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