Commit Graph

137 Commits

Author SHA1 Message Date
mlelstv
4d7fa4351b Support dump on wedges. 2018-05-12 10:33:06 +00:00
christos
31d64fd89d use arraycount. 2017-09-07 10:18:26 +00:00
christos
2252fe52a5 PR/52522: ent_name is not necessarily 0 terminated, so check bounds.
XXX: pullup-8
2017-09-06 18:21:17 +00:00
mlelstv
ba576b71a7 Enhance disk metrics by calculating a weighted sum that is incremented
by the number of concurrent I/O requests. Also introduce a new disk_wait()
function to measure requests waiting in a bufq.
iostat -y now reports data about waiting and active requests.

So far only drivers using dksubr and dk, ccd, wd and xbd collect data about
waiting requests.
2017-03-05 23:07:12 +00:00
rin
d234e84c1f remove unnecessary substitution. no functional changes. 2017-02-28 04:47:41 +00:00
rin
78dbe22116 determine the buffer size by roundup(9) 2017-02-28 04:46:02 +00:00
rin
4785e288b8 Remove PARANOID macro; we should always update secsize if necessary. 2017-02-28 04:39:58 +00:00
jdolecek
198ff4069d pass also DIOCGCACHE to underlying device, so that upper layers would be able
to get the device cache properties without knowing the topology; while here also
pass down DIOCGSTRATEGY for neater dkctl(8) output
2017-02-27 21:27:07 +00:00
rin
7e8d492b8f Add DKWEDGE_METHOD_RDB option, which is Amiga Rigid Disk Block (RDB)
partitioning detection method for dk(4).
2017-02-26 11:56:49 +00:00
maya
58dc54ad55 use a bounded copy. NFCI 2017-01-19 00:44:40 +00:00
mlelstv
3ecac0ea7c add missing mutex/cv cleanup to error paths. 2016-12-24 16:39:55 +00:00
mlelstv
203fa789e4 Make dk(4) device mpsafe. 2016-12-16 15:06:39 +00:00
mlelstv
a85ccad97b missed one exit path with the previous change. 2016-05-29 13:11:21 +00:00
mlelstv
5699db66ce release openlock mutex before closing parent device. 2016-05-29 12:48:40 +00:00
christos
4a60b18fe2 Fix tyop 2016-04-28 00:35:24 +00:00
christos
5f6148474c Fix error message. 2016-04-28 00:33:54 +00:00
christos
f2a7ea8367 Add dkwedge_find_by_parent() 2016-04-27 02:19:12 +00:00
mlelstv
b5733512ba Allow dump to raidframe component which is a wedge.
N.B. ordinary devices check the partition type only in the xxxsize routine.
2016-01-15 07:48:22 +00:00
mlelstv
9da52a83e5 Return error in dkopen when dk_open_parent fails. Also change dk_open_parent
to pass error code to caller.
XXX: Pullups
2015-12-27 00:47:47 +00:00
christos
4270ff4bc4 Skip protective MBR early too. 2015-12-02 01:09:49 +00:00
mlelstv
a4f2b41710 sc_size is already measured in sectors. 2015-11-28 13:41:31 +00:00
christos
8a6acf0efa remove incorrect comment (from kre) 2015-10-10 23:39:43 +00:00
jmcneill
d9483ce0a0 print wedge announcement in one line instead of two 2015-10-06 11:22:40 +00:00
pooka
89cb80befc Rename variable to avoid -Wshadow warnings with some compilers. 2015-08-25 11:08:59 +00:00
jakllsch
45dc116cb7 Quadruple GPT partition entry count limit (to 512 entries or 64KiB).
The UEFI 2.3.1 specification states that:
"A minimum of 16,384 bytes of space must be reserved for the GPT Partition Entry Array."
and [the size of a partition entry shall be a power of two greater than 128]
and that [the defined fields of a partition entry total 128 bytes].

Clamping the entries means that no partitions on the drive will be detected,
as this will result in an incorrect partition entry array CRC. This change
reduces the likelyhood of useless partitions, while still not allowing a
huge kernel memory allocation to load the partition entries into.

In the future this code should probably be reworked to checksum and evaluate
the partition array in chunks while still limiting the number of GPT
wedges added per drive to something reasonable.
2015-08-23 18:40:15 +00:00
mlelstv
1e8c46e3c4 No longer access the disk driver directly.
If there is an open wedge, temporarily reference its vnode.
Otherwise try to open the block device.
2015-08-22 07:48:14 +00:00
mlelstv
862a433dd4 revert the previous 2015-08-22 07:42:46 +00:00
mlelstv
819c32b42c when scanning for disklabels, close block device only when this was
the first open. The device driver doesn't do reference counting.

