Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1976063imm; Sat, 9 Jun 2018 05:34:05 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKSDar/QHlMErrUGk1fShhcsLzDBy2K8kQbGPs5E9zFdpch39tU+awjRJID27S+ZUqM2tM1 X-Received: by 2002:a63:7a03:: with SMTP id v3-v6mr8420906pgc.285.1528547645924; Sat, 09 Jun 2018 05:34:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528547645; cv=none; d=google.com; s=arc-20160816; b=H9CPsVASbKOBdu5z0jDFJ3OaaBBHdF9HoVPXMwuVDztv8fIUBY4k+CpBBB3Ixnyz4G zCF9ZchlTsITst2P6tffCxM/MLkZgg1BMiXHWcn+/CgmkzoYWwJej8zhO5dkkvmHZuDY 5UqVXc+oUUqzyHFpKfi9sVDTW0+tqHTfOgmDZgqWNS02nLpJYI3zf08dzuRbAdnUKhaH U92uRPdTEp3yTxnoUx+HaJ81DpbzV+1cCqWLm40Lg9wGNHsWkSzKlCqx6327+TjSphE1 8SsDTT6xJ5xuxFfSOjYX707sUsGQJqOhKBJu1Cz1JJ43/b/l65izUdSKCm7ojLmTlSri nLsw== 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=UM8XIut5nSW+sY1sgqS2zSR/VZngxFRqh5zDaIcYmTE=; b=o9NWDjbrk8E9miw1F+mGVBrnwVfCjpfFb+8hOWiijc6Tn5VKAsvY0TLPSxegpSC11N RBfHnNKJYkMqMAdaOwAzaQgE2WV1zljqfjaqmMKEzP3fX6W2gKgmWvGXbZ5BuZDtaOJM Lx80wpEegMeT/F56QG1P8yVhXLZz6i4bCk/WVoyKAIrO8oJRxIVsZHlRkTXIkv/Z/G5l zN1uITocXj1waNaLqS3e6T5658xFSvH/BbRJ2glXFmAFb8a4J7u8V2sLnZiMOmXSewEN fsge96P4JKQFpmilMpuBdp4w+HzdaghgQmYUP2QfMFT1U0kpvYhx9G8isuuRjcEdTLAm iDvA== 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 j15-v6si31079681pga.252.2018.06.09.05.33.51; Sat, 09 Jun 2018 05:34:05 -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 S1753435AbeFIMco (ORCPT + 99 others); Sat, 9 Jun 2018 08:32:44 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:42104 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753215AbeFIMcl (ORCPT ); Sat, 9 Jun 2018 08:32:41 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AB8F7BB43A; Sat, 9 Jun 2018 12:32:40 +0000 (UTC) Received: from localhost (ovpn-12-40.pek2.redhat.com [10.72.12.40]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4B2D51116709; Sat, 9 Jun 2018 12:32:28 +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 , Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org Subject: [PATCH V6 10/30] btrfs: use chunk_last_segment to get bio's last page Date: Sat, 9 Jun 2018 20:29:54 +0800 Message-Id: <20180609123014.8861-11-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.3 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:32:40 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Sat, 09 Jun 2018 12:32:40 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.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..02da66acc57d 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; + chunk_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 51fc015c7d2c..efb8db0fd73c 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; + chunk_last_segment(bvec, &bv); + start = page_offset(bv.bv_page) + bv.bv_offset; bio->bi_private = NULL; -- 2.9.5