Commit Graph

2533 Commits

Author SHA1 Message Date
hannken d7f9016c8c Bring back read-write to read-only mount update for ffs. 2017-03-01 10:46:43 +00:00
hannken 61b2de1d70 Remove now redundant calls to fstrans_start()/fstrans_done(). 2017-03-01 10:41:28 +00:00
hannken a378d58ecb Enable fstrans on all file systems.
Welcome to 7.99.61
2017-02-22 09:50:13 +00:00
hannken 326db3aaf6 Add generic genfs_suspendctl() and use it for all file systems.
Layered file systems need work.
2017-02-17 08:31:23 +00:00
hannken 7599fb1f37 Bring back vrele_flush() to flush deferred vrele() o an suspended file system. 2017-02-17 08:30:00 +00:00
hannken 64a4d4bd11 Untangle VFS_SYNC() from VFS_SUSPENDCTL(). 2017-02-17 08:29:11 +00:00
hannken 1740eca04e Flush the log to disk when ffs_sync() gets called with MNT_WAIT. 2017-02-17 08:26:41 +00:00
kre 65dda4ca5a Sprinkle in a pinch of const, not too much, just enough
to add a little strength without affecting the overall balance...
2017-02-09 04:37:35 +00:00
rin ccc9d98e52 Add smaller versions of fsck_ffs(8) and newfs(8) for install media, where
support for Endian-Independent FFS and Apple UFS is disabled unless FFS_EI=1
and APPLE_UFS=1 are added to CRUNCHENV, respectively.

This reduces the size of ramdisk image for atari by over 15KB.

Thanks tsutsui and christos for their useful comments.
2017-02-08 16:11:39 +00:00
christos 6a20f05bb9 Fix unsigned 2017-01-13 18:04:36 +00:00
christos 31613a05ed fix sign confusion 2017-01-12 18:40:02 +00:00
hannken 836eaad2e3 Change ufs_truncate_retry() to call UFS_TRUNCATE() at least once.
Even with "newsize == ip->i_size" it must set mtime etc.

Adresses PR kern/51762 "mtime not updated by open(O_TRUNC)"
2017-01-04 10:04:17 +00:00
hannken 958c9321b9 Fix a bug introduced with Rev. 1.294: use LK_NOWAIT when called with MNT_LAZY. 2016-12-27 10:54:38 +00:00
riastradh 9a6283711b KASSERT(mutex_owner(...)) ---> KASSERT(mutex_owned(...)) 2016-11-20 21:22:14 +00:00
riastradh 5f60d884f2 KASSERT(mutex_owner(...)) ---> KASSERT(mutex_owned(...))
Fixes part of PR kern/47114.  Tested by code inspection.
2016-11-20 21:21:26 +00:00
jdolecek 3d6f4a8817 fix !WAPBL variant of UFS_WAPBL_REGISTER_DEALLOCATION() 2016-11-11 22:59:26 +00:00
hannken 3a541ed229 Fix a "slight tweak" from Rev. 1.121: bap1/bap2 must be valid
before using BAP_ASSIGN().

Prevents NULL pointer dereference when "lastbn >= 0".
2016-11-11 10:50:16 +00:00
jdolecek f9c82ee8e7 disable discard when log is enabled to preserve log consistency promise
PR kern/50725
2016-11-10 22:19:23 +00:00
jdolecek 86e8a3aae2 during truncate with wapbl, register deallocation for upper indirect block
before recursing into lower blocks, to make sure that it will be removed after
all its referenced blocks are removed

fixes 'ffs_blkfree_common: freeing free block' panic triggered by
ufs_truncate_retry() when just the upper indirect block registration failed,
code tried to free the lower blocks again after wapbl flush

problem found by hannken@, thank you
2016-11-10 20:56:32 +00:00
jdolecek 6730f31e00 ffs_indirtrunc(): for !wapbl, restore rev 1.117 behavior of writing the zeroed
(indirect) block before freeing the referenced blocks; it's necessary for
fsck to recover the filesystem, if system goes down during truncate

patch courtesy of hannken@ with only sligh tweaks
2016-11-10 19:10:05 +00:00
dholland 7b5c072bc8 Apply ufs_extattr.c 1.48:
Explain why the lock in here needs to be recursive. Related to PR 46997.

