From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756072Ab0JKUDK (ORCPT ); Mon, 11 Oct 2010 16:03:10 -0400 Received: from nm15.bullet.mail.ne1.yahoo.com ([98.138.90.78]:31777 "HELO nm15.bullet.mail.ne1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1755956Ab0JKUDI (ORCPT ); Mon, 11 Oct 2010 16:03:08 -0400 X-Yahoo-Newman-Id: 123567.76624.bm@omp1020.mail.ne1.yahoo.com X-Yahoo-SMTP: fzDSGlOswBCWnIOrNw7KwwK1j9PqyNbe5PtLKiS4dDU.UNl_t6bdEZu9tTLW X-YMail-OSG: inblgc8VM1lh1_n0uQ6R69iy6tGq6ftXX8U1SeYUYo3zr1P lgiKDX8uavuwaes1qxOV0RdlUTARYhHKCkNd_rZp9ZZh.DtefNzC_4lgX9hV lKhd4Cf3ClRj20R2_beAHi3A2trw2ouNCVrz325EVuZkw1ny7CWbjq2VastP _9KjSNOxFqXWqyl5Yh7u93ZjGVwoZcnpWXtAfgnxCrYFYGoBGuQkfdjeCm5u OZlFrod6i0QSPOrkIAurZ_L7eSfAsTyoimP3wvQen6S10TE9BLsmIWK3Y7U_ g.af7RDlTSpGKHLJocy9p.hg- X-Yahoo-Newman-Property: ymail-3 Subject: Re: [PATCH 0/4] tcm: Unify virtual subsystem plugin emulation code From: "Nicholas A. Bellinger" To: Christoph Hellwig Cc: linux-scsi , linux-kernel , FUJITA Tomonori , Mike Christie , Hannes Reinecke , James Bottomley , Boaz Harrosh In-Reply-To: <20101010073202.GA16772@lst.de> References: <1286682498-4821-1-git-send-email-nab@linux-iscsi.org> <20101010073202.GA16772@lst.de> Content-Type: text/plain Date: Mon, 11 Oct 2010 12:56:51 -0700 Message-Id: <1286827011.20358.35.camel@haakon2.linux-iscsi.org> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2010-10-10 at 09:32 +0200, Christoph Hellwig wrote: > What you did in this patch is a good step toward getting rid of the > scsi logic in the backend, but it's quite enough yet. For one thing > the backends really shouldn't know anything about scsi commands, so > the call to transport_emulate_control_cdb should happen before even > calling into the backend. Hmmm, good point. I was trying to avoid doing this initially because it adds more complexity when calling ->do_task() in target_core_transport.c __transport_execute_tasks(), but I would agree the tradeoff here to make IBLOCK, FILEIO and RAMDISK subsystem backend code SCSI control CDB emulation independent is worth it. > Second your ->emulate_foo callbacks still > are far too SCSI-specific, e.g. WRITE SAME witht unmap bit and UNMAP > emulation really should just go into a single ->discard callback > for the backend. And instead of calling into the backend again for > readcap emulation just set block_size and size attributs on a per- > device object and let common code handle it. Similarly for inquity > just set the device type and other variables and handle it in common > code. Ok, I think this makes sense and should be easy enough for the cases that have been listed here. However, there are still cases (namely DIF) that containing SCSI specific bits and would still be going into IBLOCK and FILEIO. > That avoid the special se_subsystem_api_cdb vector and simplifies > the code a lot conceptually a lot. Together with calling > transport_emulate_control_cdb directly from core code before going > into ->do_task that does all the required work to make the backends > independent of the scsi protocol, so we could also use it e.g. > for ATA or virtio targets. Makes sense, I will drop struct se_subsystem_api_cdb, et al and post a followup patch series this afternoon. Thanks! --nab