From patchwork Sat Jun 9 12:30:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 10455607 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 CB1BD601F7 for ; Sat, 9 Jun 2018 12:34:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB9BA1FF83 for ; Sat, 9 Jun 2018 12:34:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B0795223A6; Sat, 9 Jun 2018 12:34:32 +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 3593C1FF83 for ; Sat, 9 Jun 2018 12:34:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 26AA86B0288; Sat, 9 Jun 2018 08:34:31 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 219FC6B028A; Sat, 9 Jun 2018 08:34:31 -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 130E36B028B; Sat, 9 Jun 2018 08:34:31 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk0-f198.google.com (mail-qk0-f198.google.com [209.85.220.198]) by kanga.kvack.org (Postfix) with ESMTP id DECD76B0288 for ; Sat, 9 Jun 2018 08:34:30 -0400 (EDT) Received: by mail-qk0-f198.google.com with SMTP id c3-v6so15573968qkb.2 for ; Sat, 09 Jun 2018 05:34:30 -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=zutiwBN2cAlkZmzpjD+1KjoNHGj0Me/e4QQ7oq6titc=; b=eWOZAjkSaX/ShdLLKOnwocVuWafxiNR78PmQVEmnL5AzRGPlhLHrwPPrWzfFKy4MgO 6VmothSG6DbC6iYfwC3ESYy2mTcxmVQeAKmX8reZf9dKBDz2o++r5V/WXi9d3oRodOd8 w7bN9P5kjlWCG8Pbr51ufaFxy+Qnodkn2urJhYSw+eUB5QqYMuxoBlD/voVV6VDswQW+ UIfPoDJ+PQlTIc9lw74TypSJmSKdlKxmieQc7c/nz/I7lO/E8NEWNnI3D7SWyhWtROYA 7htxQk041s5NHJIvQr4NsrkHK5m23GwcdNS2Dxw5y9sHwiSw8PXW5myaVY3r8j0Vd2xl e0Bw== 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: APt69E1DX1KvpCRgZxz+p0TZ6gpCUWkNHM8o3rtSKcOIp8FkXUFp7Til eiKRqqDGz9HFKCcjMO5jtMywZPkdECfGugJtkgKJ7UBGsvmZQmL/H33u9jquwcjYEQvmoaTxIoL jku+BihcUNmzMDPINWTlswW21/pRdnBxhVn/dyY8YwUC/URQMO/n4l5EbFtsSOQSGzg== X-Received: by 2002:a37:a8ce:: with SMTP id r197-v6mr8397817qke.93.1528547670715; Sat, 09 Jun 2018 05:34:30 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJcHhncgVbmj5wpSUFR4yspf8RwsErHBj7dkjeESJjm8Xfaa/4rYx0QGatveEAHWA302GdK X-Received: by 2002:a37:a8ce:: with SMTP id r197-v6mr8397802qke.93.1528547670127; Sat, 09 Jun 2018 05:34:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528547670; cv=none; d=google.com; s=arc-20160816; b=wcmHZ0+kUZXu2WUTTGk71lB6lIVwx5XiRaxjPX4wLdcxEHe6UEiCeXWU67znZw9Ytk aiMwSDYIa/17g58IQCnKnFEhm8rUb7oetw18DNxzBT6HzXg5JRsAaGuGHGogMd+9ojMQ iEXg5BXSEycP7s+c/uTSKpO0dDEQZBaKmu7kCUNFpTTP1fgkAvH/+tduFhKpZogLfF+G 8LNmEm6oDrxwvNPCBPT7CEblmKdYdZufQoUH556r7fUdvWYXwq0Gqlth/Eb3Z2himTYb kh8Q1HgQ8ySPsL0D/+gdw6h0ov76EnqiUpcAHEvNkE8MLyXyEwOZ0auF+YYlcmgQZDl0 x/vA== 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=zutiwBN2cAlkZmzpjD+1KjoNHGj0Me/e4QQ7oq6titc=; b=u1SR5IyBJvs86g09/wJFjFVUF6yIKrJ1Zjq7hGNmsWMgWNPVs/AO2iXbUAH+AFIyCP IuT7GuWOklZguWmsyFD15qdaFBng/dV7CoIsAZB66Gkgw4/wYxswJvr7oEBMszeEQ3AO OBu5NEl2UH5Q0/ChpNDh0KjMwVJe7bejsFt4qq8ARub8aGHKre2f48l1nwArqu6F7/Px Ihvd7gKDi/td4VviylZwb4KEfXaQlUXjEHi1Q8iGK5WyQ93o/vfD6VUlDQcKEY8FDbdR hn0psddtxCMZMJpHkoUMcFGxgfSeO6E8/Z8XptXW9Z5893smyo6K0rjaxZvjNWLyEHYg b65g== 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 v51-v6si3744568qta.51.2018.06.09.05.34.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Jun 2018 05:34:30 -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-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C0AB4BB42D; Sat, 9 Jun 2018 12:34:29 +0000 (UTC) Received: from localhost (ovpn-12-40.pek2.redhat.com [10.72.12.40]) by smtp.corp.redhat.com (Postfix) with ESMTP id C7C17210C6D4; Sat, 9 Jun 2018 12:34:23 +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 20/30] fs: conver to bio_for_each_chunk_segment_all() Date: Sat, 9 Jun 2018 20:30:04 +0800 Message-Id: <20180609123014.8861-21-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.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Sat, 09 Jun 2018 12:34:29 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Sat, 09 Jun 2018 12:34:29 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.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 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 --- fs/block_dev.c | 6 ++++-- fs/crypto/bio.c | 3 ++- fs/direct-io.c | 4 +++- fs/iomap.c | 3 ++- fs/mpage.c | 3 ++- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/fs/block_dev.c b/fs/block_dev.c index bef6934b6189..6726f8297a7b 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -197,6 +197,7 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter, ssize_t ret; blk_qc_t qc; int i; + struct bvec_chunk_iter citer; if ((pos | iov_iter_alignment(iter)) & (bdev_logical_block_size(bdev) - 1)) @@ -242,7 +243,7 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter, } __set_current_state(TASK_RUNNING); - bio_for_each_segment_all(bvec, &bio, i) { + bio_for_each_chunk_segment_all(bvec, &bio, i, citer) { if (should_dirty && !PageCompound(bvec->bv_page)) set_page_dirty_lock(bvec->bv_page); put_page(bvec->bv_page); @@ -309,8 +310,9 @@ static void blkdev_bio_end_io(struct bio *bio) } else { struct bio_vec *bvec; int i; + struct bvec_chunk_iter citer; - bio_for_each_segment_all(bvec, bio, i) + bio_for_each_chunk_segment_all(bvec, bio, i, citer) put_page(bvec->bv_page); bio_put(bio); } diff --git a/fs/crypto/bio.c b/fs/crypto/bio.c index 0d5e6a569d58..13bcbdbf3440 100644 --- a/fs/crypto/bio.c +++ b/fs/crypto/bio.c @@ -37,8 +37,9 @@ static void completion_pages(struct work_struct *work) struct bio *bio = ctx->r.bio; struct bio_vec *bv; int i; + struct bvec_chunk_iter citer; - bio_for_each_segment_all(bv, bio, i) { + bio_for_each_chunk_segment_all(bv, bio, i, citer) { struct page *page = bv->bv_page; int ret = fscrypt_decrypt_page(page->mapping->host, page, PAGE_SIZE, 0, page->index); diff --git a/fs/direct-io.c b/fs/direct-io.c index 093fb54cd316..8f7fd985450a 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -551,7 +551,9 @@ static blk_status_t dio_bio_complete(struct dio *dio, struct bio *bio) if (dio->is_async && dio->op == REQ_OP_READ && dio->should_dirty) { bio_check_pages_dirty(bio); /* transfers ownership */ } else { - bio_for_each_segment_all(bvec, bio, i) { + struct bvec_chunk_iter citer; + + bio_for_each_chunk_segment_all(bvec, bio, i, citer) { struct page *page = bvec->bv_page; if (dio->op == REQ_OP_READ && !PageCompound(page) && diff --git a/fs/iomap.c b/fs/iomap.c index 206539d369a8..dbc35c40a1c4 100644 --- a/fs/iomap.c +++ b/fs/iomap.c @@ -934,8 +934,9 @@ static void iomap_dio_bio_end_io(struct bio *bio) } else { struct bio_vec *bvec; int i; + struct bvec_chunk_iter citer; - bio_for_each_segment_all(bvec, bio, i) + bio_for_each_chunk_segment_all(bvec, bio, i, citer) put_page(bvec->bv_page); bio_put(bio); } diff --git a/fs/mpage.c b/fs/mpage.c index b7e7f570733a..78b372607650 100644 --- a/fs/mpage.c +++ b/fs/mpage.c @@ -48,8 +48,9 @@ static void mpage_end_io(struct bio *bio) { struct bio_vec *bv; int i; + struct bvec_chunk_iter citer; - bio_for_each_segment_all(bv, bio, i) { + bio_for_each_chunk_segment_all(bv, bio, i, citer) { struct page *page = bv->bv_page; page_endio(page, op_is_write(bio_op(bio)), blk_status_to_errno(bio->bi_status));