From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it1-f194.google.com ([209.85.166.194]:54817 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725847AbeLAHmx (ORCPT ); Sat, 1 Dec 2018 02:42:53 -0500 Received: by mail-it1-f194.google.com with SMTP id i145so407773ita.4 for ; Fri, 30 Nov 2018 12:32:24 -0800 (PST) Subject: Re: [PATCH 24/27] block: implement bio helper to add iter kvec pages to bio From: Jens Axboe To: Al Viro Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-aio@kvack.org, hch@lst.de References: <20181130165646.27341-1-axboe@kernel.dk> <20181130165646.27341-25-axboe@kernel.dk> <20181130192102.GP2217@ZenIV.linux.org.uk> <6e42d763-9c94-6b84-7099-f5ef5964404c@kernel.dk> Message-ID: <1545b364-df01-51e7-1786-56dde7c49b5d@kernel.dk> Date: Fri, 30 Nov 2018 13:32:21 -0700 MIME-Version: 1.0 In-Reply-To: <6e42d763-9c94-6b84-7099-f5ef5964404c@kernel.dk> 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 11/30/18 1:15 PM, Jens Axboe wrote: > On 11/30/18 12:21 PM, 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. > > Then how do you set up a kvec based iter with memory you can safely > DMA to/from? Would this make you happy: if (!is_vmalloc_addr(kv->iov_base)) page = virt_to_page(kv->iov_base); else page = vmalloc_to_page(kv->iov_base); -- Jens Axboe