From patchwork Sat Jun 9 12:29:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 10455561 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 AF00860467 for ; Sat, 9 Jun 2018 12:32:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A0C44223A4 for ; Sat, 9 Jun 2018 12:32:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 951FE223A6; Sat, 9 Jun 2018 12:32:43 +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=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26945223A4 for ; Sat, 9 Jun 2018 12:32:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 306DE6B0273; Sat, 9 Jun 2018 08:32:42 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 28FFD6B0275; Sat, 9 Jun 2018 08:32:42 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 159516B0276; Sat, 9 Jun 2018 08:32:42 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt0-f197.google.com (mail-qt0-f197.google.com [209.85.216.197]) by kanga.kvack.org (Postfix) with ESMTP id DDBC16B0273 for ; Sat, 9 Jun 2018 08:32:41 -0400 (EDT) Received: by mail-qt0-f197.google.com with SMTP id n33-v6so14193903qte.23 for ; Sat, 09 Jun 2018 05:32:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=UM8XIut5nSW+sY1sgqS2zSR/VZngxFRqh5zDaIcYmTE=; b=cNZZJOWVwv59WWfvmPN4+/FdT1D6ErQG8UnH0u/XQUwtx2FKswLPcDDR8xwhJoLht4 Bny0dVXVF07rvh+baYmu3rlIQItAHVzGZAPj9vGhNJ+VEQVHU3r95eYfX8KW9HQf6xIK 2G7Zlu8BvyE9oIStvrpICx69Xdfx4z0o4YsE9KQdb4LT5Ejbeme6q5yllz1+NtE+y/is WPSOrJtSH8NC0xFzDOs1FZlGaozWdKvW8TyY37FBPIVOk9bADenNjvBePw1wKJ69SG9O IFMr6+U4BbF1w9ytUObkZ9RlCPc6D6rRACz+bSO2n74A0sHuwSfon5R5MucbdLpY3tmW Xlzg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 66.187.233.73 as permitted sender) smtp.mailfrom=ming.lei@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: APt69E26IFR+hw/Is9twlx+r8SJTAA1Cr5fUTfWi/g6J53qXowgymoAV T+mNvL5Kd40Iwr6lQfA/vibTchT7iM07b9wzOXWSdGHjAJmdQkfZ/QtTvi+anAV7BiMX2DO24jP 2D2vMsNOIKrI40CIqKKBH6LQQk05hv6Ra0Q4AiNgvOFNtFYFrZbwTrZt1QXR50H5KCw== X-Received: by 2002:a0c:8b4b:: with SMTP id d11-v6mr9026574qvc.241.1528547561697; Sat, 09 Jun 2018 05:32:41 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLSE7jl7vjwoiLkDVsE6mgO03W14oKqS3a7DvzrdMIkbofEeWaeGhXIJr4HQrcK9DFOXfCw X-Received: by 2002:a0c:8b4b:: with SMTP id d11-v6mr9026555qvc.241.1528547561137; Sat, 09 Jun 2018 05:32:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528547561; cv=none; d=google.com; s=arc-20160816; b=Tjj+4FzyCaNAvMXqH4NCewmmzU0fM8yEIla6u+BWPQC0NrnSr3I8yoxm3PvEfrpv6B 8JQoWO+Q3Qackea4JtTGIYJem1F2PZnKuZUyv2bQTWEsf7oqdft5icet9joDTWLpILFI Sep2wU08+LoS08B9658PIgFf27PeiBe19oEFqe9tq4KuF+L1hlv5gjJZDwzgZGyK4Rc1 vTjIsBlsYoHR2p9P/H4eX3nCXyLbtcHC5HRIYkj+0tn6Kksa7kxSHU/KeRMq1NBn9T5g 8ilRmz0oII8MsnyFENj1vURBkCIviHMj48BHth6SMWcYpDpg2yQiu04fJMHM8MNT1B1w b82g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=UM8XIut5nSW+sY1sgqS2zSR/VZngxFRqh5zDaIcYmTE=; b=FA5+xdSeKiRQ22Z5Ckq3lEJlgndwA7UZmP3zDgGDxnc1RcgJUNhk5KEGUUQaB42uCC Y2vkLCT1HzmiXweIKCd2t15CLGONPyZzIh74zTR7DQCyq1CVUmKDlbxnVFEU4YNq4BRo pfjV8NAY2jLTJu38tMeEnPMcSz0wwhqwJiAbSTMnm8PSc7hSYRogSlQgozzAnIzM2Jpe alMv/LKNWXMDd52i/mqo4OPW7Vezsi4faHalWOUx00xy7sfTW9dGtDYydlgqv0yD48pq CkFjo2PRsVw9SNXWzeAAsaw+TzmXASzSCa0qUe4eQXo2aqD5xg8ULTmi3MmOur+Jn8kS DQPg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 66.187.233.73 as permitted sender) smtp.mailfrom=ming.lei@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mx1.redhat.com (mx3-rdu2.redhat.com. [66.187.233.73]) by mx.google.com with ESMTPS id r65-v6si3764378qkh.24.2018.06.09.05.32.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Jun 2018 05:32:41 -0700 (PDT) Received-SPF: pass (google.com: domain of ming.lei@redhat.com designates 66.187.233.73 as permitted sender) client-ip=66.187.233.73; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 66.187.233.73 as permitted sender) smtp.mailfrom=ming.lei@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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:'' X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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;