From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-f68.google.com ([209.85.166.68]:35559 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725910AbeLDPZX (ORCPT ); Tue, 4 Dec 2018 10:25:23 -0500 Received: by mail-io1-f68.google.com with SMTP id n9so5868834ioo.2 for ; Tue, 04 Dec 2018 07:25:22 -0800 (PST) Subject: Re: [PATCH 24/27] block: implement bio helper to add iter kvec pages to bio To: Christoph Hellwig , Al Viro Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-aio@kvack.org References: <20181130165646.27341-1-axboe@kernel.dk> <20181130165646.27341-25-axboe@kernel.dk> <20181130192102.GP2217@ZenIV.linux.org.uk> <20181204145513.GH3180@lst.de> From: Jens Axboe Message-ID: <0cc73c45-c75c-dde2-3354-d1ccfd554688@kernel.dk> Date: Tue, 4 Dec 2018 08:25:19 -0700 MIME-Version: 1.0 In-Reply-To: <20181204145513.GH3180@lst.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On 12/4/18 7:55 AM, Christoph Hellwig wrote: > On Fri, Nov 30, 2018 at 07:21:02PM +0000, Al Viro wrote: >> On Fri, Nov 30, 2018 at 09:56:43AM -0700, Jens Axboe wrote: >>> For an ITER_KVEC, we can just iterate the iov and add the pages >>> to the bio directly. >> >>> + page = virt_to_page(kv->iov_base); >>> + size = bio_add_page(bio, page, kv->iov_len, >>> + offset_in_page(kv->iov_base)); >> >> Who said that you *can* do virt_to_page() on those? E.g. vmalloc()'ed >> addresses are fine for ITER_KVEC, etc. > > In this particular case the caller it seems the callers knows what kind > of pages we have, but we need to properly document this at the very least. > > Note that in the completely generic case iov_base could also point to > memory without a struct page at all (e.g. ioremap()ed memory). That's why I went to ITER_BVEC instead, that's much saner for this use case. -- Jens Axboe