Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760855AbcDFAfP (ORCPT ); Tue, 5 Apr 2016 20:35:15 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:36720 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760774AbcDFAfM (ORCPT ); Tue, 5 Apr 2016 20:35:12 -0400 Date: Tue, 5 Apr 2016 16:35:07 -0800 From: Kent Overstreet To: Christoph Hellwig Cc: Ming Lei , Jens Axboe , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Boaz Harrosh , Shaohua Li , "open list:BCACHE (BLOCK LAYER CACHE)" , "open list:SOFTWARE RAID (Multiple Disks) SUPPORT" Subject: Re: [PATCH 11/27] bcache: io.c: use bio_set_vec_table Message-ID: <20160406003507.GD31161@kmo-pixel> References: <1459857443-20611-1-git-send-email-tom.leiming@gmail.com> <1459857443-20611-12-git-send-email-tom.leiming@gmail.com> <20160405124902.GA11986@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160405124902.GA11986@infradead.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1250 Lines: 28 On Tue, Apr 05, 2016 at 05:49:02AM -0700, Christoph Hellwig wrote: > On Tue, Apr 05, 2016 at 07:56:56PM +0800, Ming Lei wrote: > > diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c > > index 86a0bb8..1c48462 100644 > > --- a/drivers/md/bcache/io.c > > +++ b/drivers/md/bcache/io.c > > @@ -26,8 +26,7 @@ struct bio *bch_bbio_alloc(struct cache_set *c) > > > > bio_init(bio); > > bio->bi_flags |= BIO_POOL_NONE << BIO_POOL_OFFSET; > > - bio->bi_max_vecs = bucket_pages(c); > > - bio->bi_io_vec = bio->bi_inline_vecs; > > + bio_set_vec_table(bio, bio->bi_inline_vecs, bucket_pages(c)); > > All this bcache code needs to move away from bio_init on a bio > embedded in a driver private structure toward properly using > bio_alloc / bio_alloc_bioset. That will also fix the crash > with bcache over md that Shaohua reported, so I'd suggest to fast > track this part of the series. Why? bio_init() is a publicly exported function, it's always been one and bcache is ot the only driver to use it directly. bios with > BIO_MAX_PAGES bvecs is a separate issue; I would argue that the bug is in md's queue_limits; it uses blk_set_stacking_limits() which sets max_segments = USHRT_MAX, which is wrong if it's going to clone the biovec.