summaryrefslogtreecommitdiff
path: root/sys/kern/subr_disklabel.c
Commit message (Collapse)AuthorAgeFilesLines
* NO_GEOM cleanup: retire to attic.Poul-Henning Kamp2003-01-301-301/+0
| | | | Notes: svn path=/head/; revision=110094
* #ifdef NO_GEOM all of this file.Poul-Henning Kamp2003-01-211-0/+2
| | | | Notes: svn path=/head/; revision=109629
* Move alpha_fix_srm_checksum() from subr_diskmbr.c to subr_disklabel.cPoul-Henning Kamp2003-01-171-0/+16
| | | | Notes: svn path=/head/; revision=109442
* Move dkmodpart() from subr_diskslice.c to subr_disklabel.c.Poul-Henning Kamp2003-01-171-0/+6
| | | | Notes: svn path=/head/; revision=109435
* Remove unused second argument from DEV_STRATEGY().Poul-Henning Kamp2003-01-031-4/+4
| | | | Notes: svn path=/head/; revision=108586
* (This commit touches about 15 disk device drivers in a very consistentPoul-Henning Kamp2002-09-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and predictable way, and I apologize if I have gotten it wrong anywhere, getting prior review on a patch like this is not feasible, considering the number of people involved and hardware availability etc.) If struct disklabel is the messenger: kill the messenger. Inside struct disk we had a struct disklabel which disk drivers used to communicate certain metrics to the disklayer above (GEOM or the disk mini-layer). This commit changes this communication to use four explicit fields instead. Amongst the benefits is that the fields do not get overwritten by wrong or bogus on-disk disklabels. Once that is clear, <sys/disk.h> which is included in the drivers no longer need to pull <sys/disklabel.h> and <sys/diskslice.h> in, the few places that needs them, have gotten explicit #includes for them. The disklabel inside struct disk is now only for internal use in the disk mini-layer, so instead of embedding it, we malloc it as we need it. This concludes (modulus any mistakes) the series of disklabel related commits. I belive it all amounts to a NOP for all the rest of you :-) Sponsored by: DARPA & NAI Labs. Notes: svn path=/head/; revision=103714
* For reasons now lost in historical fog, the bounds_check_with_label()Poul-Henning Kamp2002-09-201-0/+58
| | | | | | | | | | | | | | | function were put in i386/i386/machdep.c from where it has been cut and pasted to other architectures with only minor corruption. Disklabel is really a MI format in many ways, at least it certainly is when you operate on struct disklabel. Put bounds_check_with_label() back in subr_disklabel.c where it belongs. Sponsored by: DARPA & NAI Labs. Notes: svn path=/head/; revision=103703
* Make FreeBSD "struct disklabel" agnostic, step 312 of 723:Poul-Henning Kamp2002-09-201-151/+0
| | | | | | | | | | | | | Rename bioqdisksort() to bioq_disksort(). Keep a #define around to avoid changing all diskdrivers right now. Move it from subr_disklabel.c to subr_disk.c. Move prototype from <sys/disklabel.h> to <sys/bio.h> Sponsored by: DARPA and NAI Labs. Notes: svn path=/head/; revision=103683
* Make FreeBSD "struct disklabel" agnostic, step 311 of 723:Poul-Henning Kamp2002-09-201-57/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Rename diskerr() to disk_err() for naming consistency. Drop the by now entirely useless struct disklabel argument. Add a flag argument for new-line termination. Fix a couple of printf-format-casts to %j instead of %l. Correctly print the name of all bio commands. Move the function from subr_disklabel.c to subr_disk.c, and from <sys/disklabel.h> to <sys/disk.h>. Use the new disk_err() throughout, #include <sys/disk.h> as needed. Bump __FreeBSD_version for the sake of the aac disk drivers #ifdefs. Remove unused disklabel members of softc for aac, amr and mlx, which seem to originally have been intended for diskerr() use, but which only rotted and got Copy&Pasted at least two times to many. Sponsored by: DARPA & NAI Labs. Notes: svn path=/head/; revision=103675
* more caddr_t removal.Alfred Perlstein2002-06-291-1/+1
| | | | Notes: svn path=/head/; revision=99012
* More 64 bits platforms warning fixes.Maxime Henrion2002-06-231-3/+3
| | | | | | | Reviewed by: rwatson Notes: svn path=/head/; revision=98690
* This commit adds basic support for the UFS2 filesystem. The UFS2Kirk McKusick2002-06-211-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | filesystem expands the inode to 256 bytes to make space for 64-bit block pointers. It also adds a file-creation time field, an ability to use jumbo blocks per inode to allow extent like pointer density, and space for extended attributes (up to twice the filesystem block size worth of attributes, e.g., on a 16K filesystem, there is space for 32K of attributes). UFS2 fully supports and runs existing UFS1 filesystems. New filesystems built using newfs can be built in either UFS1 or UFS2 format using the -O option. In this commit UFS1 is the default format, so if you want to build UFS2 format filesystems, you must specify -O 2. This default will be changed to UFS2 when UFS2 proves itself to be stable. In this commit the boot code for reading UFS2 filesystems is not compiled (see /sys/boot/common/ufsread.c) as there is insufficient space in the boot block. Once the size of the boot block is increased, this code can be defined. Things to note: the definition of SBSIZE has changed to SBLOCKSIZE. The header file <ufs/ufs/dinode.h> must be included before <ufs/ffs/fs.h> so as to get the definitions of ufs2_daddr_t and ufs_lbn_t. Still TODO: Verify that the first level bootstraps work for all the architectures. Convert the utility ffsinfo to understand UFS2 and test growfs. Add support for the extended attribute storage. Update soft updates to ensure integrity of extended attribute storage. Switch the current extended attribute interfaces to use the extended attribute storage. Add the extent like functionality (framework is there, but is currently never used). Sponsored by: DARPA & NAI Labs. Reviewed by: Poul-Henning Kamp <phk@freebsd.org> Notes: svn path=/head/; revision=98542
* Comment out Kirks io-request priority hack until we can do this in aPoul-Henning Kamp2002-04-221-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | civilized way which doesn't cause grief. The problem is that it is not generally safe to cast a "struct bio *" to a "struct buf *". Things like ccd, vinum, ata-raid and GEOM constructs bio's which are not entrails of a struct buf. Also, curthread may or may not have anything to do with the I/O request at hand. The correct solution can either be to tag struct bio's with a priority derived from the requesting threads nice and have disksort act on this field, this wouldn't address the "silly-seek syndrome" where two equal processes bang the diskheads from one edge to the other of the disk repeatedly. Alternatively, and probably better: a sleep should be introduced either at the time the I/O is requested or at the time it is completed where we can be sure to sleep in the right thread. The sleep also needs to be in constant timeunits, 1/hz can be practicaly any sub-second size, at high HZ the current code practically doesn't do anything. Notes: svn path=/head/; revision=95246
* Change callers of mtx_init() to pass in an appropriate lock type name. InJohn Baldwin2002-04-041-1/+1
| | | | | | | | | | most cases NULL is passed, but in some cases such as network driver locks (which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used. Tested on: i386, alpha, sparc64 Notes: svn path=/head/; revision=93818
* Fixed handling of short reads in readdisklabel() and writedisklabel().Bruce Evans2002-03-301-0/+6
| | | | | | | | | | | | | | | | | | | These functions use DEV_STRATEGY() which can easily return a short count (with no error) for reads near EOF. EOF happens for "disks" too small to contain a label sector (mainly for empty slices). The functions didn't understand this at all, and looked for labels in the garbage in the buffer beyond what DEV_STRATEGY() returned. The recent UMA changes combined with my local changes and configuration resulted in the garbage often containing a valid but garbage label left over from a previous call. Bugs in EOF handling in -current limited the problem to "disks" with size precisely LABELSECTOR sectors. LABELSECTOR happens to be a very unusual "disk" size since it is only 0 for non-i386 arches that don't usually have disks with DOS MBRs. Notes: svn path=/head/; revision=93431
* GC: BIO_ORDERED, various infrastructure dealing with BIO_ORDERED.Poul-Henning Kamp2002-02-221-2/+1
| | | | Notes: svn path=/head/; revision=91063
* Fix typo so that the delay code introduced in revision 1.60 actuallyKirk McKusick2002-01-121-1/+1
| | | | | | | | | does something. Submitted by: John Baldwin <john@baldwin.cx> Notes: svn path=/head/; revision=89277
* Add disk I/O scheduling for positively niced processes.Kirk McKusick2001-12-141-0/+25
| | | | | | | | | | | | When a positively niced process requests a disk I/O, make it wait for its nice value of ticks before scheduling its I/O request if there are any other processes with I/O requests in the disk queue. For all the gory details, see the ``Running fsck in the Background'' paper in the Usenix BSDCon 2002 Conference Proceedings, pages 55-64. Notes: svn path=/head/; revision=87845
* FreeBSD/tahoe is not likely for a while.Peter Wemm2001-11-031-3/+0
| | | | Notes: svn path=/head/; revision=85956
* Create a general facility for making dev_t's depend on anotherPoul-Henning Kamp2001-05-261-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | dev_t. The dev_depends(dev_t, dev_t) function is for tying them to each other. When destroy_dev() is called on a dev_t, all dev_t's depending on it will also be destroyed (depth first order). Rewrite the make_dev_alias() to use this dependency facility. kern/subr_disk.c: Make the disk mini-layer use dependencies to make sure all relevant dev_t's are removed when the disk disappears. Make the disk mini-layer precreate some magic sub devices which the disk/slice/label code expects to be there. kern/subr_disklabel.c: Remove some now unneeded variables. kern/subr_diskmbr.c: Remove some ancient, commented out code. kern/subr_diskslice.c: Minor cleanup. Use name from dev_t instead of dsname() Notes: svn path=/head/; revision=77215
* Use the name given to the dev_t, rather than creating our own.Poul-Henning Kamp2001-05-251-1/+2
| | | | | | | | This makes it possible to give sensible information for /dev/fd.720 and similar "special" devices. Notes: svn path=/head/; revision=77166
* A bit of sanity-checking in bioqdisksort(): panic if we recurse.Poul-Henning Kamp2001-01-141-0/+9
| | | | Notes: svn path=/head/; revision=71041
* Make diskerr() always log with printf.Poul-Henning Kamp2000-11-261-18/+11
| | | | Notes: svn path=/head/; revision=69210
* Turn dkcksum() into an __inline function.Poul-Henning Kamp2000-09-161-17/+0
| | | | | | | Change its type to u_int_16_t. Notes: svn path=/head/; revision=65921
* Separate the struct bio related stuff out of <sys/buf.h> intoPoul-Henning Kamp2000-05-051-0/+1
| | | | | | | | | | | | | | | | | | <sys/bio.h>. <sys/bio.h> is now a prerequisite for <sys/buf.h> but it shall not be made a nested include according to bdes teachings on the subject of nested includes. Diskdrivers and similar stuff below specfs::strategy() should no longer need to include <sys/buf.> unless they need caching of data. Still a few bogus uses of struct buf to track down. Repocopy by: peter Notes: svn path=/head/; revision=60041
* s/biowait/bufwait/gPoul-Henning Kamp2000-04-291-4/+4
| | | | | | | Prodded by: several. Notes: svn path=/head/; revision=59762
* Retire bufqdisksort(), all drivers use bioqdisksort now.Poul-Henning Kamp2000-04-181-98/+0
| | | | Notes: svn path=/head/; revision=59363
* Complete the bio/buf divorce for all code below devfs::strategyPoul-Henning Kamp2000-04-151-11/+11
| | | | | | | | | | | | | Exceptions: Vinum untouched. This means that it cannot be compiled. Greg Lehey is on the case. CCD not converted yet, casts to struct buf (still safe) atapi-cd casts to struct buf to examine B_PHYS Notes: svn path=/head/; revision=59249
* Clone bio versions of certain bits of infrastructure:Poul-Henning Kamp2000-04-021-0/+98
| | | | | | | | | | | | | | | | devstat_end_transaction_bio() bioq_* versions of bufq_* incl bioqdisksort() the corresponding "buf" versions will disappear when no longer used. Move b_offset, b_data and b_bcount to struct bio. Add BIO_FORMAT as a hack for fd.c etc. We are now largely ready to start converting drivers to use struct bio instead of struct buf. Notes: svn path=/head/; revision=58942
* Move B_ERROR flag to b_ioflags and call it BIO_ERROR.Poul-Henning Kamp2000-04-021-1/+1
| | | | | | | | | | | | | | | | (Much of this done by script) Move B_ORDERED flag to b_ioflags and call it BIO_ORDERED. Move b_pblkno and b_iodone_chain to struct bio while we transition, they will be obsoleted once bio structs chain/stack. Add bio_queue field for struct bio aware disksort. Address a lot of stylistic issues brought up by bde. Notes: svn path=/head/; revision=58934
* diff, patch and cvs didn't like these three last time around, try again.Poul-Henning Kamp2000-03-201-3/+3
| | | | Notes: svn path=/head/; revision=58365
* Rename the existing BUF_STRATEGY() to DEV_STRATEGY()Poul-Henning Kamp2000-03-201-1/+1
| | | | | | | | | | | substitute BUF_WRITE(foo) for VOP_BWRITE(foo->b_vp, foo) substitute BUF_STRATEGY(foo) for VOP_STRATEGY(foo->b_vp, foo) This patch is machine generated except for the ccd.c and buf.h parts. Notes: svn path=/head/; revision=58349
* Remove B_READ, B_WRITE and B_FREEBUF and replace them with a newPoul-Henning Kamp2000-03-201-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | field in struct buf: b_iocmd. The b_iocmd is enforced to have exactly one bit set. B_WRITE was bogusly defined as zero giving rise to obvious coding mistakes. Also eliminate the redundant struct buf flag B_CALL, it can just as efficiently be done by comparing b_iodone to NULL. Should you get a panic or drop into the debugger, complaining about "b_iocmd", don't continue. It is likely to write on your disk where it should have been reading. This change is a step in the direction towards a stackable BIO capability. A lot of this patch were machine generated (Thanks to style(9) compliance!) Vinum users: Greg has not had time to test this yet, be careful. Notes: svn path=/head/; revision=58345
* Removed diskerr()'s unused d_name arg and updated callers. This fixesBruce Evans1999-09-131-2/+2
| | | | | | | | | warnings caused by the arg having the wrong type (not const enough). The arg was also wrong (a full name instead of a short one) for calls from from subr_diskmbr.c and pc98/diskslice_machdep.c. Notes: svn path=/head/; revision=51226
* We don't need to pass the diskname argument all over the diskslice/labelPoul-Henning Kamp1999-08-281-1/+1
| | | | | | | code, we can find the name from any convenient dev_t Notes: svn path=/head/; revision=50511
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50477
* Spring cleaning around strategy and disklabels/slices:Poul-Henning Kamp1999-08-141-9/+7
| | | | | | | | | | | | | | | | | Introduce BUF_STRATEGY(struct buf *, int flag) macro, and use it throughout. please see comment in sys/conf.h about the flag argument. Remove strategy argument from all the diskslice/label/bad144 implementations, it should be found from the dev_t. Remove bogus and unused strategy1 routines. Remove open/close arguments from dssize(). Pick them up from dev_t. Remove unused and unfinished setgeom support from diskslice/label/bad144 code. Notes: svn path=/head/; revision=49771
* Convert buffer locking from using the B_BUSY and B_WANTED flags to usingKirk McKusick1999-06-261-5/+5
| | | | | | | | | | lockmgr locks. This commit should be functionally equivalent to the old semantics. That is, all buffer locking is done with LK_EXCLUSIVE requests. Changes to take advantage of LK_SHARED and LK_RECURSIVE will be done in future commits. Notes: svn path=/head/; revision=48225
* Fix -Wuninitialized warning regarding zero-length var-args ctl element.Matthew Dillon1998-12-141-2/+2
| | | | | | | | ( this isn't really an error, but I think it is important to fix the warning ). Notes: svn path=/head/; revision=41765
* Use only the correct raw partition for writing labels. Don't use theBruce Evans1998-10-171-9/+4
| | | | | | | | | | | | | | | | | | | | | | | | partition that the label ioctl is being done on just because it has offset 0, since there is no guarantee that such a partition is large enough to contain the label. Don't use the wrong raw partition (0 instead of RAW_PART). This fixes problems rewriting bizarre labels (with a nonzero offset for the 'a' partition) in newfs(8). Such labels shouldn't normally be used, but creating them was allowed if the ioctl was done on the raw partition, and sysinstall creates them if the root partition isn't allocated first. Note that allowing write access to a partition other than the one that has been checked for write access doesn't increase security holes significantly, since write access to any partition already allows changing the in-core label. This fix should be in 3.0R. Rev.1.26 of newfs/newfs.c shouldn't be in 3.0R. Notes: svn path=/head/; revision=40469
* fixup for alpha.Jordan K. Hubbard1998-10-161-1/+4
| | | | Notes: svn path=/head/; revision=40448
* When a buffer is removed from a buffer queue, remember it's block numberJustin T. Gibbs1998-09-151-26/+52
| | | | | | | and use it as "the currently active" buffer in doing disk sort calculations. Notes: svn path=/head/; revision=39238
* Used daddr_t's, not ints, to store disk block numbers. Updated printfBruce Evans1998-07-281-9/+11
| | | | | | | | | | | formats and args to match. Fixed old printf format errors (all related; most were hidden by calling printf indirectly). This change somehow avoids compiler bugs for 64-bit longs on i386's, although it increases the number of 64-bit calculations. Notes: svn path=/head/; revision=37922
* Don't depend on "implicit int".Bruce Evans1998-02-201-2/+2
| | | | Notes: svn path=/head/; revision=33678
* Remove a bunch of variables which were unused both in GENERIC and LINT.Poul-Henning Kamp1997-11-071-2/+1
| | | | | | | Found by: -Wunused Notes: svn path=/head/; revision=31016
* Convert tqdisksort to bufqdisksort. Honor the B_ORDERED buffer flagJustin T. Gibbs1997-09-211-77/+56
| | | | | | | so that meta-data writes go out to the device in the right order. Notes: svn path=/head/; revision=29685
* Use the correct size for a sector in the search for a label inBruce Evans1997-07-131-3/+3
| | | | | | | readdisklabel(). Sectors may be larger than DEV_BSIZE. Notes: svn path=/head/; revision=27377
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notPeter Wemm1997-02-221-1/+1
| | | | | | | ready for it yet. Notes: svn path=/head/; revision=22975
* Make the long-awaited change from $Id$ to $FreeBSD$Jordan K. Hubbard1997-01-141-1/+1
| | | | | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise. Notes: svn path=/head/; revision=21673
* Removed all references to b_cylinder (aka b_cylin). It was evil andBruce Evans1996-12-011-9/+1
| | | | | | | | hasn't been used for a year or two since disksort() started sorting on b_pblkno. Notes: svn path=/head/; revision=20070