From: John Meneghini <jmeneghi@redhat.com>
To: "Kai Mäkisara" <Kai.Makisara@kolumbus.fi>,
"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, dgilbert@interlog.com
Subject: Re: [RFC PATCH 6/6] scsi: scsi_debug: Reset tape setting at device reset
Date: Thu, 30 Jan 2025 16:58:06 -0500 [thread overview]
Message-ID: <e674e7ff-75d7-4df8-a16f-33484a01a734@redhat.com> (raw)
In-Reply-To: <20250128142250.163901-7-Kai.Makisara@kolumbus.fi>
Reviewed-by: John Meneghini <jmeneghi@redhat.com>
Tested-by: John Meneghini <jmeneghi@redhat.com>
Kai, thank you for your patches. These are much needed improvements to the
scsi_debug tape emulator. With these changes I find that my scsi_debug tests
are now actually useful!
I've created a bunch of improvements to my tape_reset_debug_sg.sh test at:
https://github.com/johnmeneghini/tape_tests/pull/1
These changes to my tape_tests have been tested with and are dependant upon your patches at:
https://lore.kernel.org/linux-scsi/20250128142250.163901-1-Kai.Makisara@kolumbus.fi/T/#t
-and-
https://lore.kernel.org/linux-scsi/20250120194925.44432-1-Kai.Makisara@kolumbus.fi/T/#t
Martin, please merge these patches.
/John
On 1/28/25 9:22 AM, Kai Mäkisara wrote:
> Set tape block size, density and compression to default values when the
> device is reset (either directly or via target, bus or host reset).
>
> Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi>
> ---
> drivers/scsi/scsi_debug.c | 21 ++++++++++++++++++++-
> 1 file changed, 20 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
> index ceacf38cee71..c5d7e8b59ff2 100644
> --- a/drivers/scsi/scsi_debug.c
> +++ b/drivers/scsi/scsi_debug.c
> @@ -6730,6 +6730,20 @@ static int sdebug_fail_lun_reset(struct scsi_cmnd *cmnd)
> return 0;
> }
>
> +static void scsi_tape_reset_clear(struct sdebug_dev_info *devip)
> +{
> + if (sdebug_ptype == TYPE_TAPE) {
> + int i;
> +
> + devip->tape_blksize = TAPE_DEF_BLKSIZE;
> + devip->tape_density = TAPE_DEF_DENSITY;
> + devip->tape_partition = 0;
> + devip->tape_dce = 0;
> + for (i = 0; i < TAPE_MAX_PARTITIONS; i++)
> + devip->tape_location[i] = 0;
> + }
> +}
> +
> static int scsi_debug_device_reset(struct scsi_cmnd *SCpnt)
> {
> struct scsi_device *sdp = SCpnt->device;
> @@ -6743,8 +6757,10 @@ static int scsi_debug_device_reset(struct scsi_cmnd *SCpnt)
> sdev_printk(KERN_INFO, sdp, "%s\n", __func__);
>
> scsi_debug_stop_all_queued(sdp);
> - if (devip)
> + if (devip) {
> set_bit(SDEBUG_UA_POR, devip->uas_bm);
> + scsi_tape_reset_clear(devip);
> + }
>
> if (sdebug_fail_lun_reset(SCpnt)) {
> scmd_printk(KERN_INFO, SCpnt, "fail lun reset 0x%x\n", opcode);
> @@ -6782,6 +6798,7 @@ static int scsi_debug_target_reset(struct scsi_cmnd *SCpnt)
> list_for_each_entry(devip, &sdbg_host->dev_info_list, dev_list) {
> if (devip->target == sdp->id) {
> set_bit(SDEBUG_UA_BUS_RESET, devip->uas_bm);
> + scsi_tape_reset_clear(devip);
> ++k;
> }
> }
> @@ -6813,6 +6830,7 @@ static int scsi_debug_bus_reset(struct scsi_cmnd *SCpnt)
>
> list_for_each_entry(devip, &sdbg_host->dev_info_list, dev_list) {
> set_bit(SDEBUG_UA_BUS_RESET, devip->uas_bm);
> + scsi_tape_reset_clear(devip);
> ++k;
> }
>
> @@ -6836,6 +6854,7 @@ static int scsi_debug_host_reset(struct scsi_cmnd *SCpnt)
> list_for_each_entry(devip, &sdbg_host->dev_info_list,
> dev_list) {
> set_bit(SDEBUG_UA_BUS_RESET, devip->uas_bm);
> + scsi_tape_reset_clear(devip);
> ++k;
> }
> }
prev parent reply other threads:[~2025-01-30 21:58 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-28 14:22 [RFC PATCH 0/6] scsi: scsi_debug: Add more tape support Kai Mäkisara
2025-01-28 14:22 ` [RFC PATCH 1/6] scsi: scsi_debug: First fixes for tapes Kai Mäkisara
2025-01-30 17:58 ` John Meneghini
2025-01-28 14:22 ` [RFC PATCH 2/6] scsi: scsi_debug: Add READ BLOCK LIMITS and modify LOAD " Kai Mäkisara
2025-01-28 17:32 ` Bart Van Assche
2025-01-30 18:01 ` John Meneghini
2025-01-28 14:22 ` [RFC PATCH 3/6] scsi: scsi_debug: Add tape write support with block lengths and 4 bytes of data Kai Mäkisara
2025-01-30 21:45 ` John Meneghini
2025-01-28 14:22 ` [RFC PATCH 4/6] scsi: scsi_debug: Add read support and update locate for tapes Kai Mäkisara
2025-01-30 21:46 ` John Meneghini
2025-01-28 14:22 ` [RFC PATCH 5/6] scsi: scsi_debug: Add compression mode page " Kai Mäkisara
2025-01-30 21:49 ` John Meneghini
2025-01-28 14:22 ` [RFC PATCH 6/6] scsi: scsi_debug: Reset tape setting at device reset Kai Mäkisara
2025-01-30 21:58 ` John Meneghini [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e674e7ff-75d7-4df8-a16f-33484a01a734@redhat.com \
--to=jmeneghi@redhat.com \
--cc=Kai.Makisara@kolumbus.fi \
--cc=dgilbert@interlog.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox