From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753107AbdHJMQR (ORCPT ); Thu, 10 Aug 2017 08:16:17 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:45152 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752745AbdHJMQP (ORCPT ); Thu, 10 Aug 2017 08:16:15 -0400 Date: Thu, 10 Aug 2017 05:16:12 -0700 From: Christoph Hellwig To: Ming Lei Cc: Jens Axboe , Christoph Hellwig , Huang Ying , Andrew Morton , Alexander Viro , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v3 37/49] fs/mpage: convert to bio_for_each_segment_all_sp() Message-ID: <20170810121612.GG14607@infradead.org> References: <20170808084548.18963-1-ming.lei@redhat.com> <20170808084548.18963-38-ming.lei@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170808084548.18963-38-ming.lei@redhat.com> User-Agent: Mutt/1.8.3 (2017-05-23) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > struct bio_vec *bv; > + struct bvec_iter_all bia; > int i; > > - bio_for_each_segment_all(bv, bio, i) { > + bio_for_each_segment_all_sp(bv, bio, i, bia) { > struct page *page = bv->bv_page; > page_endio(page, op_is_write(bio_op(bio)), > blk_status_to_errno(bio->bi_status)); Hmm. Going back to my previous comment about implementing the single page variants on top of multipage - I wonder if we should simply do that in the callers, e.g. something like: bio_for_each_segment_all(bv, bio, i) { bvec_for_each_page(page, bv, j) { page_endio(page, op_is_write(bio_op(bio)), blk_status_to_errno(bio->bi_status)); } } with additional helpers to get the length and offset for the page, e.g. bvec_page_offset(bv, idx) bvev_page_len(bv, idx) While this is a little more code in the callers it's a lot easier to understand.