ufs_extattr 1.47 was also committed directly here, so this file is still
fully synced with it.
2016-11-09 05:44:42 +00:00
dholland 5cbfa154c2 Explain why the lock in here needs to be recursive. Related to PR 46997. 2016-11-09 05:08:35 +00:00
dholland 1fd0461870 ufs_makeinode is declared file-static at the top of the file; mark it
at its definition too, for consistency and to avoid misleading casual
passersby.
2016-11-09 04:12:55 +00:00
jdolecek d16cae2351 fix broken test for partial truncate, introduced in rev 1.118
PR kern/51601 kern/51602
2016-11-07 21:14:23 +00:00
jdolecek 84ac775fb4 reduce diff vs 1.117, no functional change 2016-11-07 21:05:38 +00:00
christos 805187f5b9 Tidy up panic messages, no functional change. 2016-10-30 15:01:46 +00:00
jdolecek b695bc874e reorganize ffs_truncate()/ffs_indirtrunc() to be able to partially
succeed; change wapbl_register_deallocation() to return EAGAIN
rather than panic when code hits the limit

callers changed to either loop calling ffs_truncate() using new
utility ufs_truncate_retry() if their semantics requires it, or
just ignore the failure; remove ufs_wapbl_truncate()

this fixes possible user-triggerable panic during truncate, and
resolves WAPBL performance issue with truncates of large files

PR kern/47146 and kern/49175
2016-10-28 20:38:12 +00:00
jdolecek 3c9f488da8 revert 1.141 - the second ffs_truncate() can't really fail
requested by hannken@
2016-10-21 19:28:03 +00:00
jdolecek e1aea9a285 allow also the snapshot_setup()'s call to ffs_truncate() fail, the code
should simply reuse the file blocks in that case; also make sure the
ffs_truncate() call is run within transaction if log is on
2016-10-20 20:17:46 +00:00
jdolecek 7470816b2a add assertion to ensure ffs_cgupdate() is always called from
within a WAPBL transaction (if logging is on)
2016-10-20 19:31:32 +00:00
christos e433d111ad Grr, the optimizer on mips64 can't handle this... Use MIN_PAGE_SIZE. 2016-10-04 16:46:20 +00:00
christos 44548039a1 use __func__ and print the filesystem we are printing the message for. 2016-10-02 19:02:57 +00:00
jdolecek 16c7d9d735 allocate wapbl dealloc registration structures via pool, so that there is more
flexibility with limit handling
2016-10-01 13:15:45 +00:00
jdolecek 8de0ca1330 wapbl_remove_log(): add missing break; harmless, fallthrough just printed
extra debug message
2016-10-01 13:06:20 +00:00
jdolecek 9a0d9b14e1 adjust ffs_realloccg() so that the logic about allocating full
contiguous block for future fragment expansion doesn't need to
UFS_WAPBL_REGISTER_DEALLOCATION() or ffs_blkfree(); the free blocks
are now immediatelly available for use by the expanding file in further i/o

