Re: [PATCH v2] ceph: fix write_begin optimization when write is beyond EOF

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

 



On Fri, Jun 11, 2021 at 08:11:41PM -0400, Jeff Layton wrote:
>  		if ((pos_in_page == 0 && len == PAGE_SIZE) ||
> -		    (pos >= i_size_read(inode)) ||
> +		    (index > (i_size_read(inode) - 1) / PAGE_SIZE) ||
>  		    (pos_in_page == 0 && (pos + len) >= i_size_read(inode))) {

You missed the (i_size == 0) case.  And I really would factor out
reading i_size into a local variable.

>  			zero_user_segments(page, 0, pos_in_page,
>  					   pos_in_page + len, PAGE_SIZE);
> -- 
> 2.31.1
> 



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux