From patchwork Tue Nov 7 21:45:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikulas Patocka X-Patchwork-Id: 10047273 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 C69A860360 for ; Tue, 7 Nov 2017 21:45:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B9F2929020 for ; Tue, 7 Nov 2017 21:45:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEC9829223; Tue, 7 Nov 2017 21:45:22 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 530B329020 for ; Tue, 7 Nov 2017 21:45:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755909AbdKGVpV (ORCPT ); Tue, 7 Nov 2017 16:45:21 -0500 Received: from mx1.redhat.com ([209.132.183.28]:32079 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755754AbdKGVpU (ORCPT ); Tue, 7 Nov 2017 16:45:20 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B31B6C049D4E; Tue, 7 Nov 2017 21:45:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B31B6C049D4E Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=mpatocka@redhat.com Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 90FBC5D6AE; Tue, 7 Nov 2017 21:45:18 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id vA7LjIUn002107; Tue, 7 Nov 2017 16:45:18 -0500 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id vA7LjHu5002104; Tue, 7 Nov 2017 16:45:17 -0500 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Tue, 7 Nov 2017 16:45:17 -0500 (EST) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Jens Axboe cc: linux-block@vger.kernel.org, dm-devel@redhat.com Subject: [PATCH] bio: have bio_kmap_irq return the size of mapped data (fwd) Message-ID: User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 07 Nov 2017 21:45:20 +0000 (UTC) Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi I need the function bio_kmap_irq in the driver that I am developing, but it doesn't return the size of the mapped data. I've made this patch to fix it. Mikulas From: Mikulas Patocka The function bio_kmap_irq is not usable because it does not return the size of the mapped data. Fix bio_kmap_irq and __bio_kmap_irq so that they return the size of mapped data. Signed-off-by: Mikulas Patocka Signed-off-by: Mike Snitzer --- include/linux/bio.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) Index: linux-2.6/include/linux/bio.h =================================================================== --- linux-2.6.orig/include/linux/bio.h +++ linux-2.6/include/linux/bio.h @@ -576,14 +576,16 @@ static inline void bvec_kunmap_irq(char #endif static inline char *__bio_kmap_irq(struct bio *bio, struct bvec_iter iter, - unsigned long *flags) + unsigned long *flags, unsigned *size) { - return bvec_kmap_irq(&bio_iter_iovec(bio, iter), flags); + struct bio_vec bv = bio_iter_iovec(bio, iter); + *size = bv.bv_len; + return bvec_kmap_irq(&bv, 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_kmap_irq(bio, flags, size) \ + __bio_kmap_irq((bio), (bio)->bi_iter, (flags), (size)) #define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags) /*