Re: [PATCH 01/16] zram: remove valid_io_request

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

 



On Thu, Apr 06, 2023 at 04:40:47PM +0200, Christoph Hellwig wrote:
> All bios hande to drivers from the block layer are checked against the
> device size and for logical block alignment already (and have been since
> long before zram was merged), so don't duplicate those checks.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> Reviewed-by: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>
> ---
>  drivers/block/zram/zram_drv.c | 34 +---------------------------------
>  drivers/block/zram/zram_drv.h |  1 -
>  2 files changed, 1 insertion(+), 34 deletions(-)
> 
> diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
> index aa490da3cef233..0c6b3ba2970b5f 100644
> --- a/drivers/block/zram/zram_drv.c
> +++ b/drivers/block/zram/zram_drv.c
> @@ -174,30 +174,6 @@ static inline u32 zram_get_priority(struct zram *zram, u32 index)
>  	return prio & ZRAM_COMP_PRIORITY_MASK;
>  }
>  
> -/*
> - * Check if request is within bounds and aligned on zram logical blocks.
> - */
> -static inline bool valid_io_request(struct zram *zram,
> -		sector_t start, unsigned int size)
> -{
> -	u64 end, bound;
> -
> -	/* unaligned request */
> -	if (unlikely(start & (ZRAM_SECTOR_PER_LOGICAL_BLOCK - 1)))
> -		return false;
> -	if (unlikely(size & (ZRAM_LOGICAL_BLOCK_SIZE - 1)))
> -		return false;
> -
> -	end = start + (size >> SECTOR_SHIFT);
> -	bound = zram->disksize >> SECTOR_SHIFT;
> -	/* out of range */
> -	if (unlikely(start >= bound || end > bound || start > end))
> -		return false;
> -
> -	/* I/O request is valid */
> -	return true;
> -}
> -
>  static void update_position(u32 *index, int *offset, struct bio_vec *bvec)
>  {
>  	*index  += (*offset + bvec->bv_len) / PAGE_SIZE;
> @@ -1190,10 +1166,9 @@ static ssize_t io_stat_show(struct device *dev,
>  
>  	down_read(&zram->init_lock);
>  	ret = scnprintf(buf, PAGE_SIZE,
> -			"%8llu %8llu %8llu %8llu\n",
> +			"%8llu %8llu 0 %8llu\n",

Since it's sysfs, I don't think we could remove it at this moment.
Instead, just return always 0?



[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