Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1977893imm; Sat, 9 Jun 2018 05:36:23 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI9DwhwRwk0pUe5OsKs3r2IZi2FrBqUkMRnBlOhoZ3ei1CCPeq7bZgREE9bYGu1lOHV/Mvn X-Received: by 2002:a17:902:1566:: with SMTP id b35-v6mr10785925plh.107.1528547783923; Sat, 09 Jun 2018 05:36:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528547783; cv=none; d=google.com; s=arc-20160816; b=m0jW7ciFcix2kaPxr3aBvSzNkLmt9SCMd16GEFahusP52kObeQavKjt0HFc1MpdUzY 2YQtz8vzozotYfSRWCuCA/6tYuQvyIUBffj0yaAc/T8hF54EbOnmmda34qO4ZugD1a9S OUVesAyCckVit6KP1x1jXuUesgjNlILB192RW/h+00+SZMmn0BfHyv92ZUTQz8l9+Zsm dzs1Vhuxq593gCJ8396/wyEU+eqUXrQr/9vujMDL/c722yqTt6C7G7LiMFCQJxRfjpUe t1ppx0+9qtSkWwR536T0gUHGVX5kIKzPok0+gyIsqRMAFUT04zaXkY1JIkMxiqSiE4gK 0LVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=YpwG844zOvcaPXq0NSfxGyErI8UTcOJTpbTtZhiX/Ug=; b=pjrAQ+ZwWuJxyXzDbihmqchqZMeDEADZlnMz9jj9wPLCpcuUwLgfuZYCQLHqaSZmDy Y7d4b4p2y1tcS+VZCNzUfenhZ9pvFLeNEcwtzFA/mccYOtto0KyqYaimKGsFgpCS8VpX O5e1VGeMFxQMnns93pDstmCK7wqwinNDSFk0rm3tqHapItq4sP34ot0uwU0Nvp0bX1M+ +eJj2VXT943m7EjLg+tAcm/r8oHZclRWZfgpZ6aUtaN1KakXMI61+9I5BWY5XrKlVFsT iNJ10cX+R//G60xTEp2KpBa6qWWBY4vFz6sCqC1Wne/59K+fb+jA0A6ChlRHdtngMKVk 9A8g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t11-v6si2671714pgu.115.2018.06.09.05.36.10; Sat, 09 Jun 2018 05:36:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753558AbeFIMeX (ORCPT + 99 others); Sat, 9 Jun 2018 08:34:23 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38324 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753416AbeFIMeU (ORCPT ); Sat, 9 Jun 2018 08:34:20 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 24E3D818BAF7; Sat, 9 Jun 2018 12:34:20 +0000 (UTC) Received: from localhost (ovpn-12-40.pek2.redhat.com [10.72.12.40]) by smtp.corp.redhat.com (Postfix) with ESMTP id A708B2166BB2; Sat, 9 Jun 2018 12:34:14 +0000 (UTC) From: Ming Lei To: Jens Axboe , Christoph Hellwig , Alexander Viro , Kent Overstreet Cc: David Sterba , Huang Ying , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Theodore Ts'o , "Darrick J . Wong" , Coly Li , Filipe Manana , Randy Dunlap , Ming Lei Subject: [PATCH V6 19/30] md/dm/bcache: conver to bio_for_each_chunk_segment_all and bio_for_each_chunk_all Date: Sat, 9 Jun 2018 20:30:03 +0800 Message-Id: <20180609123014.8861-20-ming.lei@redhat.com> In-Reply-To: <20180609123014.8861-1-ming.lei@redhat.com> References: <20180609123014.8861-1-ming.lei@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Sat, 09 Jun 2018 12:34:20 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Sat, 09 Jun 2018 12:34:20 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'ming.lei@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In bch_bio_alloc_pages(), bio_for_each_chunk_all() is fine because this helper can only be used on a freshly new bio. For other cases, we conver to bio_for_each_chunk_segment_all() since they needn't to update bvec table. bio_for_each_segment_all() can't be used any more after multipage bvec is enabled, so we have to convert to bio_for_each_chunk_segment_all(). Signed-off-by: Ming Lei --- drivers/md/bcache/btree.c | 3 ++- drivers/md/bcache/util.c | 2 +- drivers/md/dm-crypt.c | 3 ++- drivers/md/raid1.c | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index 2a0968c04e21..dc0747c37bdf 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c @@ -423,8 +423,9 @@ static void do_btree_node_write(struct btree *b) int j; struct bio_vec *bv; void *base = (void *) ((unsigned long) i & ~(PAGE_SIZE - 1)); + struct bvec_chunk_iter citer; - bio_for_each_segment_all(bv, b->bio, j) + bio_for_each_chunk_segment_all(bv, b->bio, j, citer) memcpy(page_address(bv->bv_page), base + j * PAGE_SIZE, PAGE_SIZE); diff --git a/drivers/md/bcache/util.c b/drivers/md/bcache/util.c index fc479b026d6d..2f05199f7edb 100644 --- a/drivers/md/bcache/util.c +++ b/drivers/md/bcache/util.c @@ -268,7 +268,7 @@ int bch_bio_alloc_pages(struct bio *bio, gfp_t gfp_mask) int i; struct bio_vec *bv; - bio_for_each_segment_all(bv, bio, i) { + bio_for_each_chunk_all(bv, bio, i) { bv->bv_page = alloc_page(gfp_mask); if (!bv->bv_page) { while (--bv >= bio->bi_io_vec) diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index da02f4d8e4b9..637ef1b1dc43 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -1450,8 +1450,9 @@ static void crypt_free_buffer_pages(struct crypt_config *cc, struct bio *clone) { unsigned int i; struct bio_vec *bv; + struct bvec_chunk_iter citer; - bio_for_each_segment_all(bv, clone, i) { + bio_for_each_chunk_segment_all(bv, clone, i, citer) { BUG_ON(!bv->bv_page); mempool_free(bv->bv_page, &cc->page_pool); } diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index bad28520719b..2a4f1037c680 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -2116,13 +2116,14 @@ static void process_checks(struct r1bio *r1_bio) struct page **spages = get_resync_pages(sbio)->pages; struct bio_vec *bi; int page_len[RESYNC_PAGES] = { 0 }; + struct bvec_chunk_iter citer; if (sbio->bi_end_io != end_sync_read) continue; /* Now we can 'fixup' the error value */ sbio->bi_status = 0; - bio_for_each_segment_all(bi, sbio, j) + bio_for_each_chunk_segment_all(bi, sbio, j, citer) page_len[j] = bi->bv_len; if (!status) { -- 2.9.5