Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758368Ab2HHXQA (ORCPT ); Wed, 8 Aug 2012 19:16:00 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:42398 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752609Ab2HHXP6 (ORCPT ); Wed, 8 Aug 2012 19:15:58 -0400 Date: Wed, 8 Aug 2012 16:15:52 -0700 From: Tejun Heo To: Kent Overstreet Cc: linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org, dm-devel@redhat.com, axboe@kernel.dk, agk@redhat.com, neilb@suse.de, drbd-dev@lists.linbit.com, vgoyal@redhat.com, mpatocka@redhat.com, sage@newdream.net, yehuda@hq.newdream.net Subject: Re: [PATCH v5 10/12] block: Add bio_clone_kmalloc() Message-ID: <20120808231552.GJ6983@dhcp-172-17-108-109.mtv.corp.google.com> References: <1344290921-25154-1-git-send-email-koverstreet@google.com> <1344290921-25154-11-git-send-email-koverstreet@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1344290921-25154-11-git-send-email-koverstreet@google.com> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1994 Lines: 64 On Mon, Aug 06, 2012 at 03:08:39PM -0700, Kent Overstreet wrote: How about the following? There was no API to kmalloc bio and clone and osdblk was using explicit bio_kmalloc() + __bio_clone(). (my guess here) As this is inconvenient and there will be more users of it in the future, add bio_clone_kmalloc() and use it in osdblk. > Acked-by: Boaz Harrosh > Signed-off-by: Kent Overstreet > --- > drivers/block/osdblk.c | 3 +-- > fs/bio.c | 13 +++++++++++++ > fs/exofs/ore.c | 5 ++--- > include/linux/bio.h | 1 + > 4 files changed, 17 insertions(+), 5 deletions(-) > > diff --git a/drivers/block/osdblk.c b/drivers/block/osdblk.c > index 87311eb..1bbc681 100644 > --- a/drivers/block/osdblk.c > +++ b/drivers/block/osdblk.c > @@ -266,11 +266,10 @@ static struct bio *bio_chain_clone(struct bio *old_chain, gfp_t gfpmask) > struct bio *tmp, *new_chain = NULL, *tail = NULL; > > while (old_chain) { > - tmp = bio_kmalloc(gfpmask, old_chain->bi_max_vecs); > + tmp = bio_clone_kmalloc(old_chain, gfpmask); > if (!tmp) > goto err_out; > > - __bio_clone(tmp, old_chain); > tmp->bi_bdev = NULL; > gfpmask &= ~__GFP_WAIT; > tmp->bi_next = NULL; > diff --git a/fs/bio.c b/fs/bio.c > index f0c865b..77b9313 100644 > --- a/fs/bio.c > +++ b/fs/bio.c > @@ -497,6 +497,19 @@ struct bio *bio_clone(struct bio *bio, gfp_t gfp_mask) > } > EXPORT_SYMBOL(bio_clone); > /** PLEASE. > +struct bio *bio_clone_kmalloc(struct bio *bio, gfp_t gfp_mask) > +{ > + struct bio *b = bio_kmalloc(gfp_mask, bio->bi_max_vecs); Can't we use %NULL bioset as an indication to allocate from kmalloc instead of duping interfaces like this? Thanks. -- tejun -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/