From patchwork Fri May 25 03:46:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 10426099 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 64F55602D8 for ; Fri, 25 May 2018 03:50:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 542E3294F9 for ; Fri, 25 May 2018 03:50:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 48DCA295A4; Fri, 25 May 2018 03:50:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD701294F9 for ; Fri, 25 May 2018 03:50:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E48B76B02B2; Thu, 24 May 2018 23:50:37 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id DF7B56B02B4; Thu, 24 May 2018 23:50:37 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C992C6B02B5; Thu, 24 May 2018 23:50:37 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt0-f198.google.com (mail-qt0-f198.google.com [209.85.216.198]) by kanga.kvack.org (Postfix) with ESMTP id 9E9D76B02B2 for ; Thu, 24 May 2018 23:50:37 -0400 (EDT) Received: by mail-qt0-f198.google.com with SMTP id z10-v6so2830441qto.11 for ; Thu, 24 May 2018 20:50:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=+fGIwvw106FUpjD+qJa8Vt0VOby/pqyKDYcO2TzxJ2s=; b=FPdE/q351rHhodVJLsxO6iA+kL/nlXCjrgEdjr/DXin/GZvpVoe5kD9m+Tc63A7tMi SKq3SJDd/jY4JPRuniSMrLy4wRcZepwphcAK9kt5p8B97/yBEQ3A9hFl3QjJ4IHGg2ZV ZFEgVJwma0h5W8OoAALC+OWDwV9orPPvGieXUtlVPURa6uWrOmesVizyiUQ2mwx6GZwC 8ga0d8pnd7z1KiPR93k01JHu5HLes1gakMj71RA9tngg66xrv+/uqLvkf0l3QxSlGixO qBLkbO8YQpsYF6lX2+hvRF6P3bRAaMEWMACxTwwAf2kM2IodEc3iwpHFg47cWtdL22Sm V1Pg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 66.187.233.73 as permitted sender) smtp.mailfrom=ming.lei@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: ALKqPwdGB7XrZ8taZ80QUNmbglmP8KM9bDmMjsvj+Uqj2odOL0C2HdHf OJvqvg9CGfAdm2uzPwIeiSc6GO8tkvvQLsVAbk6LmcU0+N5LIS4ICacdVZSxszH2Ijwh/yailzB 9X0QoaltVjB0nL2WE43m/Zayvtp9Jv7nAHdGfcQuliYgTWTDeLSEHgvKyZaTVXLemCQ== X-Received: by 2002:a37:9684:: with SMTP id y126-v6mr530856qkd.297.1527220237425; Thu, 24 May 2018 20:50:37 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIa2JMc9xIUPG6b/q73fHTSEguZC5ZRuRI042i9BLmkRO/kESlMMJxJLoHd5PHCetpk4wgK X-Received: by 2002:a37:9684:: with SMTP id y126-v6mr530842qkd.297.1527220236838; Thu, 24 May 2018 20:50:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527220236; cv=none; d=google.com; s=arc-20160816; b=gxjMOld4FuwyMpDgFLf0UTnF4NN5Mk+fOcQ8G6A6h+XnDS35QuDCuB5xg5s+YB+LhL lHmH/OZeAvLyOgxeMoS7lwuoxDkGu7ZzhnsXML6+QyHash4g9YvRuTJZvwwHhMYwjQaC lgaynXE/Kp/ECMrheR1w1zDg/1QrQz3ZcN3WezW7AJgaB+WNYCSSqLgviG6pDMdC7Ffy OupU025vdaJU3s6Le1V8r8l0P/TFf1zvySneiBwtLbv0w0ACHRKmHtbqeBAcmT9R8KQt bjNGp8w+4SYeqaJZIoPqzNQeAU1N76LYapNhEA1jQxTcpdiAS+DWfRE3Z97ugHO8DuZH ZrsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=+fGIwvw106FUpjD+qJa8Vt0VOby/pqyKDYcO2TzxJ2s=; b=s5tLg0P7K4jQM+Ji71V3AvhbpM+Sw5M7hdfmfqeWc+h+MYFqRXCmHhyO8rD4jgnVxX qdOp1r0/nBZp2njvJsPQERZJXxrb1Ear5oPkL2mFoU0e/5TFP75JqFMSN5/nfpPtE9AN qfmFQUz1U8j3yiEBFVMGQE14Fsi32KV1o2LBm7O5zCdABjzcUfISJDE9KmjTrn3sPqeQ myHT7VQK+CJAu/ECACp+Dnsv7Tp7vhAcVKosbxa46EiEshbnNj+BT5FRjJrBZJFyn0U5 Aqf8BnD/OJyuV7Q5UF7UjduTcOInltER38EjUzynZ6LUOWeTFjqg4qI72b4sQ5qM3h2V kUlg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 66.187.233.73 as permitted sender) smtp.mailfrom=ming.lei@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mx1.redhat.com (mx3-rdu2.redhat.com. [66.187.233.73]) by mx.google.com with ESMTPS id d132-v6si164691qka.364.2018.05.24.20.50.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 May 2018 20:50:36 -0700 (PDT) Received-SPF: pass (google.com: domain of ming.lei@redhat.com designates 66.187.233.73 as permitted sender) client-ip=66.187.233.73; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 66.187.233.73 as permitted sender) smtp.mailfrom=ming.lei@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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:'' X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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) {