Date: Mon, 5 Oct 2015 08:42:44 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r288719 - in stable/10: sys/cam/ctl sys/conf sys/modules/ctl usr.bin/ctlstat usr.sbin/ctladm usr.sbin/ctld Message-ID: <201510050842.t958gi4V013771@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Mon Oct 5 08:42:43 2015 New Revision: 288719 URL: https://svnweb.freebsd.org/changeset/base/288719 Log: MFC r286806: Drop "internal" CTL frontend. Its idea was to be a simple initiator and execute several commands from kernel level, but FreeBSD never had consumer for that functionality, while its implementation polluted many unrelated places. Deleted: stable/10/sys/cam/ctl/ctl_frontend_internal.c stable/10/sys/cam/ctl/ctl_frontend_internal.h Modified: stable/10/sys/cam/ctl/README.ctl.txt stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_backend.c stable/10/sys/cam/ctl/ctl_backend_block.c stable/10/sys/cam/ctl/ctl_backend_ramdisk.c stable/10/sys/cam/ctl/ctl_cmd_table.c stable/10/sys/cam/ctl/ctl_error.c stable/10/sys/cam/ctl/ctl_frontend.c stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c stable/10/sys/cam/ctl/ctl_frontend_iscsi.c stable/10/sys/cam/ctl/ctl_ioctl.h stable/10/sys/cam/ctl/ctl_private.h stable/10/sys/cam/ctl/ctl_tpc.c stable/10/sys/cam/ctl/ctl_tpc_local.c stable/10/sys/conf/files stable/10/sys/modules/ctl/Makefile stable/10/usr.bin/ctlstat/ctlstat.c stable/10/usr.sbin/ctladm/ctladm.8 stable/10/usr.sbin/ctladm/ctladm.c stable/10/usr.sbin/ctld/kernel.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/README.ctl.txt ============================================================================== --- stable/10/sys/cam/ctl/README.ctl.txt Mon Oct 5 08:41:32 2015 (r288718) +++ stable/10/sys/cam/ctl/README.ctl.txt Mon Oct 5 08:42:43 2015 (r288719) @@ -366,16 +366,6 @@ This is a CTL frontend port that is also frontend allows for using CTL without any target-capable hardware. So any LUNs you create in CTL are visible via this port. - -ctl_frontend_internal.c -ctl_frontend_internal.h: ------------------------ - -This is a frontend port written for Copan to do some system-specific tasks -that required sending commands into CTL from inside the kernel. This isn't -entirely relevant to FreeBSD in general, but can perhaps be repurposed or -removed later. - ctl_ha.h: -------- Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Mon Oct 5 08:41:32 2015 (r288718) +++ stable/10/sys/cam/ctl/ctl.c Mon Oct 5 08:42:43 2015 (r288719) @@ -72,7 +72,6 @@ __FBSDID("$FreeBSD$"); #include <cam/ctl/ctl_io.h> #include <cam/ctl/ctl.h> #include <cam/ctl/ctl_frontend.h> -#include <cam/ctl/ctl_frontend_internal.h> #include <cam/ctl/ctl_util.h> #include <cam/ctl/ctl_backend.h> #include <cam/ctl/ctl_ioctl.h> @@ -394,9 +393,6 @@ static int ctl_serialize_other_sc_cmd(st static int ctl_ioctl_submit_wait(union ctl_io *io); static void ctl_ioctl_datamove(union ctl_io *io); static void ctl_ioctl_done(union ctl_io *io); -static void ctl_ioctl_hard_startstop_callback(void *arg, - struct cfi_metatask *metatask); -static void ctl_ioctl_bbrread_callback(void *arg,struct cfi_metatask *metatask); static int ctl_ioctl_fill_ooa(struct ctl_lun *lun, uint32_t *cur_fill_num, struct ctl_ooa *ooa_hdr, struct ctl_ooa_entry *kern_entries); @@ -2095,38 +2091,6 @@ ctl_ioctl_done(union ctl_io *io) mtx_unlock(¶ms->ioctl_mtx); } -static void -ctl_ioctl_hard_startstop_callback(void *arg, struct cfi_metatask *metatask) -{ - struct ctl_fe_ioctl_startstop_info *sd_info; - - sd_info = (struct ctl_fe_ioctl_startstop_info *)arg; - - sd_info->hs_info.status = metatask->status; - sd_info->hs_info.total_luns = metatask->taskinfo.startstop.total_luns; - sd_info->hs_info.luns_complete = - metatask->taskinfo.startstop.luns_complete; - sd_info->hs_info.luns_failed = metatask->taskinfo.startstop.luns_failed; - - cv_broadcast(&sd_info->sem); -} - -static void -ctl_ioctl_bbrread_callback(void *arg, struct cfi_metatask *metatask) -{ - struct ctl_fe_ioctl_bbrread_info *fe_bbr_info; - - fe_bbr_info = (struct ctl_fe_ioctl_bbrread_info *)arg; - - mtx_lock(fe_bbr_info->lock); - fe_bbr_info->bbr_info->status = metatask->status; - fe_bbr_info->bbr_info->bbr_status = metatask->taskinfo.bbrread.status; - fe_bbr_info->wakeup_done = 1; - mtx_unlock(fe_bbr_info->lock); - - cv_broadcast(&fe_bbr_info->sem); -} - /* * Returns 0 for success, errno for failure. */ @@ -2726,103 +2690,6 @@ ctl_ioctl(struct cdev *dev, u_long cmd, break; } - case CTL_HARD_START: - case CTL_HARD_STOP: { - struct ctl_fe_ioctl_startstop_info ss_info; - struct cfi_metatask *metatask; - struct mtx hs_mtx; - - mtx_init(&hs_mtx, "HS Mutex", NULL, MTX_DEF); - - cv_init(&ss_info.sem, "hard start/stop cv" ); - - metatask = cfi_alloc_metatask(/*can_wait*/ 1); - if (metatask == NULL) { - retval = ENOMEM; - mtx_destroy(&hs_mtx); - break; - } - - if (cmd == CTL_HARD_START) - metatask->tasktype = CFI_TASK_STARTUP; - else - metatask->tasktype = CFI_TASK_SHUTDOWN; - - metatask->callback = ctl_ioctl_hard_startstop_callback; - metatask->callback_arg = &ss_info; - - cfi_action(metatask); - - /* Wait for the callback */ - mtx_lock(&hs_mtx); - cv_wait_sig(&ss_info.sem, &hs_mtx); - mtx_unlock(&hs_mtx); - - /* - * All information has been copied from the metatask by the - * time cv_broadcast() is called, so we free the metatask here. - */ - cfi_free_metatask(metatask); - - memcpy((void *)addr, &ss_info.hs_info, sizeof(ss_info.hs_info)); - - mtx_destroy(&hs_mtx); - break; - } - case CTL_BBRREAD: { - struct ctl_bbrread_info *bbr_info; - struct ctl_fe_ioctl_bbrread_info fe_bbr_info; - struct mtx bbr_mtx; - struct cfi_metatask *metatask; - - bbr_info = (struct ctl_bbrread_info *)addr; - - bzero(&fe_bbr_info, sizeof(fe_bbr_info)); - - bzero(&bbr_mtx, sizeof(bbr_mtx)); - mtx_init(&bbr_mtx, "BBR Mutex", NULL, MTX_DEF); - - fe_bbr_info.bbr_info = bbr_info; - fe_bbr_info.lock = &bbr_mtx; - - cv_init(&fe_bbr_info.sem, "BBR read cv"); - metatask = cfi_alloc_metatask(/*can_wait*/ 1); - - if (metatask == NULL) { - mtx_destroy(&bbr_mtx); - cv_destroy(&fe_bbr_info.sem); - retval = ENOMEM; - break; - } - metatask->tasktype = CFI_TASK_BBRREAD; - metatask->callback = ctl_ioctl_bbrread_callback; - metatask->callback_arg = &fe_bbr_info; - metatask->taskinfo.bbrread.lun_num = bbr_info->lun_num; - metatask->taskinfo.bbrread.lba = bbr_info->lba; - metatask->taskinfo.bbrread.len = bbr_info->len; - - cfi_action(metatask); - - mtx_lock(&bbr_mtx); - while (fe_bbr_info.wakeup_done == 0) - cv_wait_sig(&fe_bbr_info.sem, &bbr_mtx); - mtx_unlock(&bbr_mtx); - - bbr_info->status = metatask->status; - bbr_info->bbr_status = metatask->taskinfo.bbrread.status; - bbr_info->scsi_status = metatask->taskinfo.bbrread.scsi_status; - memcpy(&bbr_info->sense_data, - &metatask->taskinfo.bbrread.sense_data, - MIN(sizeof(bbr_info->sense_data), - sizeof(metatask->taskinfo.bbrread.sense_data))); - - cfi_free_metatask(metatask); - - mtx_destroy(&bbr_mtx); - cv_destroy(&fe_bbr_info.sem); - - break; - } case CTL_DELAY_IO: { struct ctl_io_delay_info *delay_info; #ifdef CTL_IO_DELAY Modified: stable/10/sys/cam/ctl/ctl_backend.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_backend.c Mon Oct 5 08:41:32 2015 (r288718) +++ stable/10/sys/cam/ctl/ctl_backend.c Mon Oct 5 08:42:43 2015 (r288719) @@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$"); #include <cam/ctl/ctl.h> #include <cam/ctl/ctl_frontend.h> #include <cam/ctl/ctl_backend.h> -#include <cam/ctl/ctl_frontend_internal.h> #include <cam/ctl/ctl_ioctl.h> #include <cam/ctl/ctl_ha.h> #include <cam/ctl/ctl_private.h> Modified: stable/10/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_backend_block.c Mon Oct 5 08:41:32 2015 (r288718) +++ stable/10/sys/cam/ctl/ctl_backend_block.c Mon Oct 5 08:42:43 2015 (r288719) @@ -86,7 +86,6 @@ __FBSDID("$FreeBSD$"); #include <cam/ctl/ctl_io.h> #include <cam/ctl/ctl.h> #include <cam/ctl/ctl_backend.h> -#include <cam/ctl/ctl_frontend_internal.h> #include <cam/ctl/ctl_ioctl.h> #include <cam/ctl/ctl_scsi_all.h> #include <cam/ctl/ctl_error.h> Modified: stable/10/sys/cam/ctl/ctl_backend_ramdisk.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_backend_ramdisk.c Mon Oct 5 08:41:32 2015 (r288718) +++ stable/10/sys/cam/ctl/ctl_backend_ramdisk.c Mon Oct 5 08:42:43 2015 (r288719) @@ -62,7 +62,6 @@ __FBSDID("$FreeBSD$"); #include <cam/ctl/ctl.h> #include <cam/ctl/ctl_util.h> #include <cam/ctl/ctl_backend.h> -#include <cam/ctl/ctl_frontend_internal.h> #include <cam/ctl/ctl_debug.h> #include <cam/ctl/ctl_ioctl.h> #include <cam/ctl/ctl_error.h> Modified: stable/10/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_cmd_table.c Mon Oct 5 08:41:32 2015 (r288718) +++ stable/10/sys/cam/ctl/ctl_cmd_table.c Mon Oct 5 08:42:43 2015 (r288719) @@ -52,7 +52,6 @@ #include <cam/ctl/ctl.h> #include <cam/ctl/ctl_frontend.h> #include <cam/ctl/ctl_backend.h> -#include <cam/ctl/ctl_frontend_internal.h> #include <cam/ctl/ctl_ioctl.h> #include <cam/ctl/ctl_ha.h> #include <cam/ctl/ctl_private.h> Modified: stable/10/sys/cam/ctl/ctl_error.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_error.c Mon Oct 5 08:41:32 2015 (r288718) +++ stable/10/sys/cam/ctl/ctl_error.c Mon Oct 5 08:42:43 2015 (r288719) @@ -57,7 +57,6 @@ __FBSDID("$FreeBSD$"); #include <cam/ctl/ctl_io.h> #include <cam/ctl/ctl.h> #include <cam/ctl/ctl_frontend.h> -#include <cam/ctl/ctl_frontend_internal.h> #include <cam/ctl/ctl_backend.h> #include <cam/ctl/ctl_ioctl.h> #include <cam/ctl/ctl_error.h> Modified: stable/10/sys/cam/ctl/ctl_frontend.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend.c Mon Oct 5 08:41:32 2015 (r288718) +++ stable/10/sys/cam/ctl/ctl_frontend.c Mon Oct 5 08:42:43 2015 (r288719) @@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$"); #include <cam/ctl/ctl_io.h> #include <cam/ctl/ctl.h> #include <cam/ctl/ctl_frontend.h> -#include <cam/ctl/ctl_frontend_internal.h> #include <cam/ctl/ctl_backend.h> /* XXX KDM move defines from ctl_ioctl.h to somewhere else */ #include <cam/ctl/ctl_ioctl.h> Modified: stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c Mon Oct 5 08:41:32 2015 (r288718) +++ stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c Mon Oct 5 08:42:43 2015 (r288719) @@ -64,7 +64,6 @@ __FBSDID("$FreeBSD$"); #include <cam/ctl/ctl_io.h> #include <cam/ctl/ctl.h> #include <cam/ctl/ctl_frontend.h> -#include <cam/ctl/ctl_frontend_internal.h> #include <cam/ctl/ctl_debug.h> #define io_ptr spriv_ptr1 Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Mon Oct 5 08:41:32 2015 (r288718) +++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Mon Oct 5 08:42:43 2015 (r288719) @@ -61,7 +61,6 @@ __FBSDID("$FreeBSD$"); #include <cam/ctl/ctl_backend.h> #include <cam/ctl/ctl_error.h> #include <cam/ctl/ctl_frontend.h> -#include <cam/ctl/ctl_frontend_internal.h> #include <cam/ctl/ctl_debug.h> #include <cam/ctl/ctl_ha.h> #include <cam/ctl/ctl_ioctl.h> Modified: stable/10/sys/cam/ctl/ctl_ioctl.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_ioctl.h Mon Oct 5 08:41:32 2015 (r288718) +++ stable/10/sys/cam/ctl/ctl_ioctl.h Mon Oct 5 08:42:43 2015 (r288719) @@ -92,23 +92,6 @@ struct ctl_ooa_info { ctl_ooa_status status; /* Returned from CTL */ }; -struct ctl_hard_startstop_info { - cfi_mt_status status; - int total_luns; - int luns_complete; - int luns_failed; -}; - -struct ctl_bbrread_info { - int lun_num; /* Passed in to CTL */ - uint64_t lba; /* Passed in to CTL */ - int len; /* Passed in to CTL */ - cfi_mt_status status; /* Returned from CTL */ - cfi_bbrread_status bbr_status; /* Returned from CTL */ - uint8_t scsi_status; /* Returned from CTL */ - struct scsi_sense_data sense_data; /* Returned from CTL */ -}; - typedef enum { CTL_DELAY_TYPE_NONE, CTL_DELAY_TYPE_CONT, @@ -816,10 +799,6 @@ struct ctl_lun_map { #define CTL_DISABLE_PORT _IOW(CTL_MINOR, 0x05, struct ctl_port_entry) #define CTL_DUMP_OOA _IO(CTL_MINOR, 0x06) #define CTL_CHECK_OOA _IOWR(CTL_MINOR, 0x07, struct ctl_ooa_info) -#define CTL_HARD_STOP _IOR(CTL_MINOR, 0x08, \ - struct ctl_hard_startstop_info) -#define CTL_HARD_START _IOR(CTL_MINOR, 0x09, \ - struct ctl_hard_startstop_info) #define CTL_DELAY_IO _IOWR(CTL_MINOR, 0x10, struct ctl_io_delay_info) #define CTL_REALSYNC_GET _IOR(CTL_MINOR, 0x11, int) #define CTL_REALSYNC_SET _IOW(CTL_MINOR, 0x12, int) @@ -827,7 +806,6 @@ struct ctl_lun_map { #define CTL_GETSYNC _IOWR(CTL_MINOR, 0x14, struct ctl_sync_info) #define CTL_GETSTATS _IOWR(CTL_MINOR, 0x15, struct ctl_stats) #define CTL_ERROR_INJECT _IOWR(CTL_MINOR, 0x16, struct ctl_error_desc) -#define CTL_BBRREAD _IOWR(CTL_MINOR, 0x17, struct ctl_bbrread_info) #define CTL_GET_OOA _IOWR(CTL_MINOR, 0x18, struct ctl_ooa) #define CTL_DUMP_STRUCTS _IO(CTL_MINOR, 0x19) #define CTL_GET_PORT_LIST _IOWR(CTL_MINOR, 0x20, struct ctl_port_list) Modified: stable/10/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_private.h Mon Oct 5 08:41:32 2015 (r288718) +++ stable/10/sys/cam/ctl/ctl_private.h Mon Oct 5 08:42:43 2015 (r288719) @@ -47,18 +47,6 @@ #define CTL_PROCESSOR_PRODUCT "CTLPROCESSOR " #define CTL_UNKNOWN_PRODUCT "CTLDEVICE " -struct ctl_fe_ioctl_startstop_info { - struct cv sem; - struct ctl_hard_startstop_info hs_info; -}; - -struct ctl_fe_ioctl_bbrread_info { - struct cv sem; - struct ctl_bbrread_info *bbr_info; - int wakeup_done; - struct mtx *lock; -}; - typedef enum { CTL_IOCTL_INPROG, CTL_IOCTL_DATAMOVE, Modified: stable/10/sys/cam/ctl/ctl_tpc.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_tpc.c Mon Oct 5 08:41:32 2015 (r288718) +++ stable/10/sys/cam/ctl/ctl_tpc.c Mon Oct 5 08:42:43 2015 (r288719) @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include <cam/ctl/ctl_io.h> #include <cam/ctl/ctl.h> #include <cam/ctl/ctl_frontend.h> -#include <cam/ctl/ctl_frontend_internal.h> #include <cam/ctl/ctl_util.h> #include <cam/ctl/ctl_backend.h> #include <cam/ctl/ctl_ioctl.h> Modified: stable/10/sys/cam/ctl/ctl_tpc_local.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_tpc_local.c Mon Oct 5 08:41:32 2015 (r288718) +++ stable/10/sys/cam/ctl/ctl_tpc_local.c Mon Oct 5 08:42:43 2015 (r288719) @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include <cam/ctl/ctl_io.h> #include <cam/ctl/ctl.h> #include <cam/ctl/ctl_frontend.h> -#include <cam/ctl/ctl_frontend_internal.h> #include <cam/ctl/ctl_util.h> #include <cam/ctl/ctl_backend.h> #include <cam/ctl/ctl_ioctl.h> Modified: stable/10/sys/conf/files ============================================================================== --- stable/10/sys/conf/files Mon Oct 5 08:41:32 2015 (r288718) +++ stable/10/sys/conf/files Mon Oct 5 08:42:43 2015 (r288719) @@ -83,7 +83,6 @@ cam/ctl/ctl_backend_ramdisk.c optional c cam/ctl/ctl_cmd_table.c optional ctl cam/ctl/ctl_frontend.c optional ctl cam/ctl/ctl_frontend_cam_sim.c optional ctl -cam/ctl/ctl_frontend_internal.c optional ctl cam/ctl/ctl_frontend_iscsi.c optional ctl cam/ctl/ctl_scsi_all.c optional ctl cam/ctl/ctl_tpc.c optional ctl Modified: stable/10/sys/modules/ctl/Makefile ============================================================================== --- stable/10/sys/modules/ctl/Makefile Mon Oct 5 08:41:32 2015 (r288718) +++ stable/10/sys/modules/ctl/Makefile Mon Oct 5 08:42:43 2015 (r288719) @@ -11,7 +11,6 @@ SRCS+= ctl_backend_ramdisk.c SRCS+= ctl_cmd_table.c SRCS+= ctl_frontend.c SRCS+= ctl_frontend_cam_sim.c -SRCS+= ctl_frontend_internal.c SRCS+= ctl_frontend_iscsi.c SRCS+= ctl_scsi_all.c SRCS+= ctl_tpc.c Modified: stable/10/usr.bin/ctlstat/ctlstat.c ============================================================================== --- stable/10/usr.bin/ctlstat/ctlstat.c Mon Oct 5 08:41:32 2015 (r288718) +++ stable/10/usr.bin/ctlstat/ctlstat.c Mon Oct 5 08:42:43 2015 (r288719) @@ -62,7 +62,6 @@ __FBSDID("$FreeBSD$"); #include <cam/ctl/ctl_io.h> #include <cam/ctl/ctl_scsi_all.h> #include <cam/ctl/ctl_util.h> -#include <cam/ctl/ctl_frontend_internal.h> #include <cam/ctl/ctl_backend.h> #include <cam/ctl/ctl_ioctl.h> Modified: stable/10/usr.sbin/ctladm/ctladm.8 ============================================================================== --- stable/10/usr.sbin/ctladm/ctladm.8 Mon Oct 5 08:41:32 2015 (r288718) +++ stable/10/usr.sbin/ctladm/ctladm.8 Mon Oct 5 08:42:43 2015 (r288719) @@ -83,12 +83,6 @@ .Op Fl c Ar cdbsize .Op Fl N .Nm -.Ic bbrread -.Aq target:lun -.Op general options -.Aq Fl -l Ar lba -.Aq Fl -d Ar datalen -.Nm .Ic readcap .Aq target:lun .Op general options @@ -129,10 +123,6 @@ .Ic startup .Op general options .Nm -.Ic hardstop -.Nm -.Ic hardstart -.Nm .Ic lunlist .Nm .Ic delay @@ -364,34 +354,6 @@ to the kernel when doing a write, just e data. This is to be used for performance testing. .El -.It Ic bbrread -Issue a SCSI READ command to the logical device to potentially force a bad -block on a disk in the RAID set to be reconstructed from the other disks in -the array. This command should only be used on an array that is in the -normal state. If used on a critical array, it could cause the array to go -offline if the bad block to be remapped is on one of the disks that is -still active in the array. -.Pp -The data for this particular command will be discarded, and not returned to -the user. -.Pp -In order to determine which LUN to read from, the user should first -determine which LUN the disk with a bad block belongs to. Then he should -map the bad disk block back to the logical block address for the array in -order to determine which LBA to pass in to the -.Ic bbrread -command. -.Pp -This command is primarily intended for testing. In practice, bad block -remapping will generally be triggered by the in-kernel Disk Aerobics and -Disk Scrubbing code. -.Bl -tag -width 10n -.It Fl l Ar lba -Specify the starting Logical Block Address. -.It Fl d Ar datalen -Specify the amount of data in bytes to read from the LUN. This must be a -multiple of the LUN blocksize. -.El .It Ic readcap Send the .Tn SCSI @@ -545,22 +507,6 @@ START STOP UNIT command with the start b to all direct access LUNs. This will mark all direct access LUNs "online" again. It will not cause any LUNs to start up. A separate start command without the on/offline bit set is necessary for that. -.It Ic hardstop -Use the kernel facility for stopping all direct access LUNs and setting the -offline bit. Unlike the -.Ic shutdown -command above, this command allows shutting down LUNs with I/O active. It -will also issue a LUN reset to any reserved LUNs to break the reservation -so that the LUN can be stopped. -.Ic shutdown -command instead. -.It Ic hardstart -This command is functionally identical to the -.Ic startup -command described above. The primary difference is that the LUNs are -enumerated and commands sent by the in-kernel Front End Target Driver -instead of by -.Nm . .It Ic lunlist List all LUNs registered with CTL. Because this command uses the ioctl port, it will only work when the FETDs Modified: stable/10/usr.sbin/ctladm/ctladm.c ============================================================================== --- stable/10/usr.sbin/ctladm/ctladm.c Mon Oct 5 08:41:32 2015 (r288718) +++ stable/10/usr.sbin/ctladm/ctladm.c Mon Oct 5 08:42:43 2015 (r288719) @@ -66,7 +66,6 @@ __FBSDID("$FreeBSD$"); #include <cam/scsi/scsi_message.h> #include <cam/ctl/ctl.h> #include <cam/ctl/ctl_io.h> -#include <cam/ctl/ctl_frontend_internal.h> #include <cam/ctl/ctl_backend.h> #include <cam/ctl/ctl_ioctl.h> #include <cam/ctl/ctl_backend_block.h> @@ -106,14 +105,11 @@ typedef enum { CTLADM_CMD_SHUTDOWN, CTLADM_CMD_STARTUP, CTLADM_CMD_LUNLIST, - CTLADM_CMD_HARDSTOP, - CTLADM_CMD_HARDSTART, CTLADM_CMD_DELAY, CTLADM_CMD_REALSYNC, CTLADM_CMD_SETSYNC, CTLADM_CMD_GETSYNC, CTLADM_CMD_ERR_INJECT, - CTLADM_CMD_BBRREAD, CTLADM_CMD_PRES_IN, CTLADM_CMD_PRES_OUT, CTLADM_CMD_INQ_VPD_DEVID, @@ -172,7 +168,6 @@ static const char startstop_opts[] = "io static struct ctladm_opts option_table[] = { {"adddev", CTLADM_CMD_ADDDEV, CTLADM_ARG_NONE, NULL}, - {"bbrread", CTLADM_CMD_BBRREAD, CTLADM_ARG_NEED_TL, "d:l:"}, {"create", CTLADM_CMD_CREATE, CTLADM_ARG_NONE, "b:B:d:l:o:s:S:t:"}, {"delay", CTLADM_CMD_DELAY, CTLADM_ARG_NEED_TL, "T:l:t:"}, {"devid", CTLADM_CMD_INQ_VPD_DEVID, CTLADM_ARG_NEED_TL, NULL}, @@ -180,8 +175,6 @@ static struct ctladm_opts option_table[] {"dumpooa", CTLADM_CMD_DUMPOOA, CTLADM_ARG_NONE, NULL}, {"dumpstructs", CTLADM_CMD_DUMPSTRUCTS, CTLADM_ARG_NONE, NULL}, {"getsync", CTLADM_CMD_GETSYNC, CTLADM_ARG_NEED_TL, NULL}, - {"hardstart", CTLADM_CMD_HARDSTART, CTLADM_ARG_NONE, NULL}, - {"hardstop", CTLADM_CMD_HARDSTOP, CTLADM_ARG_NONE, NULL}, {"help", CTLADM_CMD_HELP, CTLADM_ARG_NONE, NULL}, {"inject", CTLADM_CMD_ERR_INJECT, CTLADM_ARG_NEED_TL, "cd:i:p:r:s:"}, {"inquiry", CTLADM_CMD_INQUIRY, CTLADM_ARG_NEED_TL, NULL}, @@ -228,11 +221,6 @@ static int cctl_do_io(int fd, int retrie static int cctl_delay(int fd, int target, int lun, int argc, char **argv, char *combinedopt); static int cctl_lunlist(int fd); -static void cctl_cfi_mt_statusstr(cfi_mt_status status, char *str, int str_len); -static void cctl_cfi_bbr_statusstr(cfi_bbrread_status, char *str, int str_len); -static int cctl_hardstopstart(int fd, ctladm_cmdfunction command); -static int cctl_bbrread(int fd, int target, int lun, int iid, int argc, - char **argv, char *combinedopt); static int cctl_startup_shutdown(int fd, int target, int lun, int iid, ctladm_cmdfunction command); static int cctl_sync_cache(int fd, int target, int lun, int iid, int retries, @@ -1341,180 +1329,6 @@ bailout: return (retval); } -static void -cctl_cfi_mt_statusstr(cfi_mt_status status, char *str, int str_len) -{ - switch (status) { - case CFI_MT_PORT_OFFLINE: - snprintf(str, str_len, "Port Offline"); - break; - case CFI_MT_ERROR: - snprintf(str, str_len, "Error"); - break; - case CFI_MT_SUCCESS: - snprintf(str, str_len, "Success"); - break; - case CFI_MT_NONE: - snprintf(str, str_len, "None??"); - break; - default: - snprintf(str, str_len, "Unknown status: %d", status); - break; - } -} - -static void -cctl_cfi_bbr_statusstr(cfi_bbrread_status status, char *str, int str_len) -{ - switch (status) { - case CFI_BBR_SUCCESS: - snprintf(str, str_len, "Success"); - break; - case CFI_BBR_LUN_UNCONFIG: - snprintf(str, str_len, "LUN not configured"); - break; - case CFI_BBR_NO_LUN: - snprintf(str, str_len, "LUN does not exist"); - break; - case CFI_BBR_NO_MEM: - snprintf(str, str_len, "Memory allocation error"); - break; - case CFI_BBR_BAD_LEN: - snprintf(str, str_len, "Length is not a multiple of blocksize"); - break; - case CFI_BBR_RESERV_CONFLICT: - snprintf(str, str_len, "Reservation conflict"); - break; - case CFI_BBR_LUN_STOPPED: - snprintf(str, str_len, "LUN is powered off"); - break; - case CFI_BBR_LUN_OFFLINE_CTL: - snprintf(str, str_len, "LUN is offline"); - break; - case CFI_BBR_LUN_OFFLINE_RC: - snprintf(str, str_len, "RAIDCore array is offline (double " - "failure?)"); - break; - case CFI_BBR_SCSI_ERROR: - snprintf(str, str_len, "SCSI Error"); - break; - case CFI_BBR_ERROR: - snprintf(str, str_len, "Error"); - break; - default: - snprintf(str, str_len, "Unknown status: %d", status); - break; - } -} - -static int -cctl_hardstopstart(int fd, ctladm_cmdfunction command) -{ - struct ctl_hard_startstop_info hs_info; - char error_str[256]; - int do_start; - int retval; - - retval = 0; - - if (command == CTLADM_CMD_HARDSTART) - do_start = 1; - else - do_start = 0; - - if (ioctl(fd, (do_start == 1) ? CTL_HARD_START : CTL_HARD_STOP, - &hs_info) == -1) { - warn("%s: CTL_HARD_%s ioctl failed", __func__, - (do_start == 1) ? "START" : "STOP"); - retval = 1; - goto bailout; - } - - fprintf(stdout, "Hard %s Status: ", (command == CTLADM_CMD_HARDSTOP) ? - "Stop" : "Start"); - cctl_cfi_mt_statusstr(hs_info.status, error_str, sizeof(error_str)); - fprintf(stdout, "%s\n", error_str); - fprintf(stdout, "Total LUNs: %d\n", hs_info.total_luns); - fprintf(stdout, "LUNs complete: %d\n", hs_info.luns_complete); - fprintf(stdout, "LUNs failed: %d\n", hs_info.luns_failed); - -bailout: - return (retval); -} - -static int -cctl_bbrread(int fd, int target __unused, int lun, int iid __unused, - int argc, char **argv, char *combinedopt) -{ - struct ctl_bbrread_info bbr_info; - char error_str[256]; - int datalen = -1; - uint64_t lba = 0; - int lba_set = 0; - int retval; - int c; - - retval = 0; - - while ((c = getopt(argc, argv, combinedopt)) != -1) { - switch (c) { - case 'd': - datalen = strtoul(optarg, NULL, 0); - break; - case 'l': - lba = strtoull(optarg, NULL, 0); - lba_set = 1; - break; - default: - break; - } - } - - if (lba_set == 0) { - warnx("%s: you must specify an LBA with -l", __func__); - retval = 1; - goto bailout; - } - - if (datalen == -1) { - warnx("%s: you must specify a length with -d", __func__); - retval = 1; - goto bailout; - } - - bbr_info.lun_num = lun; - bbr_info.lba = lba; - /* - * XXX KDM get the blocksize first?? - */ - if ((datalen % 512) != 0) { - warnx("%s: data length %d is not a multiple of 512 bytes", - __func__, datalen); - retval = 1; - goto bailout; - } - bbr_info.len = datalen; - - if (ioctl(fd, CTL_BBRREAD, &bbr_info) == -1) { - warn("%s: CTL_BBRREAD ioctl failed", __func__); - retval = 1; - goto bailout; - } - cctl_cfi_mt_statusstr(bbr_info.status, error_str, sizeof(error_str)); - fprintf(stdout, "BBR Read Overall Status: %s\n", error_str); - cctl_cfi_bbr_statusstr(bbr_info.bbr_status, error_str, - sizeof(error_str)); - fprintf(stdout, "BBR Read Status: %s\n", error_str); - /* - * XXX KDM should we bother printing out SCSI status if we get - * CFI_BBR_SCSI_ERROR back? - * - * Return non-zero if this fails? - */ -bailout: - return (retval); -} - static int cctl_startup_shutdown(int fd, int target, int lun, int iid, ctladm_cmdfunction command) @@ -4494,11 +4308,8 @@ usage(int error) " ctladm devlist [-b backend] [-v] [-x]\n" " ctladm shutdown\n" " ctladm startup\n" -" ctladm hardstop\n" -" ctladm hardstart\n" " ctladm lunlist\n" " ctladm lunmap -p targ_port [-l pLUN] [-L cLUN]\n" -" ctladm bbrread [dev_id] <-l lba> <-d datalen>\n" " ctladm delay [dev_id] <-l datamove|done> [-T oneshot|cont]\n" " [-t secs]\n" " ctladm realsync <on|off|query>\n" @@ -4605,10 +4416,7 @@ usage(int error) "lunmap options:\n" "-p targ_port : specify target port number\n" "-L pLUN : specify port-visible LUN\n" -"-L cLUN : specify CTL LUN\n" -"bbrread options:\n" -"-l lba : starting LBA\n" -"-d datalen : length, in bytes, to read\n", +"-L cLUN : specify CTL LUN\n", CTL_DEFAULT_DEV); } @@ -4859,14 +4667,6 @@ main(int argc, char **argv) retval = cctl_startup_shutdown(fd, target, lun, initid, command); break; - case CTLADM_CMD_HARDSTOP: - case CTLADM_CMD_HARDSTART: - retval = cctl_hardstopstart(fd, command); - break; - case CTLADM_CMD_BBRREAD: - retval = cctl_bbrread(fd, target, lun, initid, argc, argv, - combinedopt); - break; case CTLADM_CMD_LUNLIST: retval = cctl_lunlist(fd); break; Modified: stable/10/usr.sbin/ctld/kernel.c ============================================================================== --- stable/10/usr.sbin/ctld/kernel.c Mon Oct 5 08:41:32 2015 (r288718) +++ stable/10/usr.sbin/ctld/kernel.c Mon Oct 5 08:42:43 2015 (r288719) @@ -60,7 +60,6 @@ __FBSDID("$FreeBSD$"); #include <cam/scsi/scsi_message.h> #include <cam/ctl/ctl.h> #include <cam/ctl/ctl_io.h> -#include <cam/ctl/ctl_frontend_internal.h> #include <cam/ctl/ctl_backend.h> #include <cam/ctl/ctl_ioctl.h> #include <cam/ctl/ctl_backend_block.h>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201510050842.t958gi4V013771>