From patchwork Fri May 25 03:45:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 10426055 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 B0031602D6 for ; Fri, 25 May 2018 03:48:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 326BF293C9 for ; Fri, 25 May 2018 03:48:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 271502942D; Fri, 25 May 2018 03:48:49 +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 A888A293C9 for ; Fri, 25 May 2018 03:48:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 965DD6B029E; Thu, 24 May 2018 23:48:47 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 918346B02A0; Thu, 24 May 2018 23:48:47 -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 804AD6B02A1; Thu, 24 May 2018 23:48:47 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk0-f197.google.com (mail-qk0-f197.google.com [209.85.220.197]) by kanga.kvack.org (Postfix) with ESMTP id 533076B029E for ; Thu, 24 May 2018 23:48:47 -0400 (EDT) Received: by mail-qk0-f197.google.com with SMTP id z1-v6so2915792qki.10 for ; Thu, 24 May 2018 20:48:47 -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=n3wxBQ8kn14OtTpVDbUt2SGymD2IRpdf+cK/9siFBg8=; b=ktdbKKwbZQp6zZOZBQyMxuT03fAP/NKGj1FDBb2Yfy11m2ZzSDY+eMYDBC8upioxWe PyPY3jusuK9Ska85Dg3bY3oaMEKY/zD+YonEcLwvGaRccSJG/NlVT5GJK2SV1EyoHtGE CgW+9nJWV5BTd8TDL5DLKYC9quFq0l18HdG891TvsWt+i/belpJ26yH8O4MMLeWtE3fK omkv9F/DfH9bVmBR1miT8BiM1jelBPpHzEa+02x+gtFlNXbKJ/j0VJdmBVTk4rK+vYgR 1dC1i4+jizJOOC/l4thdzkxPA4KPQ2CRBc7zin3YwEGRRkH5CLsS04imrTeKCvzkPyf4 ACcA== 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: ALKqPwcB2tkMk4lXSbP3tQHNsbib6zzpG/0WSfIMTbVORfiE+7ktGwnb jT9VxXJb9Wc6XiQNvJc8InUXIVx51tJ19vwO/h0Eh8yyURXwJkdEPICxthgVjZ4bv5y9DSAheRi pRlBOtr9rJNSMvv4L/PknHopoZdX1C5vjePYYE0sO5zuxvpOEDTZP9mT3goZsR45tYw== X-Received: by 2002:ac8:7259:: with SMTP id l25-v6mr573701qtp.325.1527220127144; Thu, 24 May 2018 20:48:47 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ6owsI1gevcl5GybeILMVNOnqAWLRiBMqffCmglFmPaQOW5W7n1SOzo9+5M6fssPrJC39v X-Received: by 2002:ac8:7259:: with SMTP id l25-v6mr573686qtp.325.1527220126662; Thu, 24 May 2018 20:48:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527220126; cv=none; d=google.com; s=arc-20160816; b=ZNvxEZL+Fy2irlLemhWc7YeqNvlNBw0EtQ6IwS9nHK7UdbkVmq6lu1FIJowwsKUz89 haTs/q+QKiOQ78+iRvWAM4uTY9qeOFVqTYzJRAc7kV4u3bJ/ajzaTHhaRm7tevmUSooq PZ1UXXeS9G2BgRCTiYBVQHc2/5rXB/xjIoPzfiuof5wtxOWV4m/u6HyGi54cHIc4dvxQ YZun/JeRnHTD0nG3rUmwB1CTCVsf6jjwPAGDHBTaudpV9V+HZ2g7IR1Th/u53RITas2m 3dFKxvQUW/AcJemDphS6qNzYIz8IDKzad6CmRS1+jMI8GNcEPL9IZuLv6CNDpQWJ/5Zy F6bA== 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=n3wxBQ8kn14OtTpVDbUt2SGymD2IRpdf+cK/9siFBg8=; b=BZlkLlx6xwLC8zAEbBt61QKgEW959FyJ5WVMersnFgzla3t7O6cRZ8Ma9pMQOMkjdG GUqN/YyfucBT9q4Oa+7wxajK05GhBPnqaqYyCvsEDIvkcTQe2dNWWbyg+lbKzozYN5oe lxCguzqVJJbFcEeGXEvwCIyBErfoqiFLJ20NbdXxcNroBrR312qjDCNeAIFUCna/Ss+7 qtTipuSrEiPIxkife59T3R82Vpj84qmYOVMatKZrFgWNUQ5xPAqRbZE1O7mjMT8e5m3c P3LII4+dnK0uh2n/7X8eaq/Vjhs5Qr293nTg7wJoLYYsKk9XE1G6UCecNiJAfqY97Wpk RcGg== 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 p65-v6si1182847qka.101.2018.05.24.20.48.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 May 2018 20:48:46 -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-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3F39A4023112; Fri, 25 May 2018 03:48:46 +0000 (UTC) Received: from localhost (ovpn-12-30.pek2.redhat.com [10.72.12.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 400B3200BCBB; Fri, 25 May 2018 03:48:37 +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 , Ming Lei , Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org Subject: [RESEND PATCH V5 10/33] btrfs: use segment_last_page to get bio's last page Date: Fri, 25 May 2018 11:45:58 +0800 Message-Id: <20180525034621.31147-11-ming.lei@redhat.com> In-Reply-To: <20180525034621.31147-1-ming.lei@redhat.com> References: <20180525034621.31147-1-ming.lei@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 25 May 2018 03:48:46 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 25 May 2018 03:48:46 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.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 4ea718bdfb41..be6b09dfd6a7 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; + segment_last_page(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 4f314d87ce4d..3c9c91a1e3e9 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -2731,11 +2731,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; + segment_last_page(bvec, &bv); + start = page_offset(bv.bv_page) + bv.bv_offset; bio->bi_private = NULL;