From patchwork Wed Nov 8 15:20:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 10048667 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 84349603FA for ; Wed, 8 Nov 2017 15:21:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 70EE029569 for ; Wed, 8 Nov 2017 15:21:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 65C142A68D; Wed, 8 Nov 2017 15:21:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0DE5B29569 for ; Wed, 8 Nov 2017 15:21:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 54B652CE94F; Wed, 8 Nov 2017 15:21:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 54B652CE94F Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=kernel.dk Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 54B652CE94F Authentication-Results: mx1.redhat.com; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel-dk.20150623.gappssmtp.com header.i=@kernel-dk.20150623.gappssmtp.com header.b="tD10Ou9F" Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EC1FE60F9A; Wed, 8 Nov 2017 15:21:10 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 39C691800BDC; Wed, 8 Nov 2017 15:21:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vA8FL8Od006373 for ; Wed, 8 Nov 2017 10:21:08 -0500 Received: by smtp.corp.redhat.com (Postfix) id B7CD86C509; Wed, 8 Nov 2017 15:21:08 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AF0986C503 for ; Wed, 8 Nov 2017 15:21:05 +0000 (UTC) Received: from mail-io0-f196.google.com (mail-io0-f196.google.com [209.85.223.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 89FF72C7D2 for ; Wed, 8 Nov 2017 15:21:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 89FF72C7D2 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=kernel.dk Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=axboe@kernel.dk DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 89FF72C7D2 Received: by mail-io0-f196.google.com with SMTP id m16so6321176iod.1 for ; Wed, 08 Nov 2017 07:21:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=r7XznRO64UdYuU57SbiNZDFqbpUMJyneOpkCSe/jw7A=; b=tD10Ou9FePopi45LjLcc0LWWeMOV2ALHaxs1x1Y6yF3SoLwkzlJ28yURXqZcYLrs3/ Vk+U794Orl7JeMwlViDFhVk40q55ZTejVfvSUxt/qEcDPt1T0GnvSpEfgVyG7dlQ3CNx AQonF8mv3JCRmlH0UvFSee3WxE4zGBCxAcw+KgLjn5qdxWY5FuFsD/f3GZ9hvbJbXmPM SMxGEwaOMDT+KZ/jM94mrtmMOz8jCdWW4YgOdJCy804R06Wev3p3q8DV7hzrjJX8lQM8 2RhW5LY9eM/awDcVE/+2SIMeNECaTQK5xUCuK6DJ8XYBpgDIKfALvP94yX2kBwQNM9P4 Knag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=r7XznRO64UdYuU57SbiNZDFqbpUMJyneOpkCSe/jw7A=; b=ry64Dd64z2K9OB94xO1Kf2xN++3VwcvrhFxpcAU10IYN0/NpBeH+1/5f4RYKr2dUv4 WmEmHKiJxI4g82wA//Q/Jc3+aMRixImE2oMW6JY2WhhYBfxpSyBVoeT6I8TnWGkSQQ++ O3uSrnn4T1nQOAE9uUygiN2PF2Y304v0+cIU00oiCzAFxv/mdieLutKQxeGtMoTEo2KH m9s2fvGYEG3ut+a+iaVKN8Hk9CaenaD103/sR9GEwkYnCqY/XaqDmaUWLf/qKwqbPoEE pigURGJs+p+6tN+3Lagb9UAuvzbUuhE4qRmQ7dBJbF2lLEjaN1wPjZeL1RwjmYxskTkO TlSA== X-Gm-Message-State: AJaThX4H9Dxlm3MBwXmyHsb/4Ue2H1EU+FobILGRyPynahGjYex3lWrj nAVYka8M/OPaQf68v8TcS4IAnNGNVEA= X-Google-Smtp-Source: AGs4zMagd+Rvq0rqyF2ilCQF+OYiYfB2tuLILMgnOERKjbtg5F6sj7bMn/khy60qsX4aQ9HY5KkmFg== X-Received: by 10.107.19.232 with SMTP id 101mr1089673iot.286.1510154460415; Wed, 08 Nov 2017 07:21:00 -0800 (PST) Received: from [192.168.1.154] ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id j204sm2326359itj.16.2017.11.08.07.20.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Nov 2017 07:20:59 -0800 (PST) To: Christoph Hellwig , Mikulas Patocka References: <20171108094730.GA7074@infradead.org> <20171108150559.GB10374@infradead.org> From: Jens Axboe Message-ID: <650d7a0d-f344-155a-5b53-4ce368c4aca4@kernel.dk> Date: Wed, 8 Nov 2017 08:20:58 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171108150559.GB10374@infradead.org> Content-Language: en-US X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 08 Nov 2017 15:21:01 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 08 Nov 2017 15:21:01 +0000 (UTC) for IP:'209.85.223.196' DOMAIN:'mail-io0-f196.google.com' HELO:'mail-io0-f196.google.com' FROM:'axboe@kernel.dk' RCPT:'' X-RedHat-Spam-Score: -2.311 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, RCVD_IN_SORBS_SPAM, SPF_PASS) 209.85.223.196 mail-io0-f196.google.com 209.85.223.196 mail-io0-f196.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: dm-devel@redhat.com Cc: linux-block@vger.kernel.org, dm-devel@redhat.com Subject: Re: [dm-devel] [PATCH] bio: have bio_kmap_irq return the size of mapped data (fwd) X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 08 Nov 2017 15:21:12 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP On 11/08/2017 08:05 AM, Christoph Hellwig wrote: > On Wed, Nov 08, 2017 at 07:38:44AM -0500, Mikulas Patocka wrote: >>> To be honest I think we should just remove bio_kmap_irq. It is currently >>> unused and assumes there is only a single bvec to map. >> >> It could be removed from include/linux/bio.h and moved to my driver. But >> if we leave it in bio.h, it could be used by others as well. >> >> bio_kmap_irq can iterate over the whole bio if we use bio_advance on the >> bio. > > The bio_kmap_irq name implies it maps the whole bio, but it only maps > the current segment. Now if there were plenty of users and it was > non-trivial we could say we should fix the name and documentation. > But given how trivial it is I'd rather have you open code it to clearly > document what you are doing. On top of that, there are no users of it at all... Reviewed-by: Christoph Hellwig diff --git a/Documentation/block/biodoc.txt b/Documentation/block/biodoc.txt index 9490f2845f06..01c0a03407cc 100644 --- a/Documentation/block/biodoc.txt +++ b/Documentation/block/biodoc.txt @@ -216,7 +216,7 @@ may need to abort DMA operations and revert to PIO for the transfer, in which case a virtual mapping of the page is required. For SCSI it is also done in some scenarios where the low level driver cannot be trusted to handle a single sg entry correctly. The driver is expected to perform the -kmaps as needed on such occasions using the __bio_kmap_atomic and bio_kmap_irq +kmaps as needed on such occasions using the bio_kmap_irq and friends routines as appropriate. A driver could also use the blk_queue_bounce() routine on its own to bounce highmem i/o to low memory for specific requests if so desired. @@ -1137,7 +1137,7 @@ use dma_map_sg for scatter gather) to be able to ship it to the driver. For PIO drivers (or drivers that need to revert to PIO transfer once in a while (IDE for example)), where the CPU is doing the actual data transfer a virtual mapping is needed. If the driver supports highmem I/O, -(Sec 1.1, (ii) ) it needs to use __bio_kmap_atomic and bio_kmap_irq to +(Sec 1.1, (ii) ) it needs to use __bio_kmap_atomic or similar to temporarily map a bio into the virtual address space. diff --git a/include/linux/bio.h b/include/linux/bio.h index 9c75f58f6a50..1d7e63d7505f 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -573,17 +573,6 @@ static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags) } #endif -static inline char *__bio_kmap_irq(struct bio *bio, struct bvec_iter iter, - unsigned long *flags) -{ - return bvec_kmap_irq(&bio_iter_iovec(bio, iter), flags); -} -#define __bio_kunmap_irq(buf, flags) bvec_kunmap_irq(buf, flags) - -#define bio_kmap_irq(bio, flags) \ - __bio_kmap_irq((bio), (bio)->bi_iter, (flags)) -#define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags) - /* * BIO list management for use by remapping drivers (e.g. DM or MD) and loop. *