primary driver is safe removal of the deallocation registration and
hence failure point, but this also fixes degenerate case for wapbl,
and similar also for discard - if the file would be actually expanded
before wapbl commit, or before discard queue would be processed,
the filesystem would not yet see the contiguous free blocks, and
would be forced to allocate another fragment elsewhere
2016-09-25 17:14:59 +00:00
jdolecek ae4b9ec77b fix typo in #ifdef notyet part 2016-09-25 11:45:39 +00:00
jdolecek 7b230d53d8 fix swapped KASSERT() 2016-09-24 21:00:54 +00:00
jdolecek f082cd3f0b i/o optimization for wapbl flush - only sync superblock and cgs when
they were actually changed
2016-09-24 20:59:51 +00:00
christos 7a68f84aa4 put back second strlcpy; pointed out by dholland. 2016-08-25 07:18:35 +00:00
christos 36b34638d9 CID 1371648: off by one in index checking
KNF.
2016-08-23 06:40:54 +00:00
christos 9d3a5ca7ac KNF, no functional change 2016-08-23 06:40:25 +00:00
christos d7191ea7c2 CID 1371644: use strlcpy, remove dup copy. 2016-08-23 06:24:30 +00:00
christos 67894636ac CID 1371645: remove dead code 2016-08-23 06:23:26 +00:00
jdolecek 54bc00f99d fix code which sets REV1 e2fs_fsmnt, set also mount time and mount count 2016-08-20 21:22:25 +00:00
jdolecek 34f2997571 adjust ext2fs_loadvnode_content() to do the sanity checking before allocating
memory, and avoid reallocaing memory on vnode reload
2016-08-20 20:05:28 +00:00
jdolecek fa4a02b45a modify the comment to note code needs to brele() to have a shot on actually
working
2016-08-20 19:53:43 +00:00
jdolecek cd053bea0c #if 0 the check for ext2fs_mapsearch() failure (similar what was done
for ffs counterpart), it actually never fails, it panics instead
2016-08-20 19:51:50 +00:00
jdolecek 1a50fd75de add support for GDT_CSUM AKA uninit_bg feature 2016-08-20 19:47:44 +00:00
jdolecek 7546c749f2 whitespace fix 2016-08-20 19:45:20 +00:00
hannken 7139aab724 Remove now obsolete operation vcache_remove().
Welcome to 7.99.36
2016-08-20 12:37:06 +00:00
jdolecek 39cc5f5a3f fix bug introduced in rev 1.82 of ext2fs_lookup.c, when ext2fs_add_entry()
was introduced splitting code from ext2fs_direnter() - code used
incorrect new entry size, leading to incomplete entry copy or buffer
overflow; fixed by passing the right size from ext2fs_direnter()
2016-08-19 00:05:43 +00:00
jdolecek 6ab7375654 EXT2F_INCOMPAT_FLEX_BG feature actually doesn't require any explicit
code changes, all magic is done by setting the block offsets appropriately
in group descriptors by newfs; add it to the list of supported INCOMPAT flags
2016-08-15 18:46:11 +00:00
jdolecek a9097f8578 bump link limit to 65000 for files, and add support for EXT2F_ROCOMPAT_DIR_NLINK to make link count unlimited for directories 2016-08-15 18:38:10 +00:00
jdolecek 0471133b8d adjust ext2fs_makeinode() so that the direnter is optional, use the function (with the direnter off) in ext2fs_mkdir() instead of the code copy; adjust ext2fs_makeinode() to initialize extra_isize and set creation time, if supported by the filesystem 2016-08-15 18:29:34 +00:00
jdolecek 008c8916aa when converting on-disk direntry, only use the on-disk filetype if the feature flag is present 2016-08-14 11:46:05 +00:00
jdolecek 35875a51bc switch code to use the EXT2_HAS_{COMPAT|ROCOMPAT|INCOMPAT}_FEATURE() macros instead of open coding the checks 2016-08-14 11:44:54 +00:00
jdolecek 03d15df771 switch ext2fs_htree_has_idx() over to EXT2F_HAS_COMPAT_FEATURE() and remove EXT2F_HAS_COMPAT_FEATURE() - this also fixes it for BE machines, as EXT2F_HAS_COMPAT_FEATURE() did extra byte swap; also remove XXX comment about IN_E3INDEX 2016-08-14 11:42:50 +00:00
jdolecek 6bd2592f36 add EXT2F_HAS_ROCOMPAT_FEATURE() macro, and change the current EXT2F_HAS_{COMPAT|INCOMPAT}_FEATURE() to take fs as first parameter 2016-08-14 11:40:31 +00:00
jdolecek e393710782 again remove IN_E4EXTENTS; it's not used anywhere any more, and it's better to keep fs-specific flags out of generic headers anyway 2016-08-14 11:31:41 +00:00
jdolecek 437b8a430a whitespace cleanup 2016-08-14 11:26:35 +00:00
jdolecek 9a22ef9e75 check correct inode extents flag - IN_E4EXTENTS is defined as 0x8000, correct flag EXT2_EXTENTS is 0x80000 2016-08-14 11:25:36 +00:00
christos 01d303e744 KNF, no functional changes... 2016-08-13 07:40:10 +00:00
christos 8378c129b0 sync with hrishi's git 2016-08-13 07:25:29 +00:00
macallan 034ad7ec18 cast pointers to uintptr_t before comparing them, also ()s
now this at least compiles
2016-08-12 20:30:15 +00:00
macallan fd4db18413 sprinkle ()s in macros with comparisons, shuts up compiler warnings 2016-08-12 20:26:15 +00:00
jdolecek 2058250b3f add support for extended attributes in ext2fs for ext3/ext4; read-only for now 2016-08-12 19:04:03 +00:00
kre 58de1f8cbe Undo revert now Christos has added the missing glue... 2016-08-09 21:08:02 +00:00
christos 998fd93a6d merge missing function. 2016-08-09 20:18:08 +00:00
kre a25bc2ccdc Revert previous. This work isn't complete enough to include yet,
and the build of current really does need to go back to a working state.
2016-08-09 20:03:05 +00:00
kre 09e85cd4b1 Revert previous - which itself (incorrectly) reverted the previous
changes, breaking the build.
2016-08-09 13:18:50 +00:00
christos 50b9c754b0 More htree writing support (Hrishikesh Goyal GSoC 2016) 2016-08-09 07:15:35 +00:00
christos 0bed509624 KNF 2016-08-09 06:40:24 +00:00
dholland 96374a6fa7 Remove unused <sys/tree.h> 2016-08-07 05:09:12 +00:00
dholland 23132aeaca Fix stupid thinko. 2016-08-07 02:42:32 +00:00
dholland 5a9be9571b comments 2016-08-07 02:31:03 +00:00
kre 4cf5cc5427 If using constants from dirent.h it ought to be included.
Hopefully fixes i386 build.
2016-08-07 01:47:11 +00:00
dholland fbc1063cb6 use static properly 2016-08-07 00:25:22 +00:00
dholland 5251c78329 Comments 2016-08-07 00:12:48 +00:00
jdolecek 8e39032fbb actually pass the d_type from the on-disk directory entry to the lookup results 2016-08-06 21:39:48 +00:00
dholland f048ac5803 typo in comment 2016-08-06 20:42:29 +00:00
jdolecek 118d3ec761 some more inode flags 2016-08-06 09:29:28 +00:00
jdolecek 5f1e3b3190 add defines for the missing ext4 feature flags 2016-08-05 21:22:06 +00:00
jdolecek 954e54d738 PR kern/7867 add support for UF_NODUMP flag to ext2fs 2016-08-05 20:15:41 +00:00
jdolecek 5b3ce9d448 add devel ifndefs for incompat/rocompat features so that it's possible
to ignore them and mount the filesystem; default is for the mount to fail
2016-08-05 20:06:55 +00:00
jdolecek bddc3c1201 make E2MAXSYMLINKLEN just alias for EXT2_MAXSYMLINKLEN, they are the same 2016-08-04 17:50:51 +00:00
jdolecek 2f2ae0277c move i_e2fs_* defines from ufs/inode.h to ext2fs/ext2fs_dinode.h, where they belong; they don't seem to be used anywhere else then ext2fs code any more 2016-08-04 17:47:47 +00:00
jdolecek 249e8f5f7e rename struct ext2fs_dinode attribute e2di_dacl to correct
e2di_size_high; even Linux ext2 filesystem code actually uses it
unconditionally this way and ext4 code finally also calls it that way
in their struct definition too; if there was any trace of this for other
purpose it's long gone
2016-08-04 17:43:47 +00:00
nonaka c3d0e08698 include stddef.h for offsetof.
fix newfs_ext2fs build failure on evbppc.
2016-08-04 04:05:14 +00:00
nonaka 96da721ffb pass isize to e2fs_i_bswap() if BYTE_ORDER != LITTLE_ENDIAN. 2016-08-04 02:49:50 +00:00
pgoyette 31baab5623 Update previous. Since original format was %llu, replace it with
% PRIu64 (unsigned).
2016-08-03 23:33:59 +00:00
jdolecek fa408750f2 get and set expanded timestamp if the inode contains the extra information, add support for create time 2016-08-03 23:29:05 +00:00
pgoyette 5cc4ca2173 Use correct printf() format for inode (fixes build for me) 2016-08-03 23:28:01 +00:00
jdolecek 966755011f support arbitrary ext3/ext4 inode size, add all the new ext4 fields ext2fs_dinode, and add support for loading the extra inode data 2016-08-03 21:53:02 +00:00
jdolecek 8601c2c343 adjust the comments for on-disk ext2fs inode to indicate which of the ext* was it implemented for linux kernel; makes it a bit easier to locate
split e2di_linux_reserved3 with e2di_extra_isize and e2di_checksum_high, tag as ext4
2016-08-02 17:36:02 +00:00
jdolecek 1f7e7b3174 do not bswap fragment address, support in ext* for them was never actually implemented in linux kernels 2016-08-02 17:24:24 +00:00
martin f0b8f9c13b From Michael Plass:
The superblock field that distinguishes between 4.2BSD and 4.4BSD
inodes is really only relevant on a UFS1 file system. Make sure that
it is a UFS1 fs before using fs_old_inodefmt.

Note that the NetBSD newfs and mkfs utilities initialize fs_old_inodefmt
even for UFS2, so problems were apparent only on file systems created
by other operating systems, for example, FreeBSD.
2016-07-28 08:24:58 +00:00
christos 90668226c4 Don't do variable stack allocations for systems with non-const PAGE_SIZE;
instead assume that the smallest pagesize is 1024.
2016-07-21 18:10:47 +00:00
maya 407bb4505c Fix a deadlock
ok dholland@
2016-07-13 16:26:26 +00:00
msaitoh 8bc54e5be6 KNF. Remove extra spaces. No functional change. 2016-07-07 06:55:38 +00:00
christos 26c7e22f4a GSoC 2016 (Hrishikesh Goyal): Htree index support from FreeBSD 2016-06-24 17:21:30 +00:00