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

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

 



On Fri, 2021-06-11 at 21:48 +0100, Matthew Wilcox wrote:
> On Fri, Jun 11, 2021 at 03:59:04PM -0400, Jeff Layton wrote:
> >  		if ((pos_in_page == 0 && len == PAGE_SIZE) ||
> > -		    (pos >= i_size_read(inode)) ||
> > +		    (index > (i_size_read(inode) / PAGE_SIZE)) ||
> 
> I think that wants to be ((i_size_read(inode) - 1) / PAGE_SIZE)
> 
> If your file is 4096 bytes long, that means bytes 0-4095 contain data.
> Except that i_size can be 0, so ...
> 
> 		if ((offset == 0 && len == PAGE_SIZE) || i_size == 0 ||
> 		    (index > (i_size - 1) / PAGE_SIZE) ||
> 		    (offset == 0 && pos + len >= i_size))
>   			zero_user_segments(page, 0, pos_in_page,
>   					   pos_in_page + len, PAGE_SIZE);
> 

Oh, right -- I'll fix that and send a v2. Sorry for the noise!

-- 
Jeff Layton <jlayton@xxxxxxxxxx>




[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