Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753916AbcC3Bjk (ORCPT ); Tue, 29 Mar 2016 21:39:40 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:40425 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753399AbcC3Bji (ORCPT ); Tue, 29 Mar 2016 21:39:38 -0400 MIME-Version: 1.0 In-Reply-To: <21cf85d32278bbe5acbc3def0a6db75db98a2670.1459269590.git.shli@fb.com> References: <21cf85d32278bbe5acbc3def0a6db75db98a2670.1459269590.git.shli@fb.com> Date: Wed, 30 Mar 2016 09:39:35 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] block: don't make BLK_DEF_MAX_SECTORS too big From: Ming Lei To: Shaohua Li Cc: linux-block@vger.kernel.org, Linux Kernel Mailing List , Jens Axboe , FB Kernel Team , "4.2+" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2124 Lines: 55 On Wed, Mar 30, 2016 at 12:42 AM, Shaohua Li wrote: > 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 > Cc: stable@vger.kernel.org (4.2+) > Cc: Ming Lei > Reviewed-by: Jeff Moyer > Signed-off-by: Shaohua Li > --- > 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, Thinking about it further, it isn't good to change the default max sectors because the patch affects REQ_PC bios too, which don't have the 1Mbytes limit at all. So suggest to just change bcache's queue max sector limit to 1M, that means we shouldn't encourage bcache's usage of bypassing bio_add_page(). Thanks, Ming > BLK_MAX_SEGMENT_SIZE = 65536, > BLK_SEG_BOUNDARY_MASK = 0xFFFFFFFFUL, > }; > -- > 2.8.0.rc2 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-block" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html