linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
	Ming Lei <ming.lei@redhat.com>,
	Bart Van Assche <bvanassche@acm.org>,
	Christoph Hellwig <hch@infradead.org>
Subject: [PATCH 3/5] block: Document the bio_vec properties
Date: Fri, 15 May 2020 17:19:12 -0700	[thread overview]
Message-ID: <20200516001914.17138-4-bvanassche@acm.org> (raw)
In-Reply-To: <20200516001914.17138-1-bvanassche@acm.org>

Since it is nontrivial that nth_page() does not have to be used for a
bio_vec, document this.

CC: Christoph Hellwig <hch@infradead.org>
Cc: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 include/linux/bvec.h | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/include/linux/bvec.h b/include/linux/bvec.h
index a81c13ac1972..25295c11b164 100644
--- a/include/linux/bvec.h
+++ b/include/linux/bvec.h
@@ -12,8 +12,22 @@
 #include <linux/errno.h>
 #include <linux/mm.h>
 
-/*
- * was unsigned short, but we might as well be ready for > 64kB I/O pages
+/**
+ * struct bio_vec - a contiguous range of physical memory addresses
+ * @bv_page:   First page associated with the address range.
+ * @bv_len:    Number of bytes in the address range.
+ * @bv_offset: Start of the address range relative to the start of @bv_page.
+ *
+ * The following holds for a bvec if n * PAGE_SIZE < bv_offset + bv_len:
+ *
+ *   nth_page(@bv_page, n) == @bv_page + n
+ *
+ * From the description of commit 52d52d1c98a9 ("block: only allow contiguous
+ * page structs in a bio_vec"): "We currently have to call nth_page when
+ * iterating over pages inside a bio_vec.  Jens complained a while ago that
+ * this is fairly expensive. To mitigate this we can check that that the
+ * actual page structures are contiguous when adding them to the bio, and just
+ * do check pointer arithmetics later on." See also page_is_mergeable().
  */
 struct bio_vec {
 	struct page	*bv_page;

  parent reply	other threads:[~2020-05-16  0:19 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-16  0:19 [PATCH 0/5] Block layer patches for kernel v5.8 Bart Van Assche
2020-05-16  0:19 ` [PATCH 1/5] block: Fix type of first compat_put_{,u}long() argument Bart Van Assche
2020-05-16  7:40   ` Arnd Bergmann
2020-05-16 12:41   ` Christoph Hellwig
2020-05-16  0:19 ` [PATCH 2/5] bio.h: Declare the arguments of bio iteration functions const Bart Van Assche
2020-05-16  8:55   ` Alexander Potapenko
2020-05-16 17:10     ` Bart Van Assche
2020-05-16 12:42   ` Christoph Hellwig
2020-05-17 22:46   ` Chaitanya Kulkarni
2020-05-16  0:19 ` Bart Van Assche [this message]
2020-05-16 12:43   ` [PATCH 3/5] block: Document the bio_vec properties Christoph Hellwig
2020-05-16  0:19 ` [PATCH 4/5] block: Fix zero_fill_bio() Bart Van Assche
2020-05-16  5:50   ` Ming Lei
2020-05-16  0:19 ` [PATCH 5/5] null_blk: Zero-initialize read buffers in non-memory-backed mode Bart Van Assche
2020-05-16  9:40   ` Alexander Potapenko
2020-05-18  1:12   ` Damien Le Moal
2020-05-18  1:32     ` Bart Van Assche
2020-05-18  2:10       ` Damien Le Moal
2020-05-18  2:56         ` Bart Van Assche
2020-05-18  3:12           ` Damien Le Moal
2020-05-18 14:31             ` Bart Van Assche
2020-05-19  3:03               ` Damien Le Moal
2020-05-19  4:10                 ` Bart Van Assche

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=20200516001914.17138-4-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).