From owner-svn-src-all@freebsd.org Mon Apr 27 23:43:13 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 A02112CA750; Mon, 27 Apr 2020 23:43:13 +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 49B1YY3XRKz3PK7; Mon, 27 Apr 2020 23:43:13 +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 677D41AD84; Mon, 27 Apr 2020 23:43:13 +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 03RNhDW7075677; Mon, 27 Apr 2020 23:43:13 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RNhDj4075676; Mon, 27 Apr 2020 23:43:13 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202004272343.03RNhDj4075676@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 27 Apr 2020 23:43:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360412 - head/sys/cam/ata X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/ata X-SVN-Commit-Revision: 360412 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: Mon, 27 Apr 2020 23:43:13 -0000 Author: imp Date: Mon Apr 27 23:43:12 2020 New Revision: 360412 URL: https://svnweb.freebsd.org/changeset/base/360412 Log: Convert rotating to a flag bit. Move rotating to a flag bit. Add bit definitions for it. Create a compat sysctl for it. Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Mon Apr 27 23:43:08 2020 (r360411) +++ head/sys/cam/ata/ata_da.c Mon Apr 27 23:43:12 2020 (r360412) @@ -110,7 +110,8 @@ typedef enum { ADA_FLAG_DIRTY = 0x00200000, ADA_FLAG_CAN_NCQ_TRIM = 0x00400000, /* CAN_TRIM also set */ ADA_FLAG_PIM_ATA_EXT = 0x00800000, - ADA_FLAG_UNMAPPEDIO = 0x01000000 + ADA_FLAG_UNMAPPEDIO = 0x01000000, + ADA_FLAG_ROTATING = 0x02000000 } ada_flags; #define ADA_FLAG_STRING \ "\020" \ @@ -137,7 +138,8 @@ typedef enum { "\026DIRTY" \ "\027CAN_NCQ_TRIM" \ "\030PIM_ATA_EXT" \ - "\031UNMAPPEDIO" + "\031UNMAPPEDIO" \ + "\032ROTATING" typedef enum { ADA_Q_NONE = 0x00, @@ -266,7 +268,6 @@ struct ada_softc { int trim_max_ranges; int read_ahead; int write_cache; - int rotating; #ifdef CAM_TEST_FAILURE int force_read_error; int force_write_error; @@ -1516,9 +1517,6 @@ adasysctlinit(void *context, int pending) SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "write_cache", CTLFLAG_RW | CTLFLAG_MPSAFE, &softc->write_cache, 0, "Enable disk write cache."); - SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "rotating", CTLFLAG_RD | CTLFLAG_MPSAFE, - &softc->rotating, 0, "Rotating media"); SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "zone_mode", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, @@ -1551,6 +1549,10 @@ adasysctlinit(void *context, int pending) OID_AUTO, "unmapped_io", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &softc->flags, (u_int)ADA_FLAG_UNMAPPEDIO, adabitsysctl, "I", "Unmapped I/O support *DEPRECATED* gone in FreeBSD 14"); + SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "rotating", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, + &softc->flags, (u_int)ADA_FLAG_ROTATING, adabitsysctl, "I", + "Rotating media *DEPRECATED* gone in FreeBSD 14"); #ifdef CAM_TEST_FAILURE /* @@ -1873,11 +1875,12 @@ adaregister(struct cam_periph *periph, void *arg) /* Disable queue sorting for non-rotational media by default. */ if (cgd->ident_data.media_rotation_rate == ATA_RATE_NON_ROTATING) { - softc->rotating = 0; + softc->flags &= ~ADA_FLAG_ROTATING; } else { - softc->rotating = 1; + softc->flags |= ADA_FLAG_ROTATING; } - cam_iosched_set_sort_queue(softc->cam_iosched, softc->rotating ? -1 : 0); + cam_iosched_set_sort_queue(softc->cam_iosched, + (softc->flags & ADA_FLAG_ROTATING) ? -1 : 0); softc->disk = disk_alloc(); adasetgeom(softc, cgd); softc->disk->d_devstat = devstat_new_entry(periph->periph_name,