All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pankaj Raghav <pankydev8@gmail.com>
To: Keith Busch <kbusch@fb.com>
Cc: linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org,
	axboe@kernel.dk, Kernel Team <Kernel-team@fb.com>,
	hch@lst.de, bvanassche@acm.org, damien.lemoal@opensource.wdc.com,
	ebiggers@kernel.org, Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCHv3 1/6] block/bio: remove duplicate append pages code
Date: Tue, 24 May 2022 16:17:54 +0200	[thread overview]
Message-ID: <20220524141754.msmt6s4spm4istsb@quentin> (raw)
In-Reply-To: <20220523210119.2500150-2-kbusch@fb.com>

On Mon, May 23, 2022 at 02:01:14PM -0700, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
> 
> The getting pages setup for zone append and normal IO are identical. Use
> common code for each.
> 
> Signed-off-by: Keith Busch <kbusch@kernel.org>
> +
> +static int bio_iov_add_zone_append_page(struct bio *bio, struct page *page,
> +		unsigned int len, unsigned int offset)
> +{
> +	struct request_queue *q = bdev_get_queue(bio->bi_bdev);
> +	bool same_page = false;
> +
> +	if (bio_add_hw_page(q, bio, page, len, offset,
> +			queue_max_zone_append_sectors(q), &same_page) != len)
> +		return -EINVAL;
> +	if (same_page)
> +		put_page(page);
> +	return 0;
> +}
> +
>  
> -static int __bio_iov_append_get_pages(struct bio *bio, struct iov_iter *iter)
> -{
> -	unsigned short nr_pages = bio->bi_max_vecs - bio->bi_vcnt;
> -	unsigned short entries_left = bio->bi_max_vecs - bio->bi_vcnt;
> -	struct request_queue *q = bdev_get_queue(bio->bi_bdev);
> -	unsigned int max_append_sectors = queue_max_zone_append_sectors(q);
> -	struct bio_vec *bv = bio->bi_io_vec + bio->bi_vcnt;
> -	struct page **pages = (struct page **)bv;
> -	ssize_t size, left;
> -	unsigned len, i;
> -	size_t offset;
> -	int ret = 0;
> -

> -	if (WARN_ON_ONCE(!max_append_sectors))
> -		return 0;
I don't see this check in the append path. Should it be added in
bio_iov_add_zone_append_page() function?
> -
> -	/*
> -	 * Move page array up in the allocated memory for the bio vecs as far as
> -	 * possible so that we can start filling biovecs from the beginning
> -	 * without overwriting the temporary page array.
> -	 */
> -	BUILD_BUG_ON(PAGE_PTRS_PER_BVEC < 2);
> -	pages += entries_left * (PAGE_PTRS_PER_BVEC - 1);
> -
> -	size = iov_iter_get_pages(iter, pages, LONG_MAX, nr_pages, &offset);
> -	if (unlikely(size <= 0))

-- 
Pankaj Raghav


  parent reply	other threads:[~2022-05-24 14:18 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 [this message]
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
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=20220524141754.msmt6s4spm4istsb@quentin \
    --to=pankydev8@gmail.com \
    --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=kbusch@kernel.org \
    --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.