From patchwork Thu Jun 27 18:16:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Henrique Cerri X-Patchwork-Id: 1123565 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45ZSm80pTDz9sBp; Fri, 28 Jun 2019 04:17:11 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1hgYxH-0003fY-Ch; Thu, 27 Jun 2019 18:17:07 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1hgYxF-0003e6-LZ for kernel-team@lists.ubuntu.com; Thu, 27 Jun 2019 18:17:05 +0000 Received: from mail-qt1-f198.google.com ([209.85.160.198]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1hgYxF-0000Nv-8S for kernel-team@lists.ubuntu.com; Thu, 27 Jun 2019 18:17:05 +0000 Received: by mail-qt1-f198.google.com with SMTP id s22so3255578qtb.22 for ; Thu, 27 Jun 2019 11:17:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6QJbU90fBPkVagKldf+i8fVWNS2FU9f97T2235E/JMk=; b=RAOYTMgF33R6DXbe98SGTejot+9R4JWR5hSLywkRb+qBxwWSKDf8ZD2EX0tcLb/yN7 qDp48WMLbbbwFcHSYIFYSaNGFY2+FNfOn7SYRcJ2ILiQ9s/sDjfql9ETpyDP4IY6Bswo hiJ6nw9xhtKTgngLljF29/jFYKcYGtEKkNpXrVhg76Iqj+3TIkeHij5oA17n9jfRwQX6 hr1kvaaWqV4yesj+jAYu+AG1SuXmegBzbrkXc0Ek+mDfVa2h5NV/eAFna9UoqbM7+U3q oHHt/udKDlmKCNfK+I8osuj7vCB3Yd880r/XifQgF3HD6233UkjEOQCSxZ37CJV4Na78 slIg== X-Gm-Message-State: APjAAAX0aliqXndGaEypYTR4BV9jDGWrhFmh8z+tdOEOADMmVPMj9vdB 4YtW3uodofdxVF/ODqsKWig0onQE9oBjY8iYB6z/uGNYk+YhDhTSQks1UL7hQriTjdyfNNDUM90 4+BRgxA/ZxmE8ZcGjDZKo9TefwLgAiFT3O2Mmxbnc X-Received: by 2002:a0c:c586:: with SMTP id a6mr4524920qvj.177.1561659424019; Thu, 27 Jun 2019 11:17:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqwSLEy1Lh5KB60IKUtRLvoLTBlRiEBSvTY/TbWwh6IYhEXH41/3mlWZVHDU/i9gMGaQvNLoVA== X-Received: by 2002:a0c:c586:: with SMTP id a6mr4524900qvj.177.1561659423735; Thu, 27 Jun 2019 11:17:03 -0700 (PDT) Received: from gallifrey.lan ([2804:14c:4e3:4a76:fc8a:de0d:44ad:a288]) by smtp.gmail.com with ESMTPSA id k58sm1443903qtc.38.2019.06.27.11.17.02 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 27 Jun 2019 11:17:03 -0700 (PDT) From: Marcelo Henrique Cerri To: kernel-team@lists.ubuntu.com Subject: [x][PATCH 1/3] bio_copy_from_iter(): get rid of copying iov_iter Date: Thu, 27 Jun 2019 15:16:55 -0300 Message-Id: <20190627181657.17808-2-marcelo.cerri@canonical.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190627181657.17808-1-marcelo.cerri@canonical.com> References: <20190627181657.17808-1-marcelo.cerri@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Al Viro BugLink: http://bugs.launchpad.net/bugs/1834499 we want the one passed to it advanced, anyway Signed-off-by: Al Viro (cherry picked from commit 98a09d6106660ec6e69ff2a6fa14039bd504412b) Signed-off-by: Marcelo Henrique Cerri --- NOTE: This commit is only needed for xenial 4.4. --- block/bio.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/block/bio.c b/block/bio.c index 58921797f2e6..2b0c3c08c0b2 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1022,7 +1022,7 @@ static struct bio_map_data *bio_alloc_map_data(unsigned int iov_count, * Copy all pages from iov_iter to bio. * Returns 0 on success, or error on failure. */ -static int bio_copy_from_iter(struct bio *bio, struct iov_iter iter) +static int bio_copy_from_iter(struct bio *bio, struct iov_iter *iter) { int i; struct bio_vec *bvec; @@ -1033,9 +1033,9 @@ static int bio_copy_from_iter(struct bio *bio, struct iov_iter iter) ret = copy_page_from_iter(bvec->bv_page, bvec->bv_offset, bvec->bv_len, - &iter); + iter); - if (!iov_iter_count(&iter)) + if (!iov_iter_count(iter)) break; if (ret < bvec->bv_len) @@ -1234,9 +1234,11 @@ struct bio *bio_copy_user_iov(struct request_queue *q, */ if (((iter->type & WRITE) && (!map_data || !map_data->null_mapped)) || (map_data && map_data->from_user)) { - ret = bio_copy_from_iter(bio, *iter); + ret = bio_copy_from_iter(bio, iter); if (ret) goto cleanup; + } else { + iov_iter_advance(iter, bio->bi_iter.bi_size); } bio->bi_private = bmd;