From patchwork Wed May 24 23:34:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13254652 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AAC1C7EE31 for ; Wed, 24 May 2023 23:34:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229527AbjEXXeW (ORCPT ); Wed, 24 May 2023 19:34:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232342AbjEXXeV (ORCPT ); Wed, 24 May 2023 19:34:21 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE9CB12B; Wed, 24 May 2023 16:34:19 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34ONUTXd012706; Wed, 24 May 2023 23:34:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=Arl852qeVvHDG0pqkOTsxY/WsVUKuZpNa9BcJBtkj+U=; b=y1plxDL8LKkrdWDajyMWQqXHZGSDKrKrLOprDKcy+hzrtGpXjrKoIu7AjmcWmz+BVJIC oMi4rw6Y2tTE9nIDxiF8ioRtWkRkYd35IJizFPGFrcW5zab0gq3pay9atBwOBhkeEYi8 L0iuDyioQJNMxTDzrtwNXMdgaALn6Fqj93aYWCJ4OmPOQK7esfkAqi7utDrxN5tCQt0F CJnco8vYrNTp5AA4xn0Cw/sELpuYvkjnZGH7AsA9VABEjDYCHS3jhYupROubVMEKpAuK 6rDYTvPI2YhKIVH5cQd07xTuPKQzEEedwahIqWqSvnOoAaICfna4+vLAVMe+4VTMdFL8 KA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qsva4806d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 24 May 2023 23:34:16 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 34OMHrQI028521; Wed, 24 May 2023 23:34:15 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2102.outbound.protection.outlook.com [104.47.70.102]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3qqk2t52hk-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 24 May 2023 23:34:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XDoEaA41C1RVvRVZPVnLsmPyD+Yv7gteJ4PohsTWJYpOx5+DiMgm2K+sRNyDlGkCBGJqRWzIuhj3jQZYKomUb53s7HyV1c9Gbypc+Dtw7mtnzt/l9LC1OmK2iXI9oa5kRxTs0JKUQ67CEx5KkmcF5pLM1HbhybkYZnbVCV5Kmey9J/u+yT8vtDrV4gkrsznLkvl0bDV+WNEylYdE0be+15Tcq3U6zYnfnqWWNtDN571+58A/khF3BNKWtnWvEUkKjt1YDegSLPWzNNzdR8Kd9ZdEccY/e08zs2SqCxaS7KDx7pPRf+igxyRsHKMVA6nTdK6Ils0DNzhfl6EcC1mu1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Arl852qeVvHDG0pqkOTsxY/WsVUKuZpNa9BcJBtkj+U=; b=gtjlbnd6fkE+Y66IqI6RyMtyTrtg70D3mhGovK3Q0VoiJExU1dVr0CtynG2ZWJaeHxruFdW+13edQwykr1g5n3XPn/9WLkHDycu+kC9PwfT7WKeTeDn59f6t7XLrz8mqwX833FejkxpmlY+xqXbvfMVw2VCyIAI5oKVWWVyb3LIccSrDQZX94+J9SNxSCi67F+Op5vFPo8UwDjnVJAc9VWAqEcgAM1aZadYog9zsYcnfdCjW2DXc4MTjQE9QWi6pRXokc7v2RIcX2Mgnc4+ux4va6i0X/fPNoSyCfW0Yrpg5k13QW6ek++BBXQd+ehU0TFcwOmgdBN1YnNiW57fmwQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Arl852qeVvHDG0pqkOTsxY/WsVUKuZpNa9BcJBtkj+U=; b=Ynmw2NxEJ/+4jkBHVpsJdiBplXi3sTdGTMkGQNPwwrJoD+8m1cePzbWlEHefrLks4FQs5otJB17ulcTLaJickYsvxrJ0QpWRxuUYco488SRnUxNUELcMN5xGtcDPIPaDxHK67SdTGKWAUCxSXsRpFiBRPzfefTbYo/3RAeM40rI= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by BL3PR10MB6114.namprd10.prod.outlook.com (2603:10b6:208:3b9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.14; Wed, 24 May 2023 23:34:12 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6433.015; Wed, 24 May 2023 23:34:12 +0000 From: Mike Christie To: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, stefanha@redhat.com, jasowang@redhat.com, mst@redhat.com, sgarzare@redhat.com, virtualization@lists.linux-foundation.org Cc: Mike Christie Subject: [PATCH 1/3] vhost-scsi: Fix alignment handling with windows Date: Wed, 24 May 2023 18:34:05 -0500 Message-Id: <20230524233407.41432-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230524233407.41432-1-michael.christie@oracle.com> References: <20230524233407.41432-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR07CA0039.namprd07.prod.outlook.com (2603:10b6:5:74::16) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|BL3PR10MB6114:EE_ X-MS-Office365-Filtering-Correlation-Id: 9873608d-a580-40d7-1a04-08db5caf60f3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KeD/nap5Lbun7Dn0QJxuZOP9Ecu3ecQRtkOSrimRLFPUZF8bFFw+kgyVJhhhSGCeYPEsWai+p1Tslv8PQM6YFaOrra5dHqH2UO/L2BITxwfWp9OGnq1Pcvovqn55hT8t/5un/UR75u5x5MZmIyi3nvKb01kFdi4PqkZTmqDB+ijPctNqU7l2LyZnWW5ZEHCNuvTbN/XbSai1PxoN9T/Lts3ao6H7aXszQkEph95qqvolTKSgsPhXJdjd36sOg/Kfnzk46aol78gT91XO33YDoEq3cToPNOJoBjhTKXWGuHaGFadBqUzO/1WbIlPuw98n+ThkSLV9S769QBivUAwaptPbeIOQg+utwz7z9xoyudi3JekKFJUdzhCP0QrGdoZGyoiGDx5WaZeybec8fQMEu/zd2uX6PqLIPDYIwEWP38nfmx1iaervsJUhvtsVdqYfv8cksSUZnlTcwBncb1b+yEY5KolULtxNcdmmdm5wpMim5vrweciyn98u7yqwEFMbOvPiJLTUvwASTNO/wHuTnCx+BqiwbTmjriuGRx50zQQ0zW2PXx9YzQS2vVk3193l X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(376002)(396003)(346002)(136003)(39860400002)(451199021)(2906002)(5660300002)(8936002)(8676002)(316002)(41300700001)(66556008)(4326008)(66476007)(478600001)(66946007)(6486002)(36756003)(6666004)(6512007)(6506007)(26005)(2616005)(1076003)(86362001)(38100700002)(186003)(107886003)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eucvvrRp92lVZUx1Bh+HIzbr9SokZU5nmtC9vp/jtFmAK6VSWyJeqj+i+o6mMRf44ui5NJtci2XpCAweGZkd0b00N6DFGQx1oWZDEk9TZOxX1Mv+OgbJfGz9kxptbD3vnqafefwY7mIfjAZWwXjYH0NcTCmnYhW1kyyQTcJNg25hebJ5mUALGKAVJBwjZoadfL8NwbdDStv/uzO8Vfvm/vPYoesBqORgzZng0b5gM5ao/y2xmXF1bd0EdK4PAZGqowwxp+152Uzvmwv3bMQ8wTYRVAU4aM29fhPW1KqZ2KjnN+oub8Le61cz72HUIxa1qpYMR/Plh5r4M1WzvseQu3vQBdBqtoozd04Q5ATGA7ppLB5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8cThoh92rvfzpVQMDHxWL1Miy4zA3EOeJfEl3OzZxPk= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9873608d-a580-40d7-1a04-08db5caf60f3 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2023 23:34:12.0364 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Y3oAjYgTPFTjcne9nWW1eZ695vHdHBKJEp/Kb2DW5EXovX+XLMFvMbms2nyT0nxCMrFjfEaszdATlLSURduaDXbY4Wy4srSZMdEBzTgZSG8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR10MB6114 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-24_16,2023-05-24_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 malwarescore=0 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305240197 X-Proofpoint-GUID: QaTvh_86HisHrpzg8WckD52uzClHfiaD X-Proofpoint-ORIG-GUID: QaTvh_86HisHrpzg8WckD52uzClHfiaD Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org The linux block layer requires bios/requests to have lengths with a 512 byte alignment. Some drivers/layers like dm-crypt and the directi IO code will test for it and just fail. Other drivers like SCSI just assume the requirement is met and will end up in infinte retry loops. The problem for drivers like SCSI is that it uses functions like blk_rq_cur_sectors and blk_rq_sectors which divide the request's length by 512. If there's lefovers then it just gets dropped. But other code in the block/scsi layer may use blk_rq_bytes/blk_rq_cur_bytes and end up thinking there is still data left and try to retry the cmd. We can then end up getting stuck in retry loops where part of the block/scsi thinks there is data left, but other parts think we want to do IOs of zero length. Linux will always check for alignment, but windows will not. When vhost-scsi then translates the iovec it gets from a windows guest to a scatterlist, we can end up with sg items where the sg->length is not divisible by 512 due to the misaligned offset: sg[0].offset = 255; sg[0].length = 3841; sg... sg[N].offset = 0; sg[N].length = 255; When the lio backends then convert the SG to bios or other iovecs, we end up sending them with the same misaligned values and can hit the issues above. This just has us drop down to allocating a temp page and copying the data when this happens. Because this adds a check that needs to loop over the iovec in the main IO path, this patch adds an attribute that can be turned on for just windows. Signed-off-by: Mike Christie --- drivers/vhost/scsi.c | 174 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 151 insertions(+), 23 deletions(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index bb10fa4bb4f6..dbad8fb579eb 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -25,6 +25,8 @@ #include #include #include +#include +#include #include #include #include @@ -75,6 +77,9 @@ struct vhost_scsi_cmd { u32 tvc_prot_sgl_count; /* Saved unpacked SCSI LUN for vhost_scsi_target_queue_cmd() */ u32 tvc_lun; + u32 copied_iov:1; + const void *saved_iter_addr; + struct iov_iter saved_iter; /* Pointer to the SGL formatted memory from virtio-scsi */ struct scatterlist *tvc_sgl; struct scatterlist *tvc_prot_sgl; @@ -107,6 +112,7 @@ struct vhost_scsi_nexus { struct vhost_scsi_tpg { /* Vhost port target portal group tag for TCM */ u16 tport_tpgt; + bool check_io_alignment; /* Used to track number of TPG Port/Lun Links wrt to explict I_T Nexus shutdown */ int tv_tpg_port_count; /* Used for vhost_scsi device reference to tpg_nexus, protected by tv_tpg_mutex */ @@ -328,8 +334,13 @@ static void vhost_scsi_release_cmd_res(struct se_cmd *se_cmd) int i; if (tv_cmd->tvc_sgl_count) { - for (i = 0; i < tv_cmd->tvc_sgl_count; i++) - put_page(sg_page(&tv_cmd->tvc_sgl[i])); + for (i = 0; i < tv_cmd->tvc_sgl_count; i++) { + if (tv_cmd->copied_iov) + __free_page(sg_page(&tv_cmd->tvc_sgl[i])); + else + put_page(sg_page(&tv_cmd->tvc_sgl[i])); + } + kfree(tv_cmd->saved_iter_addr); } if (tv_cmd->tvc_prot_sgl_count) { for (i = 0; i < tv_cmd->tvc_prot_sgl_count; i++) @@ -502,6 +513,27 @@ static void vhost_scsi_evt_work(struct vhost_work *work) mutex_unlock(&vq->mutex); } +static int vhost_scsi_copy_sgl_to_iov(struct vhost_scsi_cmd *cmd) +{ + struct iov_iter *iter = &cmd->saved_iter; + struct scatterlist *sg = cmd->tvc_sgl; + struct page *page; + size_t len; + int i; + + for (i = 0; i < cmd->tvc_sgl_count; i++) { + page = sg_page(&sg[i]); + len = sg[i].length; + + if (copy_page_to_iter(page, 0, len, iter) != len) { + pr_err("Could not copy data. Error %lu\n", len); + return -1; + } + } + + return 0; +} + /* Fill in status and signal that we are done processing this command * * This is scheduled in the vhost work queue so we are called with the owner @@ -525,15 +557,20 @@ static void vhost_scsi_complete_cmd_work(struct vhost_work *work) pr_debug("%s tv_cmd %p resid %u status %#02x\n", __func__, cmd, se_cmd->residual_count, se_cmd->scsi_status); - memset(&v_rsp, 0, sizeof(v_rsp)); - v_rsp.resid = cpu_to_vhost32(cmd->tvc_vq, se_cmd->residual_count); - /* TODO is status_qualifier field needed? */ - v_rsp.status = se_cmd->scsi_status; - v_rsp.sense_len = cpu_to_vhost32(cmd->tvc_vq, - se_cmd->scsi_sense_length); - memcpy(v_rsp.sense, cmd->tvc_sense_buf, - se_cmd->scsi_sense_length); + + if (cmd->saved_iter_addr && vhost_scsi_copy_sgl_to_iov(cmd)) { + v_rsp.response = VIRTIO_SCSI_S_BAD_TARGET; + } else { + v_rsp.resid = cpu_to_vhost32(cmd->tvc_vq, + se_cmd->residual_count); + /* TODO is status_qualifier field needed? */ + v_rsp.status = se_cmd->scsi_status; + v_rsp.sense_len = cpu_to_vhost32(cmd->tvc_vq, + se_cmd->scsi_sense_length); + memcpy(v_rsp.sense, cmd->tvc_sense_buf, + se_cmd->scsi_sense_length); + } iov_iter_init(&iov_iter, ITER_DEST, cmd->tvc_resp_iov, cmd->tvc_in_iovs, sizeof(v_rsp)); @@ -682,7 +719,52 @@ vhost_scsi_iov_to_sgl(struct vhost_scsi_cmd *cmd, bool write, } static int -vhost_scsi_mapal(struct vhost_scsi_cmd *cmd, +vhost_scsi_copy_iov_to_sgl(struct vhost_scsi_cmd *cmd, struct iov_iter *iter, + struct scatterlist *sg, int sg_count) +{ + size_t len = iov_iter_count(iter); + unsigned int nbytes = 0; + struct page *page; + int i; + + if (cmd->tvc_data_direction == DMA_FROM_DEVICE) { + cmd->saved_iter_addr = dup_iter(&cmd->saved_iter, iter, + GFP_KERNEL); + if (!cmd->saved_iter_addr) + return -ENOMEM; + } + + for (i = 0; i < sg_count; i++) { + page = alloc_page(GFP_KERNEL); + if (!page) { + i--; + goto err; + } + + nbytes = min_t(unsigned int, PAGE_SIZE, len); + sg_set_page(&sg[i], page, nbytes, 0); + + if (cmd->tvc_data_direction == DMA_TO_DEVICE && + copy_page_from_iter(page, 0, nbytes, iter) != nbytes) + goto err; + + len -= nbytes; + } + + cmd->copied_iov = 1; + return 0; + +err: + pr_err("Could not read %u bytes\n", nbytes); + + for (; i >= 0; i--) + __free_page(sg_page(&sg[i])); + kfree(cmd->saved_iter_addr); + return -ENOMEM; +} + +static int +vhost_scsi_mapal(struct vhost_scsi_tpg *tpg, struct vhost_scsi_cmd *cmd, size_t prot_bytes, struct iov_iter *prot_iter, size_t data_bytes, struct iov_iter *data_iter) { @@ -703,10 +785,8 @@ vhost_scsi_mapal(struct vhost_scsi_cmd *cmd, ret = vhost_scsi_iov_to_sgl(cmd, write, prot_iter, cmd->tvc_prot_sgl, cmd->tvc_prot_sgl_count); - if (ret < 0) { - cmd->tvc_prot_sgl_count = 0; - return ret; - } + if (ret < 0) + goto map_fail; } sgl_count = vhost_scsi_calc_sgls(data_iter, data_bytes, VHOST_SCSI_PREALLOC_SGLS); @@ -717,14 +797,32 @@ vhost_scsi_mapal(struct vhost_scsi_cmd *cmd, cmd->tvc_sgl_count = sgl_count; pr_debug("%s data_sg %p data_sgl_count %u\n", __func__, cmd->tvc_sgl, cmd->tvc_sgl_count); + /* + * The block layer requires bios/requests to be a multiple of 512 bytes, + * but Windows can send us vecs that are misaligned. This can result + * in bios and later requests with misaligned sizes if we have to break + * up a cmd into multiple bios. + * + * We currently only break up a command into multiple bios if we hit + * the vec/seg limit, so check if our sgl_count is greater than the max + * and if a vec in the cmd has a misaligned size. + */ + if (tpg->check_io_alignment && + (!iov_iter_is_aligned(data_iter, 0, SECTOR_SIZE - 1) && + bio_max_segs(sgl_count) != sgl_count)) + ret = vhost_scsi_copy_iov_to_sgl(cmd, data_iter, cmd->tvc_sgl, + cmd->tvc_sgl_count); + else + ret = vhost_scsi_iov_to_sgl(cmd, write, data_iter, + cmd->tvc_sgl, cmd->tvc_sgl_count); + if (ret) + goto map_fail; - ret = vhost_scsi_iov_to_sgl(cmd, write, data_iter, - cmd->tvc_sgl, cmd->tvc_sgl_count); - if (ret < 0) { - cmd->tvc_sgl_count = 0; - return ret; - } return 0; + +map_fail: + cmd->tvc_sgl_count = 0; + return ret; } static int vhost_scsi_to_tcm_attr(int attr) @@ -1077,7 +1175,7 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq) " %d\n", cmd, exp_data_len, prot_bytes, data_direction); if (data_direction != DMA_NONE) { - if (unlikely(vhost_scsi_mapal(cmd, prot_bytes, + if (unlikely(vhost_scsi_mapal(tpg, cmd, prot_bytes, &prot_iter, exp_data_len, &data_iter))) { vq_err(vq, "Failed to map iov to sgl\n"); @@ -2068,11 +2166,41 @@ static ssize_t vhost_scsi_tpg_attrib_fabric_prot_type_show( return sysfs_emit(page, "%d\n", tpg->tv_fabric_prot_type); } - CONFIGFS_ATTR(vhost_scsi_tpg_attrib_, fabric_prot_type); +static ssize_t +vhost_scsi_tpg_attrib_check_io_alignment_store(struct config_item *item, + const char *page, size_t count) +{ + struct se_portal_group *se_tpg = attrib_to_tpg(item); + struct vhost_scsi_tpg *tpg = container_of(se_tpg, struct vhost_scsi_tpg, + se_tpg); + bool val; + int ret; + + ret = kstrtobool(page, &val); + if (ret) + return ret; + + tpg->check_io_alignment = val; + return count; +} + +static ssize_t +vhost_scsi_tpg_attrib_check_io_alignment_show(struct config_item *item, + char *page) +{ + struct se_portal_group *se_tpg = attrib_to_tpg(item); + struct vhost_scsi_tpg *tpg = container_of(se_tpg, struct vhost_scsi_tpg, + se_tpg); + + return sysfs_emit(page, "%d\n", tpg->check_io_alignment); +} +CONFIGFS_ATTR(vhost_scsi_tpg_attrib_, check_io_alignment); + static struct configfs_attribute *vhost_scsi_tpg_attrib_attrs[] = { &vhost_scsi_tpg_attrib_attr_fabric_prot_type, + &vhost_scsi_tpg_attrib_attr_check_io_alignment, NULL, }; From patchwork Wed May 24 23:34:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13254653 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C2D5C77B7C for ; Wed, 24 May 2023 23:34:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236931AbjEXXeZ (ORCPT ); Wed, 24 May 2023 19:34:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232345AbjEXXeV (ORCPT ); Wed, 24 May 2023 19:34:21 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5970E12E; Wed, 24 May 2023 16:34:20 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34ONUAK8012590; Wed, 24 May 2023 23:34:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=zNGTkb0qGHLPnnFixoUA1fe+n/KEo/VIzkw0P+tj6QI=; b=plcSjt2Y0LYygXdZN1/3xnW3tp75HcsdekvOkyKAAvT5ZZKoBkeFn0ODnMWOpSC2Gpkf eWubmdB4jTrBPTc3gka6vjlNi2JLfgORh/S5x6QgchJ0g8c6yL6Q+QIYMn03SOEVOY7Z kOTwbEzvZyasuFCg1/0P3z/TvmzL47PT8tbYhpCXcGZCn8sC8XLmSPAU1s2kK+WvVdvh gTrSUS00B/FzJOZmnkZq9goGnpb15YRnS/b54QzmMBzOJQFPMRUqsFLpCn+AN/PD4Mr/ BhFYPAUoTdGNFHjGrclycfklCxCwRPylfVyBNuEHRG3j31f2GXh0dYnYT97XWTBw9kWl UQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qsva4806f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 24 May 2023 23:34:16 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 34OMHrQJ028521; Wed, 24 May 2023 23:34:15 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2102.outbound.protection.outlook.com [104.47.70.102]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3qqk2t52hk-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 24 May 2023 23:34:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z3YaLlK0574wwJIky8tvuYB8lRKe++GdcqPHNZvhHT4iQgql8ar65pqJbHGMGkzNrjQPgSli3IHd/sDWxy+t/r8CtWty98z6oEgHF8IeEYgE6dsnkzO1ckPTbo2bJVj5pVwIo2wVZtleFbjkVei5VFGB0Dh6Efe4O6dKFZJgFMAkvjP09pIBo0aLP1nrNomDLEpSOn9qhClUjLFGjcvGGc3LYyjGemxfWAKUGFHhEL9sZHl0eL9FF8nlJ125WSO4GOdVQ7jPjwiT9s+pg8q7X1vS4eqXoi97VmXoRynOnw7/wksTlfPPWhoLKwUmigAR7IK4XzwXd1QOteuAHHkTTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zNGTkb0qGHLPnnFixoUA1fe+n/KEo/VIzkw0P+tj6QI=; b=bqYhXHRl2lo4yWXh9yaILtHJJEJjN5cSlpKnHa8TTL25gfJQd2CpaeU1ItWbPdE2ut2aRBlbZ4aqalah0AQMRAKsqEsBndzv9+X1O605CMS8WyPCc0WN3i8kKzkgC2vj4+nNj4VXvuVxG3doDBHB3/YFiUAEUuedTI/K6r6hX835RoJ7/dDSsvj3bAz2f4TKdkwrg9OoHI2NYqK/me0JqZzpMYCxk/OWCAPCvp/CuZFf4f6gfmUtPigrn87pswDsmKpuK7iTSszcF/PCYroS5G4Qv7BsdzoxNQ2cKcM1W1sYB6kdjBnLwsgr6ZmC3HTKOho/x2m+UWYlGz5Eg4B4pg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zNGTkb0qGHLPnnFixoUA1fe+n/KEo/VIzkw0P+tj6QI=; b=zJmcloAbJFaMqGgZGt02gM0QVBxsXzpaqdxsItlOWFzv5tiAtLMfXpb8pBvkvelbGfEFZMjuAatGcgH2IZ6KBSerpJ/MKItzhuQjz9ceBTXWpeyacjLEmlSZ1TQqLHnjc1TDkiQ4EH+OBEzUMOAh8uD0HGp9tiojetOhmKclC0M= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by BL3PR10MB6114.namprd10.prod.outlook.com (2603:10b6:208:3b9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.14; Wed, 24 May 2023 23:34:14 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6433.015; Wed, 24 May 2023 23:34:14 +0000 From: Mike Christie To: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, stefanha@redhat.com, jasowang@redhat.com, mst@redhat.com, sgarzare@redhat.com, virtualization@lists.linux-foundation.org Cc: Mike Christie Subject: [PATCH 2/3] vhost-scsi: Remove unused write argument Date: Wed, 24 May 2023 18:34:06 -0500 Message-Id: <20230524233407.41432-3-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230524233407.41432-1-michael.christie@oracle.com> References: <20230524233407.41432-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0166.namprd02.prod.outlook.com (2603:10b6:5:332::33) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|BL3PR10MB6114:EE_ X-MS-Office365-Filtering-Correlation-Id: 47bc3b79-5e43-495c-db20-08db5caf622d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: g5WeI+zkcpt34thxLSdr2LJFJph333JzsrIoQ/i4UsSBGAeGOPPVg6o0UotkORjZb3EpovFL767IEsNb9p1rowvNRmlKSfJu5jQ7+/t5WCGZI8OlmPzDlk7PbaorbD5ORbOG4MepIQniAkhifhFZdqN2NV/+RdZaosFclYu9FpAYSxywnjnFG0B4SdMEOw91YwyZJZAua5cH9ucNTHCOrIhB/3cvp8MzE27JQf2ZW+q5XjKNGY9dKYJLiXhZ/xi/Bqr3+1f5Zn3rIlJZ0WyDMnYbEyI6lHOPUkBGjfmiTppLgV45NhnF5/YXOGKF4AfgLFxO4Ax8dqVBuXg0QUUpmyct7+TFPPsdUXH97/zpH1/hIF+RHexpPi11ycjkT0+raMxlJXDHEoRmgP9i5IGdioRgBplj9qcMEIVC+s3Os+GW6qz4vIMhhMEbQgbL7xO9RWLQ0RWEXhWp/uERM9TSR8mIY34hISuUqdrbP0nAD1B8tIStobUMo7InfRrS+9WAb50Dg7+gJLJFWcdNihwnoml+xR6BVIcXEJ9uLTGW7fKBQOrxDMyMrVMtiK6NVe81 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(376002)(396003)(346002)(136003)(39860400002)(451199021)(2906002)(5660300002)(8936002)(8676002)(316002)(41300700001)(66556008)(4326008)(66476007)(478600001)(66946007)(6486002)(36756003)(6666004)(6512007)(6506007)(26005)(2616005)(1076003)(86362001)(38100700002)(186003)(107886003)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Nx4qHruDodSDjRr9z3DjwAWQ9mCKRVRfefVdPii1LXLL75PNRKTV8QRAYkH5unaDxARI6x5nAXOGBI+2r5PAzjbbl4DyIbP2o2AJHAGBZQuufFikWlKRWqDnt4tUriHw9vNG/9VfFPcR7gknM+jSh1WE++q6LAEB8T+oSPtJ5kBmmT2a/NNOT+cibclni20mS2B1oTRkAgFrBOoPTA4ALQ7aOn7drxpOz2PYKpTeqglH4WroNdTp7XkaxA4mnAieris0bjkIO23xhDGARkPfGRcEI2av2JGUnserxl2Ni4Jd6uAyuFNBjqAl0E1Bt9uMSoXD/oMlCDUfgyYei+6e3G45zt8sFEjUsbhrbQtuYPTYm6cOswAp7QiktyVYGrMLrypP/k9VlpwWP2FRkwbe7j56BIfTJ1EeDcjLdhTr5qbwIqESdShOq75nP2AJ9eUSkQAQ1T7DAIz+qBpDTt7iUhmP5XbIHbaucbkqGfsQ7yz78Oo+PNNK8qFCPlTjmtMTJOHO3AAHnZTdqOOJuvgigwFXD/pRK95NILXaJOcJilfqxvz7tXHt3D5sj0PtVFkTJlM6UZxqmxjDKrB0NsxSEPbUd9cShctM1QMakVQpuGD8185TNax9ByafeF2afHy5ld6UfCD3pEHiYzq/N8EY4uflx2dg6D6Rqz4pmS4SVP63yNseDYDZl8R2gFvEd7AMzcTQm5qzNy3ZcRRVjHPXzaXFB4h/Kwfb6S1rolUkTcz2rH7GOL3OuEvCAz0oXHjMI/ErlzY0PdQwuEBWIULd/i8JlhXK580cDWT3HgYTELA70nHBcMNXoppze2yPh7sZ8iAAKs1nCUXN1FhjiP97MjrhdT/+tPC99OXCaWrp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nNktEstlL0VI098vlHIMuqxC8sliT0S5PZ7NVmAu+v52Ks8fpor9BWnZZvXw1qKusB1URW98D8wqErdOh++5lzzHcFYIjoW36WOdhfhVOaCyjj9oHvwmsH3Cyu+IfftHguG9zFXCrgAMJNy11tEMtccClKrBCwk9TQlRXy32JLjJEOCqnPxZ7VLndo9iT9V5EpRZAhHAEhX3AI1NQsxVumsGG3pQJMn7DXcvBHWD7QSPkv3DOjbD7d7WzifHae6Y+sjfDJroJjW8lqsEMWWloceSu2PIZfZ9RqNguVpeEqpmrKYPuKwaFkwCIE9acIdBJXIfkQJxWYMHgTj9NeLtTvjwO4hcdlwwO7g/Mklc73Xs4jPLkXDvcSbVN/IcQcEXBZP9v4CJ5TU+52Im6gNmihg63gvRva1kFiY7EGuF+aXCI6rUe7qa/t8OUIWqgjyu7sQt5rs51A0UHFzTT8ud9SiCxNMIDGnDxf6aXq3n45aUDSVtgdSIvtGnyM/ERLNcEjzuI6pyCTY67i40kgKk1elVcSvEuuN8f2o4JtT8v18zRvT0Arthss1rhl2xQw3GrX+Ipv1QhkFh+m4R/yvGHfRJDrWWO2vA9t0a5/zyDxLyw= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 47bc3b79-5e43-495c-db20-08db5caf622d X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2023 23:34:14.0711 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6yInWM5lJVvBC5o8cFclf7VC/6VlsOOB9bdfi+ihvyN+hLGdYIv0J0JUieAbWHDW8svZoGNonWR6RJD+gjpOuYgdpA16LKrjulMQa4B0lss= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR10MB6114 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-24_16,2023-05-24_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 malwarescore=0 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305240197 X-Proofpoint-GUID: oNBvxRq70xRV-rbI8hbE9cZ9SdFfXr3f X-Proofpoint-ORIG-GUID: oNBvxRq70xRV-rbI8hbE9cZ9SdFfXr3f Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org The write arg that's passed to the mapping functions is not used so remove it. Signed-off-by: Mike Christie --- drivers/vhost/scsi.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index dbad8fb579eb..382158b39740 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -649,10 +649,8 @@ vhost_scsi_get_cmd(struct vhost_virtqueue *vq, struct vhost_scsi_tpg *tpg, * Returns the number of scatterlist entries used or -errno on error. */ static int -vhost_scsi_map_to_sgl(struct vhost_scsi_cmd *cmd, - struct iov_iter *iter, - struct scatterlist *sgl, - bool write) +vhost_scsi_map_to_sgl(struct vhost_scsi_cmd *cmd, struct iov_iter *iter, + struct scatterlist *sgl) { struct page **pages = cmd->tvc_upages; struct scatterlist *sg = sgl; @@ -696,15 +694,14 @@ vhost_scsi_calc_sgls(struct iov_iter *iter, size_t bytes, int max_sgls) } static int -vhost_scsi_iov_to_sgl(struct vhost_scsi_cmd *cmd, bool write, - struct iov_iter *iter, +vhost_scsi_iov_to_sgl(struct vhost_scsi_cmd *cmd, struct iov_iter *iter, struct scatterlist *sg, int sg_count) { struct scatterlist *p = sg; int ret; while (iov_iter_count(iter)) { - ret = vhost_scsi_map_to_sgl(cmd, iter, sg, write); + ret = vhost_scsi_map_to_sgl(cmd, iter, sg); if (ret < 0) { while (p < sg) { struct page *page = sg_page(p++); @@ -769,7 +766,6 @@ vhost_scsi_mapal(struct vhost_scsi_tpg *tpg, struct vhost_scsi_cmd *cmd, size_t data_bytes, struct iov_iter *data_iter) { int sgl_count, ret; - bool write = (cmd->tvc_data_direction == DMA_FROM_DEVICE); if (prot_bytes) { sgl_count = vhost_scsi_calc_sgls(prot_iter, prot_bytes, @@ -782,8 +778,7 @@ vhost_scsi_mapal(struct vhost_scsi_tpg *tpg, struct vhost_scsi_cmd *cmd, pr_debug("%s prot_sg %p prot_sgl_count %u\n", __func__, cmd->tvc_prot_sgl, cmd->tvc_prot_sgl_count); - ret = vhost_scsi_iov_to_sgl(cmd, write, prot_iter, - cmd->tvc_prot_sgl, + ret = vhost_scsi_iov_to_sgl(cmd, prot_iter, cmd->tvc_prot_sgl, cmd->tvc_prot_sgl_count); if (ret < 0) goto map_fail; @@ -813,8 +808,8 @@ vhost_scsi_mapal(struct vhost_scsi_tpg *tpg, struct vhost_scsi_cmd *cmd, ret = vhost_scsi_copy_iov_to_sgl(cmd, data_iter, cmd->tvc_sgl, cmd->tvc_sgl_count); else - ret = vhost_scsi_iov_to_sgl(cmd, write, data_iter, - cmd->tvc_sgl, cmd->tvc_sgl_count); + ret = vhost_scsi_iov_to_sgl(cmd, data_iter, cmd->tvc_sgl, + cmd->tvc_sgl_count); if (ret) goto map_fail; From patchwork Wed May 24 23:34:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13254654 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04C66C77B7A for ; Wed, 24 May 2023 23:34:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237331AbjEXXe0 (ORCPT ); Wed, 24 May 2023 19:34:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236857AbjEXXeX (ORCPT ); Wed, 24 May 2023 19:34:23 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8867699; Wed, 24 May 2023 16:34:22 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34ONQe5K028334; Wed, 24 May 2023 23:34:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=lVtMzFf5PydljQdYfKbIak22kteV7ToFIumrNsqqCyY=; b=BmgklH5pWbLuX671hxV9D6kI1fabsyR5fMpjqvQsaXk7nttmseFIP4O7VcnoKkCzAVJ9 KqrTVip1As3ndO5q0dq7jsEBEBSEP8FayFJfn1rHK94a94DvIImGw/UA1FbK/ugXyxhs 19eVs4nst/2XybBATOVQJJpkM53RK6sm7j99a77Hqs2Tt28nqTX7vDjKxncMwraXL2El wT/DhmfwhcdxbMMeRMQkqNa8/VYrZlpsINPXBaxTO7DNlntQj28YBnePwa+no9IBhqUx VpUU4J6lG5o1a8n1NKvrmXIbhpnx3Ba7G1j1UMY01R3sYedsBdD1Gfx4mq3HGOFoqeZX 0w== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qsux680u8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 24 May 2023 23:34:19 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 34OLBX9d028577; Wed, 24 May 2023 23:34:18 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2102.outbound.protection.outlook.com [104.47.70.102]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3qqk2t52jn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 24 May 2023 23:34:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nGYTCpy1Q2lPtY+7Q6qP/CDfUlzq/h/1LKXnygczS1Fxs5nzvTqMzo+jCRTG2TxUV2UGrwhyWeYrZcq9WgjMUp49Mhu0KcAwlyXWHsn7Ju92IPtLHfU97Il5dRgDLNjNYo3kNSQiMMlmpe2OJI1fiRtGklRDWVJVh0vCwBPcNg+D58QcLy1ga0S/BHrizCTAcTAEMUN1+ANwQY2c1ITuG9gzlnEJVj1Q3QkGakNrYWAMmKxBwsKMFpWdJCNHjbvXXb55pQ+Kf0uKo6zjvYN63vdCMUACzr+zGbH+SysXVOV8WDIvZSkiNrK6xWRlcUm2cjYGD3SbxYvOjf+Z0pXKqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lVtMzFf5PydljQdYfKbIak22kteV7ToFIumrNsqqCyY=; b=itgHSoxlOjOZG9gAyJG+MM00e6OpVliX1Hm/TOBFHyW82hLLx8NAxgalw0dFhjqHNCB62kpiWsO1N2/rQU5YQWHo06UPi3WuseJeT1GbdPMHLzZ+0z8paKRvyYp/gyZ7CruFHuAC7YCetb0hN0mYMY7Pb2LDIETQBeGOrNnkHQQhWDyqraGZw89Ox1loGbupMnIEJxA2D68emIdJQJ6QqREyLoYHRczDk9RJM75NfuX5HKlHkXcdVJutINMeOfLeRhNebshdsCRCpX/HnYLKbsPJroMmKBUwHcEA0Un4WXp7N+2ZMwmN4ovERb0uOtnPf44RPJSkENvMt8peV8NDIA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lVtMzFf5PydljQdYfKbIak22kteV7ToFIumrNsqqCyY=; b=AeIM6dxi+Qz+XUIgpl0zSptKcavbXuqqv6KeUQOtB3wekJ9mUdvNNWJlXBouV0OdkfeTG/v2/qqedXYw+/nBMClY1g9H8y6gzJ7+f7y95jRwchbAuBh3dQpWzv9fOR1E0Ho3PMm4lz8CMwuEGJRcUcXvqvvo2ZnLk4TFYi7IB18= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by BL3PR10MB6114.namprd10.prod.outlook.com (2603:10b6:208:3b9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.14; Wed, 24 May 2023 23:34:16 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6433.015; Wed, 24 May 2023 23:34:15 +0000 From: Mike Christie To: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, stefanha@redhat.com, jasowang@redhat.com, mst@redhat.com, sgarzare@redhat.com, virtualization@lists.linux-foundation.org Cc: Mike Christie Subject: [PATCH 3/3] vhost-scsi: Rename vhost_scsi_iov_to_sgl Date: Wed, 24 May 2023 18:34:07 -0500 Message-Id: <20230524233407.41432-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230524233407.41432-1-michael.christie@oracle.com> References: <20230524233407.41432-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0126.namprd02.prod.outlook.com (2603:10b6:5:1b4::28) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|BL3PR10MB6114:EE_ X-MS-Office365-Filtering-Correlation-Id: cfebc05e-62d2-44f8-3a24-08db5caf6347 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: D0zCIRIIwMi9V/CA+imqjZzfM0EY4mlhpE+iY5bGXbOJP7WLGF4MZsQOl1BTakBfmIiXZR/Xn+fmEAHMm5I/RQgT9QsofOHwB7g/YHgpsfwDq6RkjfFb2gqOZ7T18iqV0OcLpY3tY+P2YR/3SENQQBMxb3+Jz4/aqTz6ztNY31fGepBE1bfd2unLbi5XgMGAf5nmtqZfOLjm+x/MnRlfAfOQtoJJ6otAK9FiCCPzZ4rItzLpDG5rJeoo3C1J9+LUTBXX2KOqDXhg7ajf/NpHr0jdxYn7ObS5SWQ0EnhQMhZVrzckodtg+0OnqHvmnJ6A+CLYICt/ey6gPJo2Wu6DgeXKR4CdqKDz9lXXEkmRlYzazKe21duySyHTcPVHHHTQ/r+2uw03oFZZLA+uMXznWNrF1t1OK004W8YFa2b0GpRYHxB8wvAlbFiDLgHcwOVo25lC7AXZqXnzv+/8KfAwfIyTHg53jbzknkPC+gYg0UxYZUpFmLZpFCAiX0z3BL9JFWUeyc3IFha5STN0A4RKaJybR+WC5AQgX/YAb2XM7bvwt2XtemAmwudKcaD++CFe X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(376002)(396003)(346002)(136003)(39860400002)(451199021)(2906002)(5660300002)(8936002)(8676002)(316002)(41300700001)(66556008)(4326008)(66476007)(478600001)(66946007)(6486002)(36756003)(6666004)(6512007)(6506007)(26005)(2616005)(1076003)(86362001)(38100700002)(186003)(107886003)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Dox5ZzTfSJh/kU4t06QMSO8XScY3FSYXl4BAOm9lb+XNIJAsLKTSU6q5BsQCwb86nlVtY5o/X9j7rjTZQ4pK7GlWP1ChJuJhxz4/4Ro0BUkpJ2G68IVoZKAy7wU0+RCT5zph0HCfKB+hn75i4UDc6oYB4CenIxBsd1BJgM40sJOI/gkVsJDgw/2Br90gUu0MuoRY8kPbQn0cnLm8Wt2rWzeEj1ImtlpdJpCQfWba7sQaYtLtpd6XIJzkAu1DbgQPfHsWRZ3BWCHEXYbuvJ4rRp+6okpRH4FnwW7yhAnXVcMB4DFkP5NjbJ1WZGLdJV3qviw6+eQvP6SN4pRL+wOKn30i6eZKdCOyXZftlp2t3UR8X1I2loYFg6E5OBiizB/V0lb+I9ef29XoLiuYrMkVi3nqETPk/7xjNnOCqEh/XiGDrOl//zBb9orYXrQM9GbEaKXMrvt9w0B4mFiiBUSTv9/zA8WbG3V8/1nlYTUEj8ASkmnoqVG1FzJY2ZSVMY1ronjVbu2P+jMHqCQAmuIh2ehOz+q/zYmq719xxzZId847ZfEA+li+a5fScuo/xQYWmE2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S-Exchange-AntiSpam-ExternalHop-MessageData-0: FxLOzyuWwLYoDqNRZkr30OnnOyKMPdWmG+BFgRTjuOtZmprY7LccryKER9o55dpPaVZ0xonNHqqvSAW/NzBIaa+I3Auq2L4Fau81X+VjUrjxZH0HpjzybKJsOcQLOpESkF5ExRO+XqBkmCHwshl69W48v75BE/vnu5uk8QrZ5+nkatKLPyusTBPqfimSHizHO4S2xM1DVdscmxPqL4byEXVgDVMbeJYfrvopJg+yBVL0XxkaZb7ISCGrdwNteabTPLXLOw7Ynlbxo6oGfJOwBPf6AXPKJCoCtD+nVozWws/60x6T7giHFRKZTOEjONRS7HMNR7SIY82pgbOCUs3cNloXClGogT9VNPT1NHhnYzB8vPPXLkg+Mo2BS9/Pfm64iACwBu05H0YEWvktPSgpvNXWaOlRGjKvc3Zd1ShXfqaDhcuGhjcucy1Ye1gK6Yk6zl4zfCGFGPk47j3fqA43d/IiD2bIllcTCQ0U+oETpoFvY69XramPObIo8sieALSewp7wNM9MSlNpfEzA/jT16uD5zNFq1a7WM578PStCpxr6b5HP5pBNd6Bu5syGYtLO+Bs1i71WRX0YGZYTG3FAT9imZ9lUMiSpVgmxvlUgKZgPTx6V7KstzoWOdJdoQHp03jJmQumriLDZN7DJ3PBvfMnFhbUhYbSFkpdh3l9w6MymZSnPJsPsx8HWlxlGu4BN54QC/w0CY6641A+N/l85qWnjo5LOPKsDo5V4QtDOf+lH3VP/bn6O5TuD6IpZSJXyk795sSZId+A0sNL5Stin9fMpwBLn40coxsQI72MHaK8nMzpBryV4NrZELl9ICQjR5TOkyN7mM5x2ViXj76M8jhvb5HWoSc30HG3Ek4o4WKo= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cfebc05e-62d2-44f8-3a24-08db5caf6347 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2023 23:34:15.8944 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5xHKD/bigCMjfT+NYz0QY/SbeU2oRLiUQuidavG0S2VKJ0vGh0Uer8Nd+8wgfbuY/Ke0iJ3ox12qSqDmrEBTE4ZhIkL0rRGhldGaOBQDeBc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR10MB6114 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-24_16,2023-05-24_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 malwarescore=0 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305240197 X-Proofpoint-GUID: sm_2AP8jjv4HQ69Bs9R53lN-Q-_Z_3xy X-Proofpoint-ORIG-GUID: sm_2AP8jjv4HQ69Bs9R53lN-Q-_Z_3xy Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org Rename vhost_scsi_iov_to_sgl to vhost_scsi_map_iov_to_sgl so it matches matches the naming style used for vhost_scsi_copy_iov_to_sgl. Signed-off-by: Mike Christie --- drivers/vhost/scsi.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 382158b39740..a4d32b96e66a 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -694,8 +694,8 @@ vhost_scsi_calc_sgls(struct iov_iter *iter, size_t bytes, int max_sgls) } static int -vhost_scsi_iov_to_sgl(struct vhost_scsi_cmd *cmd, struct iov_iter *iter, - struct scatterlist *sg, int sg_count) +vhost_scsi_map_iov_to_sgl(struct vhost_scsi_cmd *cmd, struct iov_iter *iter, + struct scatterlist *sg, int sg_count) { struct scatterlist *p = sg; int ret; @@ -778,8 +778,9 @@ vhost_scsi_mapal(struct vhost_scsi_tpg *tpg, struct vhost_scsi_cmd *cmd, pr_debug("%s prot_sg %p prot_sgl_count %u\n", __func__, cmd->tvc_prot_sgl, cmd->tvc_prot_sgl_count); - ret = vhost_scsi_iov_to_sgl(cmd, prot_iter, cmd->tvc_prot_sgl, - cmd->tvc_prot_sgl_count); + ret = vhost_scsi_map_iov_to_sgl(cmd, prot_iter, + cmd->tvc_prot_sgl, + cmd->tvc_prot_sgl_count); if (ret < 0) goto map_fail; } @@ -808,8 +809,8 @@ vhost_scsi_mapal(struct vhost_scsi_tpg *tpg, struct vhost_scsi_cmd *cmd, ret = vhost_scsi_copy_iov_to_sgl(cmd, data_iter, cmd->tvc_sgl, cmd->tvc_sgl_count); else - ret = vhost_scsi_iov_to_sgl(cmd, data_iter, cmd->tvc_sgl, - cmd->tvc_sgl_count); + ret = vhost_scsi_map_iov_to_sgl(cmd, data_iter, cmd->tvc_sgl, + cmd->tvc_sgl_count); if (ret) goto map_fail;