All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Keith Busch <kbusch@fb.com>,
	linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org,
	axboe@kernel.dk, Kernel Team <Kernel-team@fb.com>,
	bvanassche@acm.org, damien.lemoal@opensource.wdc.com,
	ebiggers@kernel.org
Subject: Re: [PATCHv3 5/6] block/bounce: count bytes instead of sectors
Date: Wed, 25 May 2022 08:17:29 -0600	[thread overview]
Message-ID: <Yo46eYw1oyq/h5BN@kbusch-mbp.dhcp.thefacebook.com> (raw)
In-Reply-To: <Yo44R5lhdNkZPGjF@kbusch-mbp.dhcp.thefacebook.com>

On Wed, May 25, 2022 at 08:08:07AM -0600, Keith Busch wrote:
> On Tue, May 24, 2022 at 08:09:21AM +0200, Christoph Hellwig wrote:
> > >  	bio_for_each_segment(from, *bio_orig, iter) {
> > >  		if (i++ < BIO_MAX_VECS)
> > > -			sectors += from.bv_len >> 9;
> > > +			bytes += from.bv_len;
> > >  		if (PageHighMem(from.bv_page))
> > >  			bounce = true;
> > >  	}
> > >  	if (!bounce)
> > >  		return;
> > >  
> > > +	sectors = ALIGN_DOWN(bytes, queue_logical_block_size(q)) >> 9;
> > 
> > Same comment about SECTOR_SHIFT and a comment here.  That being said,
> > why do we even align here?  Shouldn't bytes always be setor aligned here
> > and this should be a WARN_ON or other sanity check?  Probably the same
> > for the previous patch.
> 
> Yes, the total bytes should be sector aligned.
> 
> I'm not exactly sure why we're counting it this way, though. We could just skip
> the iterative addition and get the total from bio->bi_iter.bi_size. Unless
> bio_orig has more segments that BIO_MAX_VECS, which doesn't seem possible.

Oh, there's a comment explaining the original can have more than BIO_MAX_VECS,
so the ALIGN_DOWN is necessary to ensure a logical block sized split.

  reply	other threads:[~2022-05-25 14:17 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-23 21:01 [PATCHv3 0/6] direct io dma alignment Keith Busch
2022-05-23 21:01 ` [PATCHv3 1/6] block/bio: remove duplicate append pages code Keith Busch
2022-05-24  6:00   ` Christoph Hellwig
2022-05-24  6:24   ` Johannes Thumshirn
2022-05-24 14:17   ` Pankaj Raghav
2022-05-24 15:38     ` Keith Busch
2022-05-25  7:49       ` Pankaj Raghav
2022-05-25  8:30         ` Damien Le Moal
2022-05-25 13:37         ` Keith Busch
2022-05-25 14:25           ` Pankaj Raghav
2022-05-23 21:01 ` [PATCHv3 2/6] block: export dma_alignment attribute Keith Busch
2022-05-24  6:02   ` Christoph Hellwig
2022-05-24  6:24   ` Johannes Thumshirn
2022-05-23 21:01 ` [PATCHv3 3/6] block: introduce bdev_dma_alignment helper Keith Busch
2022-05-24  6:02   ` Christoph Hellwig
2022-05-24  6:25   ` Johannes Thumshirn
2022-05-23 21:01 ` [PATCHv3 4/6] block/merge: count bytes instead of sectors Keith Busch
2022-05-24  6:07   ` Christoph Hellwig
2022-05-23 21:01 ` [PATCHv3 5/6] block/bounce: " Keith Busch
2022-05-24  6:09   ` Christoph Hellwig
2022-05-25 14:08     ` Keith Busch
2022-05-25 14:17       ` Keith Busch [this message]
2022-05-24 14:32   ` Pankaj Raghav
2022-05-23 21:01 ` [PATCHv3 6/6] block: relax direct io memory alignment Keith Busch
2022-05-24  6:12   ` Christoph Hellwig
2022-05-24 15:19   ` Pankaj Raghav

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yo46eYw1oyq/h5BN@kbusch-mbp.dhcp.thefacebook.com \
    --to=kbusch@kernel.org \
    --cc=Kernel-team@fb.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=ebiggers@kernel.org \
    --cc=hch@lst.de \
    --cc=kbusch@fb.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.