From patchwork Wed Jun 27 12:45:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 10491423 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 F40C2602B3 for ; Wed, 27 Jun 2018 12:49:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1D4028D85 for ; Wed, 27 Jun 2018 12:49:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D494228D8A; Wed, 27 Jun 2018 12:49:16 +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 5C69428D85 for ; Wed, 27 Jun 2018 12:49:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 79D286B0286; Wed, 27 Jun 2018 08:49:15 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 7725C6B0288; Wed, 27 Jun 2018 08:49:15 -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 68ABA6B0289; Wed, 27 Jun 2018 08:49:15 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt0-f198.google.com (mail-qt0-f198.google.com [209.85.216.198]) by kanga.kvack.org (Postfix) with ESMTP id 3CDC66B0286 for ; Wed, 27 Jun 2018 08:49:15 -0400 (EDT) Received: by mail-qt0-f198.google.com with SMTP id t23-v6so1791586qto.7 for ; Wed, 27 Jun 2018 05:49:15 -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=fQ3OyhX9o+a4s6wTatPXa5kiYvB/eViMF+DTcFm3wtE=; b=dHsrxlQHLzaCN0YcNyxRGVkEcOftggv6rJfuRg/AGX04g4VUQmdECJ1AixO26RhJx9 bMNRgLScF8sUvQozpPClyZSx66wf6g2zkl9yvjPjLO1J/gVi10VQ9OIJ9QevZ57Tq7vt D5ephtUjFU4ABsAy5NvoKlGwQ8TXbKorhUECNtGdFXhiXSu20GwMTjEysmopzKmCoguP gDakPja4PpcS9NA3EHLxGLC41n40A6uDj7P4jK/d/80W0L7C3aBlFc9nwiG1SV/1mCvl 1HKX4qV7BJczgSzg/hM0ta5QIKfC/fE7PALd+kNg39oK1/xcUeljSrm88csWawxFZR28 //Nw== 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: APt69E2xSIUOR1GjNF3PMbEkngtHfsRayoXOz8X8GVp9esOz7Ik8zlCH xNs96S50PMYVLLFY1s8UOYqfYf3IUkck1pdI3iRzqyRgT18fl1+A6mCaClEr3Q0MFsIi/PCm+QR 97N/gzeAi08cW6YZLD7NTLxYHX51hakYkFZqAzI1muIRPSLN4Wn3Le3/4jiRcGr4evg== X-Received: by 2002:a0c:d112:: with SMTP id a18-v6mr1261032qvh.200.1530103755054; Wed, 27 Jun 2018 05:49:15 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdwR093VgbHA+p0J8P+KYtx0ojBsjF6cl5JujfOoRUHpv5PTyjh+G5h8e9mrq5BjItBNcMQ X-Received: by 2002:a0c:d112:: with SMTP id a18-v6mr1260996qvh.200.1530103754419; Wed, 27 Jun 2018 05:49:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530103754; cv=none; d=google.com; s=arc-20160816; b=ggfyIQ/oSkgGSki/mVtgiTdgIi4TqQ6d3M8eV2gUaXRlIn51WyLaZwRqJ+M6a17lss PQyKU5PurPX6zS7A3X57vnTP3QhSMR4NFDAubIegZQgTZrAuI8+c9EOOEUT1hxAoBwXP gHYqaZ/ILiYz+692+yHmmI5yN8OaE488GOPvAWFzZaTPlNyxdmq1Orl+19u40+At0qh2 vsxPxN9e3Pnjiy8EX11tFpEm1pRsuuqFQbKeGS+FrHkKt3/cSZm+whvff6JhvUMltXgE VcFK0MYnS2f62CyC8G8wyQnJOaAxGU+lGJ4NvTD/jwbAnR/JxVi1bh9a39It1TmPT9b0 ZKFg== 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=fQ3OyhX9o+a4s6wTatPXa5kiYvB/eViMF+DTcFm3wtE=; b=BxTNPSlsj2oQ5XFmPqJN7N4psqwBYjmNh/TeAGE0ebv2miTxJbNTDublhMyT1Z343/ 3AwpxPdPTP2ZctKa6V89Hx2d2yUv+bNhLyXR3ubEUJT0yVRIcCZDx1mfw7kac9NKlsCv Oxj/d365Z2jxi1R5O7YbjZvLjiOORLTIdznF2uD4zu2nMogdm7vT4KKSoSST6ClOTYeR hFEUOXqjJrIZCo28xSEXEfFMc16Z/gVw4l8Qth4JbiZlyJ1GM6/lILhPW3RBBBaFLtuC huCcRinw+ZWP5okEw97WLu5khuzs6G4IloVwmfY6Pv3RDfrjrSl1vVfCfu4PxDopkxYN bDhA== 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 d14-v6si3844380qvb.155.2018.06.27.05.49.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jun 2018 05:49:14 -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-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:'' 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..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;