Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7768457imu; Thu, 15 Nov 2018 00:57:54 -0800 (PST) X-Google-Smtp-Source: AJdET5dy2Yrp3mfdfp9ayKpoX9mVjltZVvhrydNmtGaMU4Snalgu+Sx9TEJr7DAiwjgveZ8AdfKM X-Received: by 2002:a17:902:6e08:: with SMTP id u8-v6mr5376723plk.64.1542272273978; Thu, 15 Nov 2018 00:57:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542272273; cv=none; d=google.com; s=arc-20160816; b=hIHiRqbra6zAB68boIVTy0cD//fe3UeLBZB6xEIAy0CZGpFWe0fr4BauQHLlifBpLT 9c5k5Vz3Hqm6EUewNDZ5idM97LasJtDUpnVGpi/ip4AUzR+1qmMNhj1ZUkxC4Bo3T/x8 nAiiJppVK2kr/IVtVIzK5jEUhezH099HrolsCPJ4nFixEpLRlzI/d6t9fie7gmMzR55l vro/tZTlNFgJW8y/o9octqX4hhPG6yMC2eate7xwgYwgxQZbehROBUhm/T8TdZ/DUGVd 6lMR2En7iorQFjgfbtt6XIn/dMen0bVD6mCl+t/ljWhXJ5bzq96TkTO77aXSESmUM5kU y+oQ== 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; bh=sksoPAoBobrodaqFaviy7ZtyOdLgNXqBU8Jp1HYMzKA=; b=LpXOtgiuHmHmzEXwX8DLmA96aqrzeBfEvdfIa34RS8VLfZMstK93d6AVHyr00qjFbd gZZqnmllgC7y4Xzn2mfBs01pI3Gd0fsUlvoLEFT5JNZrioZmC7zPy2b3oJi3sOvcpJ2o hmqbkpyDR7uUhB+KQwgbuH5mG4L/43srpxQyEy+p2jfn02t84Lz6JRiKm+RrZTo6+K2Q XngM0HXY4f7hCReysMZkoQFP+VIjF0rsvxHMSXuHsOr/1skiMyJfZuAXsO7fmcFaQcsF 1rhKAA+E8MmsaLjH+ZxtUX+unSdowAzWemf7nD6GsCm9V8yxwjyf2fHDZqJI6xohIwDm urgQ== 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 x186si19147990pgb.33.2018.11.15.00.57.39; Thu, 15 Nov 2018 00:57:53 -0800 (PST) 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 S2387958AbeKOTCM (ORCPT + 99 others); Thu, 15 Nov 2018 14:02:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51106 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728699AbeKOTCL (ORCPT ); Thu, 15 Nov 2018 14:02:11 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 03E51C045109; Thu, 15 Nov 2018 08:55:17 +0000 (UTC) Received: from localhost (ovpn-8-23.pek2.redhat.com [10.72.8.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7D5ED60C7E; Thu, 15 Nov 2018 08:55:00 +0000 (UTC) From: Ming Lei To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Ming Lei , Dave Chinner , Kent Overstreet , Mike Snitzer , dm-devel@redhat.com, Alexander Viro , linux-fsdevel@vger.kernel.org, Shaohua Li , linux-raid@vger.kernel.org, linux-erofs@lists.ozlabs.org, David Sterba , linux-btrfs@vger.kernel.org, "Darrick J . Wong" , linux-xfs@vger.kernel.org, Gao Xiang , Christoph Hellwig , Theodore Ts'o , linux-ext4@vger.kernel.org, Coly Li , linux-bcache@vger.kernel.org, Boaz Harrosh , Bob Peterson , cluster-devel@redhat.com Subject: [PATCH V10 07/19] btrfs: use bvec_last_segment to get bio's last page Date: Thu, 15 Nov 2018 16:52:54 +0800 Message-Id: <20181115085306.9910-8-ming.lei@redhat.com> In-Reply-To: <20181115085306.9910-1-ming.lei@redhat.com> References: <20181115085306.9910-1-ming.lei@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 15 Nov 2018 08:55:17 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Preparing for supporting multi-page bvec. Cc: Dave Chinner Cc: Kent Overstreet Cc: Mike Snitzer Cc: dm-devel@redhat.com Cc: Alexander Viro Cc: linux-fsdevel@vger.kernel.org Cc: Shaohua Li Cc: linux-raid@vger.kernel.org Cc: linux-erofs@lists.ozlabs.org Cc: David Sterba Cc: linux-btrfs@vger.kernel.org Cc: Darrick J. Wong Cc: linux-xfs@vger.kernel.org Cc: Gao Xiang Cc: Christoph Hellwig Cc: Theodore Ts'o Cc: linux-ext4@vger.kernel.org Cc: Coly Li Cc: linux-bcache@vger.kernel.org Cc: Boaz Harrosh Cc: Bob Peterson Cc: cluster-devel@redhat.com Signed-off-by: Ming Lei --- fs/btrfs/compression.c | 5 ++++- fs/btrfs/extent_io.c | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 2955a4ea2fa8..161e14b8b180 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -400,8 +400,11 @@ blk_status_t btrfs_submit_compressed_write(struct inode *inode, u64 start, static u64 bio_end_offset(struct bio *bio) { struct bio_vec *last = bio_last_bvec_all(bio); + struct bio_vec bv; - return page_offset(last->bv_page) + last->bv_len + last->bv_offset; + bvec_last_segment(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 d228f706ff3e..5d5965297e7e 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -2720,11 +2720,12 @@ static int __must_check submit_one_bio(struct bio *bio, int mirror_num, { blk_status_t ret = 0; struct bio_vec *bvec = bio_last_bvec_all(bio); - struct page *page = bvec->bv_page; + struct bio_vec bv; struct extent_io_tree *tree = bio->bi_private; u64 start; - start = page_offset(page) + bvec->bv_offset; + bvec_last_segment(bvec, &bv); + start = page_offset(bv.bv_page) + bv.bv_offset; bio->bi_private = NULL; -- 2.9.5