From patchwork Wed Dec 16 03:18:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "(Exiting) Baolin Wang" X-Patchwork-Id: 7858691 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7ED4E9F1C2 for ; Wed, 16 Dec 2015 03:19:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A95A72034A for ; Wed, 16 Dec 2015 03:19:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CCB072037C for ; Wed, 16 Dec 2015 03:19:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934032AbbLPDTS (ORCPT ); Tue, 15 Dec 2015 22:19:18 -0500 Received: from mail-pf0-f177.google.com ([209.85.192.177]:33247 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933900AbbLPDTN (ORCPT ); Tue, 15 Dec 2015 22:19:13 -0500 Received: by mail-pf0-f177.google.com with SMTP id e66so4670340pfe.0 for ; Tue, 15 Dec 2015 19:19:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=5nu8uHrhuHMJLxUYl4T/ZzRAPxotL9+i5jmREyGqRKw=; b=QBu0KcTcE8cTNAhXCLlyQaHaqtcnEKtGJY/qcPIJ2USE4vayWVdLSEqdmBjuxGp2uh snqSAeI7adhoJmLcfgKnXGVfxo1QOYPXI8l+ktRtx1GTaRJzWjGuT+E2kecqAx7dRKJN cJ2oENA+bN5L819LNvkQ3rhfGPFV8COONHck0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=5nu8uHrhuHMJLxUYl4T/ZzRAPxotL9+i5jmREyGqRKw=; b=HVNl4I5PEfgvQHr+irNjmOKYaZtaNxXBOeI7ZbDxV5xo+j9SQUO3WnGOz20sAJ9WiT KhOSyk+5qqC9ybQBUk0A3kK7iWY2jQgwl51QZoQzAPalLmkHhxUow6+Bft5Rbd3V8Iud ylmthbKf+Yddfx+qLAJpzSDHaud/OVvG58/rWUKA0LyI3mXn3U7N4B4ah5vLyNam8d9M QUP/9iUWdBGd/ej/KgvVYbz8jH6NCHe3XByJkFnw0J09xrcfjd4OfgoQNpgfV7Z7XuT0 LNKSJyVxiBkPs/LE2NGszM+XhL8PeeiLvGKDEDEGaF7Px1c800Sh65I3RbU8EEgNmt14 jOPA== X-Gm-Message-State: ALoCoQkRevh+WjAjD9/v1ntiZ3p/yvZ1rXuSnKCEl04zSVTHotO2Q7x7OY6AijuyFZTFgdRpag37LlF47hiHPLesiJWl4gUWpw== X-Received: by 10.98.70.68 with SMTP id t65mr2077898pfa.119.1450235952822; Tue, 15 Dec 2015 19:19:12 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by smtp.gmail.com with ESMTPSA id sy5sm5369338pac.5.2015.12.15.19.19.08 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 15 Dec 2015 19:19:12 -0800 (PST) From: Baolin Wang To: axboe@kernel.dk, agk@redhat.com, snitzer@redhat.com, dm-devel@redhat.com Cc: neilb@suse.com, dan.j.williams@intel.com, martin.petersen@oracle.com, sagig@mellanox.com, kent.overstreet@gmail.com, keith.busch@intel.com, tj@kernel.org, broonie@kernel.org, arnd@arndb.de, linux-block@vger.kernel.org, linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, baolin.wang@linaro.org Subject: [PATCH v2 1/2] block: Export the __blk_bios_map_sg() to map one bio Date: Wed, 16 Dec 2015 11:18:35 +0800 Message-Id: <224caa7e50b4a4e6ed6292e3fd70cc0bf290588b.1450233399.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In dm-crypt, it need to map one bio to scatterlist for improving the encryption efficiency. Thus this patch exports the __blk_bios_map_sg() function to map one bio with scatterlists. Signed-off-by: Baolin Wang --- block/blk-merge.c | 7 ++++--- include/linux/blkdev.h | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/block/blk-merge.c b/block/blk-merge.c index de5716d8..09cc7c4 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -331,9 +331,9 @@ new_segment: *bvprv = *bvec; } -static int __blk_bios_map_sg(struct request_queue *q, struct bio *bio, - struct scatterlist *sglist, - struct scatterlist **sg) +int __blk_bios_map_sg(struct request_queue *q, struct bio *bio, + struct scatterlist *sglist, + struct scatterlist **sg) { struct bio_vec bvec, bvprv = { NULL }; struct bvec_iter iter; @@ -372,6 +372,7 @@ single_segment: return nsegs; } +EXPORT_SYMBOL(__blk_bios_map_sg); /* * map a request to scatterlist, return number of sg entries setup. Caller diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 3fe27f8..dd8d10f 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1004,6 +1004,9 @@ extern void blk_queue_flush_queueable(struct request_queue *q, bool queueable); extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *); +extern int __blk_bios_map_sg(struct request_queue *q, struct bio *bio, + struct scatterlist *sglist, + struct scatterlist **sg); extern void blk_dump_rq_flags(struct request *, char *); extern long nr_blockdev_pages(void);