Commit Graph

562 Commits

Author SHA1 Message Date
lukem c50eb8cc85 deprecate fs_fscktime; we never used it.
in an effort to maintain compatibility with freebsd/openbsd/whatever,
i'm attempting to get the superblock format in sync, and freebsd uses
the int32_t at this position for `fs_pendinginodes'.

if we ever decide to implement fscktime functionality, we'll:
a) make sure to liaise with the other projects to reserve the same
   spare field
b) actually implement the code this time ...

(this is also preparing us for other changes, like the new dirpref code)
2001-09-03 14:52:17 +00:00
lukem e3ba61f9f3 Incorporate fix by iedowse @ FreeBSD to allow disks with large numbers of
cylinder groups to work correctly, with minor modifications by me to work
with our FFS_EI code.  From the FreeBSD commit message:

	The ffs superblock includes a 128-byte region for use by temporary
	in-core pointers to summary information. An array in this region
	(fs_csp) could overflow on filesystems with a very large number of
	cylinder groups (~16000 on i386 with 8k blocks). When this happens,
	other fields in the superblock get corrupted, and fsck refuses to
	check the filesystem.

	Solve this problem by replacing the fs_csp array in 'struct fs'
	with a single pointer, and add padding to keep the length of the
	128-byte region fixed. Update the kernel and userland utilities
	to use just this single pointer.

	With this change, the kernel no longer makes use of the superblock
	fields 'fs_csshift' and 'fs_csmask'. Add a comment to newfs/mkfs.c
	to indicate that these fields must be calculated for compatibility
	with older kernels.

	Reviewed by:    mckusick
2001-09-02 01:58:30 +00:00
lukem 563fb2d03f no need to cast arg to lblktosize() any more 2001-08-31 03:38:45 +00:00
lukem 2bfd8a2678 More fixes from FreeBSD (with changes):
- Cast blk argument to lblktosize() to (off_t), to prevent 32 bit overflow.
  whilst almost every use in ffs used this for small blknos, there are
  potential issues, and it's safer this way.  (as discussed with chuq)
- Use 64bit (off_t) math to calculate if we have hit our freespace() limit.
  Necessary for coherent results on filesystems bigger than 0.5Tb.
- Use lblktosize() in blksize() and dblksize(), to make it obvious what's
  happening
- Remove sblksize() - nothing uses it
2001-08-31 03:15:45 +00:00
lukem 0cf1d74c5b be consistent when casting arg to lblktosize() in UVM_PAGE_TRKOWN debug code 2001-08-30 15:17:28 +00:00
lukem c56418af73 some improvements from freebsd/openbsd
- replace the unused fs_headswitch and fs_trkseek with fs_id[2], bringing
  our struct fs closer to that in freebsd & openbsd (& solaris FWIW)
- dumpfs: improve warning message when cpc == 0
2001-08-30 14:37:25 +00:00
lukem c535133897 - minor whitespace and comments cleanup
- replace "filesystem" with "file system"
- fix spelo (from freebsd)
2001-08-30 08:31:25 +00:00
chs 1de4b3e2e0 min() -> MIN() (on general principles) 2001-08-30 03:55:42 +00:00
chs eccd469cf7 min() -> MIN() 2001-08-30 03:47:53 +00:00
wiz 251b3464be heirarchy -> hierarchy 2001-08-24 10:24:45 +00:00
chs cb3b720183 disable mmap() for LFS until it is fixed. 2001-08-24 06:42:46 +00:00
wiz 1e378c4c12 precede, not preceed. 2001-08-20 12:00:46 +00:00
chs f0af9f581b add getpages/putpages entries for spec vnodes. 2001-08-17 05:54:36 +00:00
lukem 1b81d6353d remove third argument (`int ns') from ffs_sb_swap(), and let ffs_sb_swap()
determine the endianness of the `struct fs *o' superblock from o->fs_magic
and set needswap as necessary, rather than trusting the caller to get
it right.  invariably, almost every caller of ffs_sb_swap() was calling it
with ns set to the wrong value for ns anyway!
ansi KNF ffs_bswap.c declarations whilst here.

this fixes all sorts of problems when trying to use other-endian file systems,
notably the kernel trying to access memory *way* off, possibly corrupting or
panicing, and userland programs SEGVing and/or corrupting things (e.g,
"fsck_ffs -B"  to swap a file system endianness).

whilst the previous rev of ffs_bswap.c (1.10, 2000/12/23) made this problem
worse, i suspect that the problem was always there and previous versions
just happened not to trash things at the wrong time.

FFS_EI should now be a lot more stable.
2001-08-17 02:18:46 +00:00
lukem ed54fa2d76 correctly cast arguments to scanc() 2001-08-09 08:16:42 +00:00
lukem 1a2d5cf412 be consistent and use "u_char" instead of "unsigned char" 2001-08-09 08:15:26 +00:00
lukem a73aa816f3 get argument name correct in comment describing vop_balloc_args 2001-08-08 08:36:36 +00:00
jdolecek 58ed62e500 Constraint 'blkcnt' of lfs_markv() syscall by 64KB. Reviewed by
Konrad Schroder <perseant@NetBSD.org>.
2001-08-03 06:02:42 +00:00
lukem 3cd4afc9e3 - multiple include protection
- pull in <ufs/ufs/dinode.h> for ufs_daddr_t
- mark a few fields as being "UNUSED" (because they are)
2001-07-27 01:28:06 +00:00
lukem c358141302 multiple include protection 2001-07-27 01:24:54 +00:00
jdolecek bd21ec5d2e lfs_writeseg(): make el_size a size_t (cosmetic only, no functional change) 2001-07-26 20:20:15 +00:00
lukem 714cac851d if printing the value of fs_clean, say 'fs_clean' instead of 'fs_flags' ... 2001-07-26 07:58:55 +00:00
lukem fcf7f6cd06 fix spelo 2001-07-26 07:55:54 +00:00
assar bec71dc090 change vop_symlink and vop_mknod to return vpp (the created node)
refed, so that the caller can actually use it.  update callers and
file systems that implement these vnode operations
2001-07-24 15:39:30 +00:00
perseant 4e3fced95b Merge the short-lived perseant-lfsv2 branch into the trunk.
Kernels and tools understand both v1 and v2 filesystems; newfs_lfs
generates v2 by default.  Changes for the v2 layout include:

- Segments of non-PO2 size and arbitrary block offset, so these can be
  matched to convenient physical characteristics of the partition (e.g.,
  stripe or track size and offset).

- Address by fragment instead of by disk sector, paving the way for
  non-512-byte-sector devices.  In theory fragments can be as large
  as you like, though in reality they must be smaller than MAXBSIZE in size.

- Use serial number and filesystem identifier to ensure that roll-forward
  doesn't get old data and think it's new.  Roll-forward is enabled for
  v2 filesystems, though not for v1 filesystems by default.

- The inode free list is now a tailq, paving the way for undelete (undelete
  is not yet implemented, but can be without further non-backwards-compatible
  changes to disk structures).

- Inode atime information is kept in the Ifile, instead of on the inode;
  that is, the inode is never written *just* because atime was changed.
  Because of this the inodes remain near the file data on the disk, rather
  than wandering all over as the disk is read repeatedly.  This speeds up
  repeated reads by a small but noticeable amount.

Other changes of note include:

- The ifile written by newfs_lfs can now be of arbitrary length, it is no
  longer restricted to a single indirect block.

- Fixed an old bug where ctime was changed every time a vnode was created.
  I need to look more closely to make sure that the times are only updated
  during write(2) and friends, not after-the-fact during a segment write,
  and certainly not by the cleaner.
2001-07-13 20:30:18 +00:00
toshii 4866f1a22b Fix typo. s/extention/extension/ 2001-07-05 08:38:24 +00:00
chs c31ab668df in ext2fs_balloc_range(), clear PG_RDONLY on pages which now have backing store. 2001-07-04 21:16:01 +00:00
chs 2a7b0d97d6 in ufs_balloc_range(), clear PG_RDONLY on pages which now have backing store.
fixes PR 13353.
2001-07-04 21:08:48 +00:00
wiz f3f6c5b675 `accessible' only has one `a'. 2001-06-19 12:52:20 +00:00
mrg 804019f100 only include "fs_lfs.h" if _KERNEL_OPT. 2001-06-05 09:19:33 +00:00
chs d8bbc51566 fix an error case for quotas. 2001-06-03 16:49:07 +00:00
mrg 67afbd6270 use _KERNEL_OPT 2001-05-30 11:57:16 +00:00
chs 45701591c6 add a genfs_mmap() and change all of the disk-based filesystems
to implement VOP_MMAP() with the genfs version, in preparation for
actually using this VOP.
2001-05-28 02:50:51 +00:00
enami c17241f92a Don't flush possibilly relocated file system block if write is done
asynchronously.  They will be flushed later when necessary and flushing
now makes sequential write access very slow.
2001-04-18 03:48:23 +00:00
thorpej 5b35dc8136 When unmounting a file system, acquire the syncer_lock before
vfs_busy'ing just before the dounmount() call.  This is to avoid
sleeping with the mountlist_slock held -- but we must acquire
syncer_lock before vfs_busy because the syncer itself uses
syncer_lock -> vfs_busy locking order.
2001-04-16 22:41:09 +00:00
chs 331bd97cbd work around a problem with sync writes vs. softdeps. 2001-03-26 06:47:34 +00:00
fvdl ad5dcb280f Same change as in the UFS code: unlock vnode before setting v_op
to spec_vnode_ops. From Bill Studenmund.
2001-03-23 21:10:48 +00:00
fvdl 509b0d01a5 Do an explicit VOP_UNLOCK in ufs_vinit before setting v_op to
spec_vnode_ops_p. Workaround for a lock leak. Problem tracked
down by der Mouse.
2001-03-23 12:15:34 +00:00
sommerfeld d02dde9937 Change ffs_dirpref() to pay attention to the amount of available free
space before deciding which cylinder group should contain a new directory
inode.

