Page MenuHomeFreeBSD

Add rotationrate to geom disk dumpconf
ClosedPublic

Authored by rpokala on Dec 10 2015, 12:51 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 12, 8:53 AM
Unknown Object (File)
Fri, Apr 12, 8:25 AM
Unknown Object (File)
Mar 11 2024, 6:46 AM
Unknown Object (File)
Jan 19 2024, 8:09 PM
Unknown Object (File)
Dec 20 2023, 12:53 AM
Unknown Object (File)
Nov 12 2023, 3:27 AM
Unknown Object (File)
Nov 7 2023, 5:08 AM
Unknown Object (File)
Nov 6 2023, 4:36 PM
Subscribers

Details

Summary

This adds struct disk's rotation_rate to the output of geom disk list, which is useful to collect into inventory databases or make decisions on with configuration management software.

Test Plan

root@cds124.lab:~# geom disk list
Geom name: da0
Providers:

  1. Name: da0 Mediasize: 480103981056 (447G) Sectorsize: 512 Stripesize: 4096 Stripeoffset: 0 Mode: r4w4e11 descr: ATA SAMSUNG MZ7WD480 lunid: 5002538500234d15 ident: S1G1NYAF930242 rotationrate: 1 fwsectors: 63 fwheads: 255

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 2129
Build 2137: arc lint + arc unit

Event Timeline

kbowling retitled this revision from to Add rotationrate to geom disk dumpconf.
kbowling updated this object.
kbowling edited the test plan for this revision. (Show Details)
kbowling added a reviewer: rpokala.
kbowling set the repository for this revision to rS FreeBSD src repository - subversion.
kbowling added a subscriber: sbruno.

I was actually going to take a look at this one this weekend. My concern is that SSDs report a rotationrate of 1, not 0:

ValueDescription
0000hRate not reported
0001hNon-rotating media (e.g., solid state device)
0002h-0400hReserved
0401h-FFFEhNominal media rotation rate in rotations per minute (rpm) (e.g., 7200 rpm = 1C20h)
FFFFhReserved

(That wording is copied from the ATA specs, but SCSI uses the same values for the meaning.)

I was going to validate the d_rotation_rate value before using it. i.e.:

sbuf_printf(sb, "%s<rotationrate>", indent);
if (dp->d_rotatation_rate == 0)
    sbuf_printf(sb, "unknown");
else if (dp->d_rotation_rate == 1)
    sbuf_printf(sb, "0");
else if ((dp->d_rotation_rate >= 0x041) && (dp->d_rotation_rate <= 0xfffe))
    sbuf_printf(sb, "%u", dp->d_rotation_rate);
else
    sbuf_printf(sb, "invalid");
sbuf_printf(sb, "</rotationrate>\n");

Your logic makes sense to me. Ravi, can you integrate this and MFC to 10-STABLE during slush?

rpokala edited reviewers, added: kbowling; removed: rpokala.

I'm going to steal this from @kevin.bowling_kev009.com because I have a newer patch, and I can eventually commit it.

Correctly interpret the d_rotation_rate field, rather than just using the raw value.

sbruno added a reviewer: sbruno.

Yup. Go for it.

This revision is now accepted and ready to land.Jan 14 2016, 8:53 PM
jhb added a reviewer: jhb.
jhb added a subscriber: jhb.

Just some minor nits.

sys/geom/geom_disk.c
552

style(9) would put a blank line before the comment block.

556

This extra blank line in the comment block can probably be removed.

rpokala edited edge metadata.

Fix some style(9) violations found by jhb.

This revision now requires review to proceed.Jan 14 2016, 9:31 PM
kbowling edited edge metadata.
This revision is now accepted and ready to land.Jan 30 2016, 12:48 AM