Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1366462

[PATCH] block: don't make BLK_DEF_MAX_SECTORS too big

From Shaohua Li <shli@fb.com>
Newsgroups linux.kernel
Subject [PATCH] block: don't make BLK_DEF_MAX_SECTORS too big
Date 2016-03-29 18:50 +0200
Message-ID <ri507-wp-17@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


bio_alloc_bioset() allocates bvecs from bvec_slabs which can only
allocate maximum 256 bvec (eg, 1M for 4k pages). We can't bump
BLK_DEF_MAX_SECTORS to exceed this value otherwise bio_alloc_bioset will
fail.

In the future, we can extend the size either bvec_slabs array is
expanded or the upcoming multipage bvec is added if pages are
contiguous. This one is suitable for stable.

Fixes: d2be537c3ba (block: bump BLK_DEF_MAX_SECTORS to 2560)
Reported-by: Sebastian Roesner <sroesner-kernelorg@roesner-online.de>
Cc: stable@vger.kernel.org (4.2+)
Cc: Ming Lei <ming.lei@canonical.com>
Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Shaohua Li <shli@fb.com>
---
 include/linux/blkdev.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 7e5d7e0..da64325 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1153,7 +1153,11 @@ extern int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm);
 enum blk_default_limits {
 	BLK_MAX_SEGMENTS	= 128,
 	BLK_SAFE_MAX_SECTORS	= 255,
-	BLK_DEF_MAX_SECTORS	= 2560,
+	/*
+	 * if you change this, please also change bvec_alloc and BIO_MAX_PAGES.
+	 * Otherwise bio_alloc_bioset will break.
+	 */
+	BLK_DEF_MAX_SECTORS	= BIO_MAX_SECTORS,
 	BLK_MAX_SEGMENT_SIZE	= 65536,
 	BLK_SEG_BOUNDARY_MASK	= 0xFFFFFFFFUL,
 };
-- 
2.8.0.rc2

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] block: don't make BLK_DEF_MAX_SECTORS too big Shaohua Li <shli@fb.com> - 2016-03-29 18:50 +0200
  Re: [PATCH] block: don't make BLK_DEF_MAX_SECTORS too big Christoph Hellwig <hch@infradead.org> - 2016-03-29 23:20 +0200
    Re: [PATCH] block: don't make BLK_DEF_MAX_SECTORS too big Shaohua Li <shli@fb.com> - 2016-03-30 00:10 +0200
      Re: [PATCH] block: don't make BLK_DEF_MAX_SECTORS too big Christoph Hellwig <hch@infradead.org> - 2016-03-30 09:00 +0200
        Re: [PATCH] block: don't make BLK_DEF_MAX_SECTORS too big Shaohua Li <shli@fb.com> - 2016-03-30 19:00 +0200
          Re: [PATCH] block: don't make BLK_DEF_MAX_SECTORS too big Christoph Hellwig <hch@infradead.org> - 2016-03-30 19:50 +0200
          Re: [PATCH] block: don't make BLK_DEF_MAX_SECTORS too big Kent Overstreet <kent.overstreet@gmail.com> - 2016-03-31 03:00 +0200
  Re: [PATCH] block: don't make BLK_DEF_MAX_SECTORS too big Ming Lei <ming.lei@canonical.com> - 2016-03-30 03:40 +0200
    Re: [PATCH] block: don't make BLK_DEF_MAX_SECTORS too big Shaohua Li <shli@fb.com> - 2016-03-30 04:30 +0200
      Re: [PATCH] block: don't make BLK_DEF_MAX_SECTORS too big Ming Lei <ming.lei@canonical.com> - 2016-03-30 14:20 +0200
        Re: [PATCH] block: don't make BLK_DEF_MAX_SECTORS too big Shaohua Li <shli@fb.com> - 2016-03-30 19:10 +0200
          Re: [PATCH] block: don't make BLK_DEF_MAX_SECTORS too big Ming Lei <ming.lei@canonical.com> - 2016-03-31 02:50 +0200

csiph-web