Fixes kern/11983; works around some, but not all, of the side effects
of kern/11989.

Tested by me for well over a month on my laptop; preliminary versions of
the fix were tested by Frank van der Linden and Herb Peyerl.
2001-03-13 21:16:23 +00:00
chs 060e70db41 min() -> MIN(), max() -> MAX().
fixes more problems with file offsets > 4GB.
2001-02-27 04:37:44 +00:00
chs dfd2654fd2 min() -> MIN(), max() -> MAX().
fixes more problems with file offsets > 4GB.
2001-02-27 02:55:40 +00:00
fvdl 418264a670 Some bugfixes from rev 1.33 and 1.34 of this file in FreeBSD (some
in effect cosmetic). Original FreeBSD commit messages:

==
date: 2000/03/15 07:18:15;  author: mckusick;  state: Exp;  lines: +4 -4
Bug fixes for currently harmless bugs that could rise to bite
the unwary if the code were called in slightly different ways.

[...]

2) In ufs_lookup() there is an off-by-one error in the test that checks
if dp->i_diroff is outside the range of the the current directory size.
This is completely harmless, since the following while-loop condition
'dp->i_offset < endsearch' is never met, so the code immediately
does a second pass starting at dp->i_offset = 0.

3) Again in ufs_lookup(), the condition in a sanity check is wrong
for directories that are longer than one block. This bug means that
the sanity check is only effective for small directories.

