From patchwork Tue Dec 27 16:05:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9489529 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 E3FBB601D2 for ; Tue, 27 Dec 2016 16:09:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D602A200E7 for ; Tue, 27 Dec 2016 16:09:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA96125E13; Tue, 27 Dec 2016 16:09:04 +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=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87DBD200E7 for ; Tue, 27 Dec 2016 16:09:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933111AbcL0QHj (ORCPT ); Tue, 27 Dec 2016 11:07:39 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:33889 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933088AbcL0QH0 (ORCPT ); Tue, 27 Dec 2016 11:07:26 -0500 Received: by mail-pg0-f66.google.com with SMTP id b1so12809327pgc.1; Tue, 27 Dec 2016 08:07:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6LSRiXmZsU/jpIHgDaW0jTDPeIp8wPFnJm23UeFXG5Y=; b=TAFbp0Zzd7UEHU3rs94RxBdRuBtBwWDe0Ft4zEKQFgi3KSZe2MvxXBBdFypLxOQuTK ZlYMQSvCz31yEemmbwKJbT/HWrImNERtL+WvRSDJS7M9pQgNNFalR2SpAV5DyWjYAtV+ MGkcwr+vjY4V378haSccEKPIFqK/u+xJanMcy46X8UE6obfgF6gsbAIi+UTstPOMsF/r eoeYTzuO31PcjkA0CfREPfUjcvX/XLCmQEn7s3k7Ldsn/AmLXtcuVzWY4ddtGN8PTeUn u9J9SzFy37jzA7ck6HiA/r7Bcn+X0hHZ8LB/oInu8TXxwV+4/4iZB/J+b2kkezfMiPZQ NhKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6LSRiXmZsU/jpIHgDaW0jTDPeIp8wPFnJm23UeFXG5Y=; b=GYrgEmJJZyoPDXarPtWriA91uXtooWX1AV/Z2MiFE1lLkmSg/h3kQaRrd86z1wcmKM 8IJt9jPidcMpGRsIerDz1Ybvyr1IXTdKj+Y4RJCZ+ZWuG4cKwAGf5w5p7CYpMyERUKOb bYE29HSEKrSfarz5saIoVCo3cqpXLjQzq54GWfehoUCoY2WHMUuGJly44sQlJjmk3YnY HkTa18D2jzHPfWboNJFFdN48DMTc+KcVtQgdIZxcdZBJPU8SVVxng4aXPCrLPRn9dnzX gaX5/Osv18iC0sT4pV+Uk1O4NagIG5K66SbV3xnqGT64XSkIIwiI6E3vCzuwTCsd4d40 U9vA== X-Gm-Message-State: AIkVDXJ5grmZFunQ8TuhoWtEB3/ZBKp8quWSii5GYk7Xu3zUAs4YdggR4ebC4qOqkpltqA== X-Received: by 10.84.136.164 with SMTP id 33mr43155078pll.53.1482854845238; Tue, 27 Dec 2016 08:07:25 -0800 (PST) Received: from localhost ([45.35.47.137]) by smtp.gmail.com with ESMTPSA id z29sm64696448pgc.11.2016.12.27.08.07.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Dec 2016 08:07:24 -0800 (PST) From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org Cc: linux-block@vger.kernel.org, Christoph Hellwig , Ming Lei , Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org (open list:BTRFS FILE SYSTEM) Subject: [PATCH v1 52/54] btrfs: use bvec_get_last_sp to get the last singlepage bvec Date: Wed, 28 Dec 2016 00:05:01 +0800 Message-Id: <1482854706-14128-21-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1482854706-14128-1-git-send-email-tom.leiming@gmail.com> References: <1482854706-14128-1-git-send-email-tom.leiming@gmail.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Preparing for supporting multipage bvec. Signed-off-by: Ming Lei --- fs/btrfs/compression.c | 5 ++++- fs/btrfs/extent_io.c | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index adcf5568f010..485a60923bba 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -448,8 +448,11 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start, static u64 bio_end_offset(struct bio *bio) { struct bio_vec *last = &bio->bi_io_vec[bio->bi_vcnt - 1]; + struct bio_vec uninitialized_var(bv); - return page_offset(last->bv_page) + last->bv_len + last->bv_offset; + bvec_get_last_sp(last, &bv); + + return page_offset(bv.bv_page) + bv.bv_len + bv.bv_offset; } static noinline int add_ra_bio_pages(struct inode *inode, diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 3c021f4dd8bf..4a1c81cee883 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -2733,11 +2733,15 @@ static int __must_check submit_one_bio(struct bio *bio, int mirror_num, { int ret = 0; struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; - struct page *page = bvec->bv_page; struct extent_io_tree *tree = bio->bi_private; + struct bio_vec uninitialized_var(bv); + struct page *page; u64 start; - start = page_offset(page) + bvec->bv_offset; + bvec_get_last_sp(bvec, &bv); + page = bv.bv_page; + + start = page_offset(page) + bv.bv_offset; bio->bi_private = NULL; bio_get(bio);