Re: [PATCHv2 3/3] block: relax direct io memory alignment

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

 



On Thu, May 19, 2022 at 08:08:50AM -0600, Keith Busch wrote:
> > >  	size = iov_iter_get_pages(iter, pages, LONG_MAX, nr_pages, &offset);
> > > +	if (size > 0)
> > > +		size = ALIGN_DOWN(size, queue_logical_block_size(q));
> > 
> > So if we do get a size that is not logical block size alignment here,
> > we reduce it to the block size aligned one below.  Why do we do that?
> 
> There are two possibilities:
> 
> In the first case, the number of pages in this iteration exceeds bi_max_vecs.
> Rounding down completes the bio with a block aligned size, and the remainder
> will be picked up for the next bio, or possibly even the current bio if the
> pages are sufficiently physically contiguous.
> 
> The other case is a bad iov. If we're doing __blkdev_direct_IO(), it will error
> out immediately if the rounded size is 0, or the next iteration when the next
> size is rounded to 0. If we're doing the __blkdev_direct_IO_simple(), it will
> error out when it sees the iov hasn't advanced to the end.

Can you please document this with a comment in the code?



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux