From: Logan Gunthorpe Subject: [PATCH v2 03/21] libiscsi: Make use of new the sg_map helper function Date: Tue, 25 Apr 2017 12:20:50 -0600 Message-ID: <1493144468-22493-4-git-send-email-logang@deltatee.com> References: <1493144468-22493-1-git-send-email-logang@deltatee.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Cc: Jens Axboe , Chris Leech , "James E.J. Bottomley" , "Martin K. Petersen" , Matthew Wilcox , Greg Kroah-Hartman , Sumit Semwal , Lee Duncan , Ross Zwisler , Dan Williams , Stephen Bates , Logan Gunthorpe , Christoph Hellwig To: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-nvdimm@lists.01.org, linux-scsi@vger.kernel.org, open-iscsi@googlegroups.com, megaraidlinux.pdl@broadcom.com, sparmaintainer@unisys.com, devel@driverdev.osuosl.org, target-devel@vger.kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, dm-devel@redhat.com Return-path: In-Reply-To: <1493144468-22493-1-git-send-email-logang@deltatee.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" List-Id: linux-crypto.vger.kernel.org Q29udmVydCB0aGUga21hcCBhbmQga21hcF9hdG9taWMgdXNlcyB0byB0aGUgc2dfbWFwIGZ1bmN0 aW9uLiBXZSBub3cKc3RvcmUgdGhlIGZsYWdzIGZvciB0aGUga21hcCBpbnN0ZWFkIG9mIGEgYm9v bGVhbiB0byBpbmRpY2F0ZQphdG9taWNpdGl5LiBXZSB1c2UgSVNDU0lfVENQX0lOVEVSTkFMX0VS UiBlcnJvciB0eXBlIHRoYXQgd2FzIHByZXBhcmVkCmVhcmxpZXIgZm9yIHRoaXMuCgpTaWduZWQt b2ZmLWJ5OiBMb2dhbiBHdW50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