From owner-svn-src-all@freebsd.org Thu Feb 13 01:23:45 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5AD7F248A78; Thu, 13 Feb 2020 01:23:45 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48HzL91nHMz4HLy; Thu, 13 Feb 2020 01:23:45 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 386942A1E; Thu, 13 Feb 2020 01:23:45 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01D1NjTQ004217; Thu, 13 Feb 2020 01:23:45 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01D1NjnN004216; Thu, 13 Feb 2020 01:23:45 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202002130123.01D1NjnN004216@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 13 Feb 2020 01:23:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r357849 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 357849 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Feb 2020 01:23:45 -0000 Author: imp Date: Thu Feb 13 01:23:44 2020 New Revision: 357849 URL: https://svnweb.freebsd.org/changeset/base/357849 Log: Convert rotating and unmapped_io to a DA flag Rotating and unmapped_io are really da flags. Convert them to a flag so it will be reported with the other flags for the device. Deprecate the .rotating and .unmapped_io sysctls in FreeBSD 14 and remove the softc ints. Differential Revision: https://reviews.freebsd.org/D23417 Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Thu Feb 13 01:23:32 2020 (r357848) +++ head/sys/cam/scsi/scsi_da.c Thu Feb 13 01:23:44 2020 (r357849) @@ -106,6 +106,7 @@ typedef enum { DA_FLAG_NEW_PACK = 0x000002, DA_FLAG_PACK_LOCKED = 0x000004, DA_FLAG_PACK_REMOVABLE = 0x000008, + DA_FLAG_ROTATING = 0x000010, DA_FLAG_NEED_OTAG = 0x000020, DA_FLAG_WAS_OTAG = 0x000040, DA_FLAG_RETRY_UA = 0x000080, @@ -120,7 +121,8 @@ typedef enum { DA_FLAG_CAN_ATA_IDLOG = 0x010000, DA_FLAG_CAN_ATA_SUPCAP = 0x020000, DA_FLAG_CAN_ATA_ZONE = 0x040000, - DA_FLAG_TUR_PENDING = 0x080000 + DA_FLAG_TUR_PENDING = 0x080000, + DA_FLAG_UNMAPPEDIO = 0x100000 } da_flags; #define DA_FLAG_STRING \ "\020" \ @@ -128,7 +130,7 @@ typedef enum { "\002NEW_PACK" \ "\003PACK_LOCKED" \ "\004PACK_REMOVABLE" \ - "\005UNUSED" \ + "\005ROTATING" \ "\006NEED_OTAG" \ "\007WAS_OTAG" \ "\010RETRY_UA" \ @@ -143,7 +145,8 @@ typedef enum { "\021CAN_ATA_IDLOG" \ "\022CAN_ATA_SUPACP" \ "\023CAN_ATA_ZONE" \ - "\024TUR_PENDING" + "\024TUR_PENDING" \ + "\025UNMAPPEDIO" typedef enum { DA_Q_NONE = 0x00, @@ -367,8 +370,6 @@ struct da_softc { da_delete_methods delete_method_pref; da_delete_methods delete_method; da_delete_func_t *delete_func; - int unmappedio; - int rotating; int p_type; struct disk_params params; struct disk *disk; @@ -1464,6 +1465,7 @@ static void dasysctlinit(void *context, int pending); static int dasysctlsofttimeout(SYSCTL_HANDLER_ARGS); static int dacmdsizesysctl(SYSCTL_HANDLER_ARGS); static int dadeletemethodsysctl(SYSCTL_HANDLER_ARGS); +static int dabitsysctl(SYSCTL_HANDLER_ARGS); static int daflagssysctl(SYSCTL_HANDLER_ARGS); static int dazonemodesysctl(SYSCTL_HANDLER_ARGS); static int dazonesupsysctl(SYSCTL_HANDLER_ARGS); @@ -2315,24 +2317,6 @@ dasysctlinit(void *context, int pending) SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, - "unmapped_io", - CTLFLAG_RD, - &softc->unmappedio, - 0, - "Unmapped I/O support"); - - SYSCTL_ADD_INT(&softc->sysctl_ctx, - SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, - "rotating", - CTLFLAG_RD, - &softc->rotating, - 0, - "Rotating media"); - - SYSCTL_ADD_INT(&softc->sysctl_ctx, - SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "p_type", CTLFLAG_RD, &softc->p_type, @@ -2343,6 +2327,14 @@ dasysctlinit(void *context, int pending) OID_AUTO, "flags", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, softc, 0, daflagssysctl, "A", "Flags for drive"); + SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "rotating", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, + &softc->flags, DA_FLAG_ROTATING, dabitsysctl, "I", + "Rotating media *DEPRECATED* gone in FreeBSD 14"); + SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "unmapped_io", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, + &softc->flags, DA_FLAG_UNMAPPEDIO, dabitsysctl, "I", + "Unmapped I/O support *DEPRECATED* gone in FreeBSD 14"); #ifdef CAM_TEST_FAILURE SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), @@ -2619,6 +2611,21 @@ dadeletemethodchoose(struct da_softc *softc, da_delete } static int +dabitsysctl(SYSCTL_HANDLER_ARGS) +{ + int flags = (intptr_t)arg1; + int test = arg2; + int tmpout, error; + + tmpout = !!(flags & test); + error = SYSCTL_OUT(req, &tmpout, sizeof(tmpout)); + if (error || !req->newptr) + return (error); + + return (EPERM); +} + +static int daflagssysctl(SYSCTL_HANDLER_ARGS) { struct sbuf sbuf; @@ -2775,7 +2782,7 @@ daregister(struct cam_periph *periph, void *arg) softc->unmap_gran_align = 0; softc->ws_max_blks = WS16_MAX_BLKS; softc->trim_max_ranges = ATA_TRIM_MAX_RANGES; - softc->rotating = 1; + softc->flags |= DA_FLAG_ROTATING; periph->softc = softc; @@ -2908,7 +2915,7 @@ daregister(struct cam_periph *periph, void *arg) if ((softc->quirks & DA_Q_NO_SYNC_CACHE) == 0) softc->disk->d_flags |= DISKFLAG_CANFLUSHCACHE; if ((cpi.hba_misc & PIM_UNMAPPED) != 0) { - softc->unmappedio = 1; + softc->flags |= DA_FLAG_UNMAPPEDIO; softc->disk->d_flags |= DISKFLAG_UNMAPPED_BIO; } cam_strvis(softc->disk->d_descr, cgd->inq_data.vendor, @@ -5188,7 +5195,7 @@ dadone_probebdc(struct cam_periph *periph, union ccb * SVPD_BDC_RATE_NON_ROTATING) { cam_iosched_set_sort_queue( softc->cam_iosched, 0); - softc->rotating = 0; + softc->flags &= ~DA_FLAG_ROTATING; } if (softc->disk->d_rotation_rate != old_rate) { disk_attr_changed(softc->disk, @@ -5298,7 +5305,7 @@ dadone_probeata(struct cam_periph *periph, union ccb * softc->disk->d_rotation_rate = ata_params->media_rotation_rate; if (softc->disk->d_rotation_rate == ATA_RATE_NON_ROTATING) { cam_iosched_set_sort_queue(softc->cam_iosched, 0); - softc->rotating = 0; + softc->flags &= ~DA_FLAG_ROTATING; } if (softc->disk->d_rotation_rate != old_rate) { disk_attr_changed(softc->disk,