Submitted by:   Ian Dowse <iedowse@maths.tcd.ie>

==

date: 2000/03/09 18:54:59;  author: dillon;  state: Exp;  lines: +2 -2
branches:  1.33.2;
    In the 'found' case for ufs_lookup() the underlying bp's data was
    being accessed after the bp had been releaed.  A simple move of the
    brelse() solves the problem.

Approved by: jkh
Submitted by:  Ian Dowse <iedowse@maths.tcd.ie>

==
2001-02-26 20:25:11 +00:00
lukem 5694890732 convert to ANSI KNF 2001-02-26 18:09:20 +00:00
lukem ae86fc2df2 some KNF 2001-02-26 17:12:08 +00:00
cgd 4dddddfe62 fix bug (pointed out as sequence point violation warning with current-ish gcc)
caused by use of makedev(major,minor++).  makedev() now (since 32-bit
dev_t conversion) evaluates its second argument twice.
2001-02-24 00:05:22 +00:00
eeh d0eaafc17f Use int32_t for on-disk time_t values. 2001-02-23 02:25:10 +00:00
chs 5e3caa8b52 skip truncating a file to 0 before freeing it if it's already zero-length. 2001-02-18 20:17:04 +00:00
chs 77b8e1c11d fix the range args to pgo_flush() in the error path of ufs_balloc_range(). 2001-02-18 20:13:29 +00:00
chs 31f045ca75 remove debug code that was left in by accident. 2001-02-07 22:40:06 +00:00
tsutsui ec8b1c000e Fix nested extern declaration of prtactive. 2001-02-07 12:40:43 +00:00