From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754379Ab0HRWaO (ORCPT ); Wed, 18 Aug 2010 18:30:14 -0400 Received: from smtp126.sbc.mail.sp1.yahoo.com ([69.147.65.185]:29044 "HELO smtp126.sbc.mail.sp1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751659Ab0HRWaM (ORCPT ); Wed, 18 Aug 2010 18:30:12 -0400 X-Greylist: delayed 399 seconds by postgrey-1.27 at vger.kernel.org; Wed, 18 Aug 2010 18:30:12 EDT X-Yahoo-SMTP: fzDSGlOswBCWnIOrNw7KwwK1j9PqyNbe5PtLKiS4dDU.UNl_t6bdEZu9tTLW X-YMail-OSG: hks1KnAVM1nDorOVZo6CFkRll9Uc2ac17ZV1rG9FGRKb8BU hDrWBigOgZSZYZa6GutHsoIw1px2rNwMuR2CfkNkQdHAZ4D_AP_9BYQEsqOk MniOeI8h6IJEn1GAZtqoLh0p9eqbbZZ.juuuz0OFwWokPModxvbLnHQzFm.r KQLaEFlVkkL7Xjw9SOa2bCdZrHe4SsV1wS__bl8mYuc4el2Lmcv0c8hN_fe4 fYDEaI6vzcXIBC6MgWpXmurllT0gbi.Xbu73cFOJdOkpYc.9zPpEF_sWhRRv 4XukH4cCENSxIxIhJYK6iEGiq0TdBE6CnX4h5UzF3GC_KkuwDWdPAfn4o X-Yahoo-Newman-Property: ymail-3 From: "Nicholas A. Bellinger" To: linux-scsi , linux-kernel Cc: Christoph Hellwig , Jens Axboe , FUJITA Tomonori , Mike Christie , James Bottomley , Hannes Reinecke , Nicholas Bellinger Subject: [PATCH 0/3] tcm: Improvements for struct se_mem <-> SGL mapping logic Date: Wed, 18 Aug 2010 15:23:29 -0700 Message-Id: <1282170209-23460-1-git-send-email-nab@linux-iscsi.org> X-Mailer: git-send-email 1.5.6.5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nicholas Bellinger Greetings hch, Jens and Co, The following are three patches improve the handling of struct scatterlist -> struct se_mem and struct se_mem -> struct scatterlist mapping within the TCM core algorithms. These patches also fix a bug for the struct se_mem -> struct scatterlist case with an underlying struct block_device is reporting max_sectors=255, and when multiple struct tasks carrying an struct se_mem *in_se_mem and u32 *task_offset pointer need to be carried between allocations in transport_generic_get_cdb_count() and for struct se_subsystem_api I/O of struct se_task. The last two commits are difficult decipher without looking at the larger context, which is: Starting in transport_generic_get_cdb_count(), which the generation of N tasks based on enforced max_sectors for a single received CDB in struct se_cmd: http://git.kernel.org/?p=linux/kernel/git/nab/lio-core-2.6.git;a=blob;f=drivers/target/target_core_transport.c;hb=refs/heads/lio-4.0#l6960 then into dev_obj_do_se_mem_map() for an single individual struct se_task: http://git.kernel.org/?p=linux/kernel/git/nab/lio-core-2.6.git;a=blob;f=drivers/target/target_core_seobj.c;hb=refs/heads/lio-4.0#l103 and finally into transport_calc_sg_num() and transport_map_mem_to_sg() respectively to allocate struct se_task->task_sg[] and map the struct se_mem from the per CDB I/O descriptor context in T_TASK(se_cmd)->t_mem_list. This goes into a single struct se_task context mapping into struct se_task->task_sg[], that is then dispatched to individual subsystem plugin I/O via struct se_subsystem_api->do_task(). http://git.kernel.org/?p=linux/kernel/git/nab/lio-core-2.6.git;a=blob;f=drivers/target/target_core_transport.c;hb=refs/heads/lio-4.0#l6553 http://git.kernel.org/?p=linux/kernel/git/nab/lio-core-2.6.git;a=blob;f=drivers/target/target_core_transport.c;hb=refs/heads/lio-4.0#l6857 So far this has been tested on v2.6.35 using TCM_Loop for patch #1, and TCM/IBLOCK + scsi_debug w/ max_sectors 255-251 for the patch #2 and #3. I am going to keep testing this with some various odd numbered max_sectors values with scsi_debug and see if all combinations of SGL -> struct se_mem and struct se_mem -> SGL mapping are working as expected. Best, --nab Nicholas Bellinger (3): tcm: Remove task_offset parameter from transport_map_sg_to_mem() tcm: Make transport_calc_sg_num() properly handle task_offset tcm: Make transport_map_mem_to_sg() properly handle task_offset drivers/target/target_core_transport.c | 212 +++++++++++++------------------ include/target/target_core_transport.h | 2 +- 2 files changed, 90 insertions(+), 124 deletions(-)