Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2444193imu; Mon, 19 Nov 2018 00:10:21 -0800 (PST) X-Google-Smtp-Source: AJdET5cpHGQSOd2msaXdjLU798vNQaGyzPboEW1Ub6Ya3TMK2nZWLG8NWQQSN346ceNkJjkWDHwI X-Received: by 2002:a63:5e43:: with SMTP id s64mr19393086pgb.101.1542615021205; Mon, 19 Nov 2018 00:10:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542615021; cv=none; d=google.com; s=arc-20160816; b=qHB0Zkgi9KhfWAxy5y1rLQMv738tafhJ9cbCKCZIsJKCDdJsziMZzDN5RIT5LiEp+v doxakEc/KKVAVzk9HrkazsjGVKHi4EZSy9CZitnQgesjtPBb0VHuh8RsViJJc5OF7Mbk eU1t/5RZh/q6mgJs4xNxKdpskXCpC54lICmTh+f7MkRm5SqR/s2dzXR8htMAr5tG7HKH mrTdsohKkPoBTY5lzuTLmTnZrpsD5WfD6GrZE3JOXbKpK4lhAQGWLuwDnYaTjYE5+qkv xtzoaCsBLF9kgdgpQsNpayoJmRd/PkfdPyX1hJaY0FxZozIv1Z/Pr3/tWQn6Xt8pgdSh 3ZKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=FSHsWxfNIejMLZTo/KVILU8Mi0QWiGMTChz/4acQI4M=; b=IabwpxYDmpf7wqLr9oWBeui3z1uuIYbMO8uQ5LSF5otbvuXQGSjFMRgo9beOcN+iYf 6MEJfgD7fgE5IJhmgnWfiarkjl7MoJvE/VQr6kIoqiITzZtAQzq04CJUk0qBlkLzUj+S w7Irb2WGdrYtuqn22EbCJcUycoWSYN4rWCDwjxz/m9QQGbU87vI0lVbLF7hT9wb8gNd5 xZiKgO5qWefMXu8VJdvKN6nQhb3dCsEyaRCXZow0C97X8dji4dUV4PWCdfDJXd18YuvK 36xvoVq3U1IMt9cravhayvcd/aqG1RLSa+re2LtX1YyC6gifgqKjggnuwxOa5budCAaY fSOg== 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 o3si12885120pgq.139.2018.11.19.00.10.06; Mon, 19 Nov 2018 00:10:21 -0800 (PST) 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 S1726799AbeKSScR (ORCPT + 99 others); Mon, 19 Nov 2018 13:32:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54188 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726348AbeKSScP (ORCPT ); Mon, 19 Nov 2018 13:32:15 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CBA0881F12; Mon, 19 Nov 2018 08:09:23 +0000 (UTC) Received: from ming.t460p (ovpn-8-26.pek2.redhat.com [10.72.8.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7D98F5C63A; Mon, 19 Nov 2018 08:09:04 +0000 (UTC) Date: Mon, 19 Nov 2018 16:09:00 +0800 From: Ming Lei To: Christoph Hellwig Cc: Jens Axboe , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Dave Chinner , Kent Overstreet , Mike Snitzer , dm-devel@redhat.com, Alexander Viro , linux-fsdevel@vger.kernel.org, Shaohua Li , linux-raid@vger.kernel.org, linux-erofs@lists.ozlabs.org, David Sterba , linux-btrfs@vger.kernel.org, "Darrick J . Wong" , linux-xfs@vger.kernel.org, Gao Xiang , Theodore Ts'o , linux-ext4@vger.kernel.org, Coly Li , linux-bcache@vger.kernel.org, Boaz Harrosh , Bob Peterson , cluster-devel@redhat.com Subject: Re: [PATCH V10 07/19] btrfs: use bvec_last_segment to get bio's last page Message-ID: <20181119080854.GD16519@ming.t460p> References: <20181115085306.9910-1-ming.lei@redhat.com> <20181115085306.9910-8-ming.lei@redhat.com> <20181116133710.GF3165@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181116133710.GF3165@lst.de> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 19 Nov 2018 08:09:24 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 16, 2018 at 02:37:10PM +0100, Christoph Hellwig wrote: > On Thu, Nov 15, 2018 at 04:52:54PM +0800, Ming Lei wrote: > > index 2955a4ea2fa8..161e14b8b180 100644 > > --- a/fs/btrfs/compression.c > > +++ b/fs/btrfs/compression.c > > @@ -400,8 +400,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; > > I don't think we need this. If last is a multi-page bvec bv_offset > will already contain the correct offset from the first page. Yeah, it is true for this specific case, looks we can drop this patch. thanks, Ming