From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753816AbcL3LGY (ORCPT ); Fri, 30 Dec 2016 06:06:24 -0500 Received: from mx2.suse.de ([195.135.220.15]:47689 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753678AbcL3LGW (ORCPT ); Fri, 30 Dec 2016 06:06:22 -0500 Subject: Re: [PATCH v1 08/54] block: comment on bio_alloc_pages() To: Ming Lei , Jens Axboe , linux-kernel@vger.kernel.org References: <1482854250-13481-1-git-send-email-tom.leiming@gmail.com> <1482854250-13481-9-git-send-email-tom.leiming@gmail.com> Cc: linux-block@vger.kernel.org, Christoph Hellwig , Jens Axboe , Kent Overstreet , Shaohua Li , Mike Christie , Guoqing Jiang , Hannes Reinecke , "open list:BCACHE (BLOCK LAYER CACHE)" , "open list:SOFTWARE RAID (Multiple Disks) SUPPORT" From: Coly Li Message-ID: Date: Fri, 30 Dec 2016 19:06:02 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <1482854250-13481-9-git-send-email-tom.leiming@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016/12/27 下午11:55, Ming Lei wrote: > This patch adds comment on usage of bio_alloc_pages(), > also comments on one special case of bch_data_verify(). > > Signed-off-by: Ming Lei > --- > block/bio.c | 4 +++- > drivers/md/bcache/debug.c | 6 ++++++ > 2 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/block/bio.c b/block/bio.c > index 2b375020fc49..d4a1e0b63ea0 100644 > --- a/block/bio.c > +++ b/block/bio.c > @@ -961,7 +961,9 @@ EXPORT_SYMBOL(bio_advance); > * @bio: bio to allocate pages for > * @gfp_mask: flags for allocation > * > - * Allocates pages up to @bio->bi_vcnt. > + * Allocates pages up to @bio->bi_vcnt, and this function should only > + * be called on a new initialized bio, which means all pages aren't added > + * to the bio via bio_add_page() yet. > * > * Returns 0 on success, -ENOMEM on failure. On failure, any allocated pages are > * freed. > diff --git a/drivers/md/bcache/debug.c b/drivers/md/bcache/debug.c > index 06f55056aaae..48d03e8b3385 100644 > --- a/drivers/md/bcache/debug.c > +++ b/drivers/md/bcache/debug.c > @@ -110,6 +110,12 @@ void bch_data_verify(struct cached_dev *dc, struct bio *bio) > struct bio_vec bv, cbv; > struct bvec_iter iter, citer = { 0 }; > > + /* > + * Once multipage bvec is supported, the bio_clone() > + * has to make sure page count in this bio can be held > + * in the new cloned bio because each single page need > + * to assign to each bvec of the new bio. > + */ > check = bio_clone(bio, GFP_NOIO); > if (!check) > return; > Acked-by: Coly Li