Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp6394353imm; Wed, 27 Jun 2018 07:05:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcK/EDc8Pjboq2IJYzE4FWcV7tirMRQ1FidXNRGKwpnDwqIuEusQAVgg+KWvRmxdQv+RXph X-Received: by 2002:a62:678f:: with SMTP id t15-v6mr2719459pfj.85.1530108311830; Wed, 27 Jun 2018 07:05:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530108311; cv=none; d=google.com; s=arc-20160816; b=pdyl+KJJCQOc5JxyUwqYgZ0RwVygxT4gp0zOcN/r9zdRkm4jzkBU+4u3zlCRXT+rLl Kx2f/T8k7YKyu+a7NZ12k3FwFVtqJZaPNwqchd6PWSN/8VGthMKtnYxv9qyW12NSWR4H KovrgX9+oUdr6zWjFmLxYOliUigCmlqcWjqjGKUw7KlwEtgOEG1z6XyGYye8xGQWyGlx Leo3QXmqBhKXcrnZr/+9i7yuVYsDNtzp5HXRuZ07qZZ3y6jV2jfAgV/0UR713Wzhu9MO 2Qnm+39bGZDZsgEJ98hvUvby/Eq8sNlIRMo6NR+DFhEpvuWJbhyupCcvl7pFqDeqywyF MmWw== 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:arc-authentication-results; bh=fQ3OyhX9o+a4s6wTatPXa5kiYvB/eViMF+DTcFm3wtE=; b=EF/03ZLl6tZKxWmEhPNFKa9k6LeQc3z0yV9omJWXjmn6qZQ+E2RkTWb+8OU5nAdYYd I4qeufs1X6upSQhkn+LPP/NW4ck8tJtKwOkimWaEZ+NuPrcoAMiyki9cv0bwbdfXDn2b /L7zPaIkCPgLaN4WpmF4NtG7tUdAUcCQAQY/Rl2U/jZg0tbJVP8Lfy9sx/BrmdajTIdy uDhBzQhMO8CChdpezAJu5UWboUqHmWSINoqyzQfsyHQ/SgRK1mVEwYwlH3kxp7VWHqrp MHxenl92vDO7ktuwO26r0AVkCDwTC1E9w8tPixRf9JKwTePDVXC+VNbVrFqJ15tmhEWE jMeQ== 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 n29-v6si3920462pfg.227.2018.06.27.07.04.55; Wed, 27 Jun 2018 07:05:11 -0700 (PDT) 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 S965275AbeF0MtQ (ORCPT + 99 others); Wed, 27 Jun 2018 08:49:16 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:60934 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933970AbeF0MtO (ORCPT ); Wed, 27 Jun 2018 08:49:14 -0400 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 081C58163C40; Wed, 27 Jun 2018 12:49:14 +0000 (UTC) Received: from localhost (ovpn-12-44.pek2.redhat.com [10.72.12.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id D15FF1C5B9; Wed, 27 Jun 2018 12:49:01 +0000 (UTC) From: Ming Lei To: Jens Axboe , Christoph Hellwig , Kent Overstreet Cc: David Sterba , Huang Ying , Mike Snitzer , 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 , Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org Subject: [PATCH V7 16/24] btrfs: use bvec_last_segment to get bio's last page Date: Wed, 27 Jun 2018 20:45:40 +0800 Message-Id: <20180627124548.3456-17-ming.lei@redhat.com> In-Reply-To: <20180627124548.3456-1-ming.lei@redhat.com> References: <20180627124548.3456-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.8]); Wed, 27 Jun 2018 12:49:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 27 Jun 2018 12:49:14 +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:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Preparing for supporting multipage bvec. Cc: Chris Mason Cc: Josef Bacik Cc: David Sterba Cc: linux-btrfs@vger.kernel.org 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 d3e447b45bf7..22b9e0e56c7e 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -407,8 +407,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 cce6087d6880..0b5e07723f5f 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -2728,11 +2728,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