Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2999038imm; Thu, 24 May 2018 20:51:29 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrTBkL5GHGcFldUncJQoNfHG+6LnNdEet985eRzEsnAS61aoqNAo6+I70iNCFwuTCyap/yv X-Received: by 2002:a63:9205:: with SMTP id o5-v6mr617270pgd.233.1527220289363; Thu, 24 May 2018 20:51:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527220289; cv=none; d=google.com; s=arc-20160816; b=DnHpOFlKY57ICQPmVr+2Pny9tiSAwJEboIK5yJhW2eHdt8A0ySW4HqMD210lC4b8ZJ 597x3peLqW9vTn3YUu/GhRxEvRgviAJYdxqb2qIMnwWAkVW0en07mpXYK9Igk4yu2B6y sNe148w91HR9ksmCY4QoOAz3BMGF36tcOMoc+PjbsjjUib6OPegpnsQZOlApSTc3KKAA NhIQm4XMDX8ONbZbYgAIDxIb9eyew7S5Ey3wMrzEqEdQ2hQ5+Ll/atVR+CuTzH4ZVhVg ny1+V3qr/cuPcuAlYdhyrbPFBarnLiv7trQih2N6hyqvbn7fMjjrz3tJV7THhaMzSgtO PgAw== 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=+fGIwvw106FUpjD+qJa8Vt0VOby/pqyKDYcO2TzxJ2s=; b=CJhIlL/GN/Du2n8upCcXhFPqdelyJm8z3YwiTRSuU2VG868ywYnYumPWSWgl1LYdXF bVVma6Q2FX0THunaxmDyk5431SVhv8D8zAb2tYKq7GWdr/A9KoIuNT6g5FCtFgU4eRRO 30YZh84teMlxC7C5eswxWCBzMX4pbsSWZV18At/dWAewg8V0djiKYByw8EoJw2z0qEKw OJ0y5izTs2eu0ZAEqQg5dNkVEctkDqUHf6Awii1UeZEB6KsLZhmCa06d6BI/wtkgDTZi CVW/JfPCgTjjmyEMltVnOLw8K39AYNBFjsJwDWRanTyOm+gyMHv+hdh5VBuROxWq+arx 3I4A== 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 f129-v6si4437838pgc.230.2018.05.24.20.51.14; Thu, 24 May 2018 20:51:29 -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 S964883AbeEYDuk (ORCPT + 99 others); Thu, 24 May 2018 23:50:40 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:41504 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932570AbeEYDuh (ORCPT ); Thu, 24 May 2018 23:50:37 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6FA35401EF03; Fri, 25 May 2018 03:50:36 +0000 (UTC) Received: from localhost (ovpn-12-30.pek2.redhat.com [10.72.12.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id C0D309457F; Fri, 25 May 2018 03:50:26 +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 , Ming Lei Subject: [RESEND PATCH V5 20/33] md/dm/bcache: conver to bio_for_each_page_all2 and bio_for_each_segment Date: Fri, 25 May 2018 11:46:08 +0800 Message-Id: <20180525034621.31147-21-ming.lei@redhat.com> In-Reply-To: <20180525034621.31147-1-ming.lei@redhat.com> References: <20180525034621.31147-1-ming.lei@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 25 May 2018 03:50:36 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 25 May 2018 03:50:36 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.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_segment() is fine because this helper can only be used on a freshly new bio. For other cases, we conver to bio_for_each_page_all2() since they needn't to update bvec table. bio_for_each_page_all() can't be used any more after multipage bvec is enabled, so we have to convert to bio_for_each_page_all2(). 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 a9d82911c3d2..498f6b032b4c 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_iter_all bia; - bio_for_each_page_all(bv, b->bio, j) + bio_for_each_page_all2(bv, b->bio, j, bia) 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 77230973a110..74febd5230df 100644 --- a/drivers/md/bcache/util.c +++ b/drivers/md/bcache/util.c @@ -303,7 +303,7 @@ int bch_bio_alloc_pages(struct bio *bio, gfp_t gfp_mask) int i; struct bio_vec *bv; - bio_for_each_page_all(bv, bio, i) { + bio_for_each_segment_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 74737ae0ef11..8fdc8349fd72 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_iter_all bia; - bio_for_each_page_all(bv, clone, i) { + bio_for_each_page_all2(bv, clone, i, bia) { 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 e318a0c19eb0..8b2b071619a2 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -2117,13 +2117,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_iter_all bia; if (sbio->bi_end_io != end_sync_read) continue; /* Now we can 'fixup' the error value */ sbio->bi_status = 0; - bio_for_each_page_all(bi, sbio, j) + bio_for_each_page_all2(bi, sbio, j, bia) page_len[j] = bi->bv_len; if (!status) { -- 2.9.5