Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4833119imm; Mon, 11 Jun 2018 20:42:04 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIKpVMeIjrsI9s22YkZQtP02tlyJJzC/anRTD6/0SogZXHjjvCVAM/yBotliP+EH1S1TAAw X-Received: by 2002:a62:f948:: with SMTP id g8-v6mr1936302pfm.107.1528774923990; Mon, 11 Jun 2018 20:42:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528774923; cv=none; d=google.com; s=arc-20160816; b=tkyBucGA0eBGTCEm7wlXkzfZOz17KXtPUD2vmG/5MpQCSRgWGROSUafdhQaa342WlF zEaEHvPDT4/bUAVl7ke8AN2luBpXDBwS7OISgx5Mf4t3hxV0pyjpOHir7oDt8O9q+7Wn k7KEX1qZFGCx36OpDxLrD/5480p0rU+8lQ4xIdYysUYh5R9sREVds+bA9LETRxUJwSYN +BqImxHSg6flqfGdgayPyjuCJ+ZeFpzLXBB1TFALw3EAMciMQrDQoxQAI6sHbh9vpz+z bBYAm1rUImnZ0qYzqIWj/rnW5jK9wr3PGL0HSdr6KV1a3rqW6sKDZfQpfdyptAEkdhTh RC7A== 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:arc-authentication-results; bh=EJdbVbGNjibwJL7+VrhgI+yp3KhMKP8ZFFzgtsogOuY=; b=FMbELVUCo52/veGLzjM1IcAMyavqbhqTCYhH7GCVg2bvKOuf00eRfVrkm/bib2T8aw 7ZywY+GW9yLsT3ov5uHDxdc5sKSzasnDso/4R/eIFU4kECx51frJu6KwRklI4w5iLemD AZlgbM8XOKcPlJUMOFCQZbzKUsqYhuA+9JXRJ8epHlY9b2saCFr1EEL/5kp21KxeCBFN /vfizXzckUWUw6rmYpDhNvqts53hs+TDsyjwqOk21sPwF5YFLV9neojExQ8ZkxqTHL73 mponHjC/i8y/QpsN5UqWyqN7xdTd0U6FCfTfMBbdf0tPQGg46uBFdaO9hM/fQcQuXDrK 1JBg== 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 t12-v6si30555066pgp.565.2018.06.11.20.41.49; Mon, 11 Jun 2018 20:42:03 -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 S932556AbeFLDYk (ORCPT + 99 others); Mon, 11 Jun 2018 23:24:40 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45682 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753869AbeFLDYi (ORCPT ); Mon, 11 Jun 2018 23:24:38 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CDF777D65F; Tue, 12 Jun 2018 03:24:37 +0000 (UTC) Received: from ming.t460p (ovpn-12-16.pek2.redhat.com [10.72.12.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C6BFA20357CA; Tue, 12 Jun 2018 03:24:24 +0000 (UTC) Date: Tue, 12 Jun 2018 11:24:20 +0800 From: Ming Lei To: Christoph Hellwig Cc: Jens Axboe , Alexander Viro , Kent Overstreet , 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 Subject: Re: [PATCH V6 08/30] block: introduce chunk_last_segment() Message-ID: <20180612032419.GB26412@ming.t460p> References: <20180609123014.8861-1-ming.lei@redhat.com> <20180609123014.8861-9-ming.lei@redhat.com> <20180611171938.GA5101@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180611171938.GA5101@infradead.org> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 12 Jun 2018 03:24:37 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 12 Jun 2018 03:24:37 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.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 On Mon, Jun 11, 2018 at 10:19:38AM -0700, Christoph Hellwig wrote: > I think both callers would be just as easy to understand by using > nth_page() instead of these magic helpers. E.g. for guard_bio_eod: > > unsigned offset = (bv.bv_offset + bv.bv_len); > struct page *page = nth_page(bv.bv_page, offset); The above lines should have been written as: struct page *page = nth_page(bv.bv_page, offset / PAGE_SIZE) but this way may cause 'page' points to the next page of bv's last page if offset == N * PAGE_SIZE. Thanks, Ming