This is still subject to race conditions.
2015-08-20 23:08:33 +00:00
christos
d7460da79c Look at the bzb flags to mark partition as swap. Requested by John D. Baker.
XXX: Pullup-7
2015-01-24 02:58:56 +00:00
christos
ed5aa85bd1 - Use NODEV instead of 0
- Return EBUSY if there was no label
2015-01-02 01:14:22 +00:00
christos
c60db2e923 make more drivers use disk_ioctl, and add a dev parameter to it so that
we can merge the "easy" disklabel ioctls to it. Ultimately all this will
go do dk_ioctl once all the drivers have been converted.
2014-12-31 19:52:04 +00:00
mlelstv
bdddf44518 disk_blocksize and disk_set_info relay the same information
to the disk subsystem.

Make disk_set_info also set blocksize shift values.
Remove every call to disk_blocksize.

Keep disk_blocksize for ABI compatibility, make it also set dg_secsize.
2014-12-31 08:24:50 +00:00
mlelstv
9c0686ce5c Really provide disk properties, the old code computed values that were
never attached to the device.
2014-12-08 17:45:12 +00:00
mlelstv
c3fa2622e8 fix iobuf setup, cleanup 2014-11-22 11:59:33 +00:00
mlelstv
0c1adb76c8 Implement DIOCMWEDGES ioctl that triggers wedge autodiscovery.
Also fix a reference counting bug and clean up some code.
2014-11-04 07:50:39 +00:00
mlelstv
bab799b6cf get sector size from disk structure. 2014-11-04 07:46:26 +00:00
mlelstv
69a00310d4 Handle disks with non DEV_BSIZE sectors. 2014-11-04 07:45:45 +00:00
mlelstv
6f5687b0bb Be less noisy when handling wedge name conflicts. 2014-11-04 07:43:00 +00:00
snj
f0a7346d21 src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
2014-10-18 08:33:23 +00:00
apb
bb7c004bd3 When converting a disklabel partition type integer to a wedge partition
type string, use the strings defined in DKW_PTYPE_* in <sys/disk.h>, not
the strings defined in FSTYPE_DEFN in <sys/disklabel.h>.

This corrects a problem introduced in revision 1.21 dated 2014-08-18.
That change was intended to add additional case to the list, but it
accidentally also changed from the strings in the DKW_PTYPE_* macros to
the strings in the FSTYPE_DEFN macro.  Many of the strings are the same,
but there are differences such as "RAID" versus "raidframe" and "MSDOS"
versus "FAT".

XXX: There seems to be no good reason for the differences in string
names for partition types.  One or both of the lists should probably be
edited to align them.
2014-08-30 09:35:10 +00:00
riastradh
cc5c10ea14 Make dk(4) discard from partition start, not from disk start.
Otherwise, anything mounted with `-o discard' will pretty quickly
munch itself up and barf up an unrecoverably corrupted file system!

XXX pullup to netbsd-7
2014-08-28 19:37:46 +00:00
apb
922995f705 Use FSTYPE_DEFN from <sys/disklabel.h> to generate case branches for
conversions from all known disklabel fstypes to strings.  This replaces
the hand-coded list of conversions for only a few of the known types.
2014-08-18 14:18:59 +00:00
apb
1ed52851f5 Don't ignore unrecognised partition types in BSD disklabels;
instead, add them with wedge partition type "unknown#%u", where
%u is the underlying numeric partition type from the BSD disklabel.
2014-08-18 13:46:07 +00:00
dholland
890e036b3c Implement d_discard for dk. This closes PR 47940. 2014-07-25 08:23:56 +00:00
dholland
f9228f4225 Add d_discard to all struct cdevsw instances I could find.
All have been set to "nodiscard"; some should get a real implementation.
2014-07-25 08:10:31 +00:00
dholland
8c70ef39af Add d_discard to all struct bdevsw instances I could find.
I've set them all to nodiscard. Some of them (wd, dk, vnd, ld,
raidframe, maybe cgd) should be implemented for real.
2014-07-25 08:02:18 +00:00
christos
223a7bd55f add dkwedge_get_parent_name(). 2014-04-03 15:24:20 +00:00
martin
aad6ef8bb5 Bring back the playstation2 port - now that a toolchain for it is
available again.
2014-03-31 11:25:47 +00:00
dholland
a68f9396b6 Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
2014-03-16 05:20:22 +00:00
skrll
6d3ceb1d61 Rename NetBSD/hp700 to NetBSD/hppa.
Unfortunately our VCS isn't very helpful here.
2014-02-24 07:23:38 +00:00