History log of /src/sbin/fsck_lfs/segwrite.c |
Revision | | Date | Author | Comments |
1.48 |
| 14-May-2020 |
msaitoh | branches: 1.48.8; Remove extra semicolon.
|
1.47 |
| 03-Apr-2020 |
joerg | Avoid common symbols for fsck_lfs.
|
1.46 |
| 10-Jun-2017 |
pgoyette | branches: 1.46.6; Update inode member i_flag --> i_state to keep up with kernel changes
|
1.45 |
| 03-Oct-2015 |
dholland | branches: 1.45.8; Use IINFO in lfs_writeinode(). (both the kernel and the userland copies)
|
1.44 |
| 01-Sep-2015 |
dholland | Use daddr_t, not ulfs_daddr_t, as the latter's 32 bits wide. Don't use either for on-disk items. Declare external data in header files. Part 3 of 3.
|
1.43 |
| 01-Sep-2015 |
dholland | Use the lfs dinode accessors in place of the ufs-derived ones. (Mostly.)
The ufs-derived ones are fake structure member macros, which are gross and not very safe. Also, it seems that a lot of places in the lfs code were using the ffsv1 branch of them unconditionally, and this way it's guaranteed all those places have been updated.
Found while doing this: for non-devices, have getattr produce NODEV in the rdev field instead of leaking the address of the first direct block.
|
1.42 |
| 19-Aug-2015 |
dholland | Part two of dinodes; use the same union everywhere. (previously the ufs-derived code had things set up slightly different)
Remove a bunch of associated mess.
|
1.41 |
| 12-Aug-2015 |
dholland | Hack up dinode usage to be 64 vs. 32 as needed. Part 1.
(This part changes the native lfs code; the ufs-derived code already has 64 vs. 32 logic, but as aspects of it are unsafe, and don't entirely interoperate cleanly with the lfs 64/32 stuff, pass 2 will be rehashing that.)
|
1.40 |
| 12-Aug-2015 |
dholland | Provide 32-bit and 64-bit versions of FINFO.
This also entailed sorting out part of struct segment, as that contains a pointer into the current FINFO data.
|
1.39 |
| 12-Aug-2015 |
dholland | Make 32-bit and 64-bit versions of SEGSUM. Also fix some of the FINFO handling as it's closely entangled.
|
1.38 |
| 12-Aug-2015 |
dholland | Add IFILE32 and IFILE64 structures for the on-disk ifile entries. Add and use accessors. There are also a bunch of places that cast and I hope I've found them all...
|
1.37 |
| 12-Aug-2015 |
dholland | Make 32-bit and 64-bit versions of CLEANERINFO.
XXX: while this is written to disk, it seems like much of it would XXX: be better set up as a commpage shared with the cleaner.
|
1.36 |
| 02-Aug-2015 |
dholland | Add a (draft) 64-bit superblock. Make things build again.
Add pieces of support for using both superblock types where convenient, and specifically to the superblock accessors, but don't actually enable it anywhere.
First substantive step on PR 50000.
|
1.35 |
| 02-Aug-2015 |
dholland | Use accessor functions for the version field of the lfs superblock. I thought at first maybe the cases that test the version should be rolled into the accessors, but on the whole I think the conclusion on that is no.
|
1.34 |
| 28-Jul-2015 |
dholland | Add a new lfs header file: lfs_accessors.h.
This contains all the accessor functions and macros out of lfs.h. Add an include of lfs_accessors.h after all uses of lfs.h... except for code that wants to define its own struct lfs-alike that the accessors are supposed to play along with. For these, set STRUCT_LFS and include lfs_accessors.h after the necessary structure has been defined, so that lfs_accessors.h can emit functions in terms of it.
|
1.33 |
| 24-Jul-2015 |
dholland | More lfs superblock accessors. (This changes the rest of the code over; all the accessors were already added.)
The difference between this commit and the previous one is arbitrary, but the previous one passed the regression tests on its own so I'm keeping it separate to help with any bisections that might be needed in the future.
|
1.32 |
| 24-Jul-2015 |
dholland | Switch to accessor functions for elements of the LFS on-disk superblock. This will allow switching between 32/64 bit forms on the fly; it will also allow handling LFS_EI reasonably tidily. (That currently doesn't work on the superblock.)
It also gets rid of cpp abuse in the form of fake structure member macros.
Also, instead of doing sleep/wakeup on &lfs_avail and &lfs_nextseg inside the on-disk superblock, add extra elements to the in-memory struct lfs for this. (XXX: these should be changed to condvars, but not right now)
XXX: this migrates a structure needed by the lfs code in libsa (struct salfs) into lfs.h, where it doesn't belong, but for the time being this is necessary in order to allow the accessors (and the various lfs macros and other goop that relies on them) to compile.
|
1.31 |
| 17-Jun-2015 |
christos | add missing ;
|
1.30 |
| 16-Jun-2015 |
christos | fix error messages containing \n
|
1.29 |
| 31-May-2015 |
hannken | Use VFS_PROTOS() for lfs. Rename conflicting struct lfs field "lfs_start" to "lfs_s0addr".
No functional change.
|
1.28 |
| 29-Mar-2015 |
chopps | - Fix fallout for recent bread() change (removing cred arg).
|
1.27 |
| 19-Oct-2013 |
christos | fix unused variable warnings.
|
1.26 |
| 18-Jun-2013 |
christos | Prefix most of the cpp macros with lfs_ and LFS_ to avoid conflicts with ffs. This was done so that boot blocks that want to compile both FFS and LFS in the same file work.
|
1.25 |
| 08-Jun-2013 |
dholland | Tidy up the LFS userland build hacks. Don't use -I${NETBSDSRCDIR}/sys; don't include files other than the exported LFS headers, which are lfs.h, lfs_inode.h, and (for now) lfs_extern.h.
|
1.24 |
| 08-Jun-2013 |
dholland | Move the dinode (on-disk inode) structures to lfs.h, since they are and will be obviously required by userland tools that need to read the on-disk structures.
Also, DINODE{1,2}_SIZE -> LFS_DINODE{1,2}_SIZE.
|
1.23 |
| 06-Jun-2013 |
dholland | Cleanups and hacks to make lfs userland stuff build: - lfs_cksum.c doesn't actually need ulfs_inode.h any more. - neither does lfs_itimes.c. - add hacks to fsck_lfs to make it compile. - add hacks to newfs_lfs to make it compile. - fix warning in ulfs_quota.c when quotas are fully disabled (as I guess is happening with the rumpity version)
XXX: This commit adds -I${NETBSDSRCDIR}/sys to the Makefiles for XXX: fsck_lfs, newfs_lfs, and lfs_cleanerd. This needs to be cleaned XXX: up ASAP; but I consider this less problematic in the short term XXX: than spewing ulfs_*.h into /usr/include.
|
1.22 |
| 06-Jun-2013 |
dholland | ufs -> ulfs for fsck_lfs.
|
1.21 |
| 22-Jan-2013 |
dholland | Stuff UFS_ in front of a few of ufs's symbols to reduce namespace pollution. Specifically: ROOTINO -> UFS_ROOTINO WINO -> UFS_WINO NXADDR -> UFS_NXADDR NDADDR -> UFS_NDADDR NIADDR -> UFS_NIADDR MAXSYMLINKLEN -> UFS_MAXSYMLINKLEN MAXSYMLINKLEN_UFS[12] -> UFS[12]_MAXSYMLINKLEN (for consistency)
Sort out ext2fs's misuse of NDADDR and NIADDR; fortunately, these have the same values in ext2fs and ffs.
No functional change intended.
|
1.20 |
| 16-Feb-2010 |
mlelstv | branches: 1.20.6; 1.20.12; Three changes in a single commit.
- drop the notion of frags (LFS fragments) vs fsb (FFS fragments) The code uses a complicated unity function that just makes the code difficult to understand.
- support larger sector sizes. Fix disk address computations to use DEV_BSIZE in the kernel as required by device drivers and to use sector sizes in userland.
- Fix several locking bugs in lfs_bio.c and lfs_subr.c.
|
1.19 |
| 16-May-2008 |
hannken | Make sure all cached buffers with valid, not yet written data have been run through copy-on-write. Call fscow_run() with valid data where possible.
The LP_UFSCOW hack is no longer needed to protect ffs_copyonwrite() against endless recursion.
- Add a flag B_MODIFY to bread(), breada() and breadn(). If set the caller intends to modify the buffer returned.
- Always run copy-on-write on buffers returned from ffs_balloc().
- Add new function ffs_getblk() that gets a buffer, assigns a new blkno, may clear the buffer and runs copy-on-write. Process possible errors from getblk() or fscow_run(). Part of PR kern/38664.
Welcome to 4.99.63
Reviewed by: YAMAMOTO Takashi <yamt@netbsd.org>
|
1.18 |
| 28-Apr-2008 |
martin | branches: 1.18.2; Remove clause 3 and 4 from TNF licenses
|
1.17 |
| 10-Oct-2007 |
ad | branches: 1.17.8; 1.17.10; Merge from vmlocking:
- Split vnode::v_flag into three fields, depending on field locking. - simple_lock -> kmutex in a few places. - Fix some simple locking problems.
|
1.16 |
| 08-Oct-2007 |
ad | Give brelse() a second argument so that it matches the kernel. fsck_lfs now compiles again.
|
1.15 |
| 09-Nov-2006 |
christos | branches: 1.15.8; Fix malloc/realloc/calloc issues: always check and exit, use EEXIT instead of 8.
|
1.14 |
| 01-Sep-2006 |
perseant | Several fixes to improve the reliability of the roll-forward agent. Also, note "properly orphaned" files as distinct from corrupted files.
|
1.13 |
| 18-Jul-2006 |
perseant | Various improvements to fsck_lfs, to wit:
* Add lfs_balloc capability to the lfs library. * Extend the Ifile if we run out of free inodes when creating lost+found. * Don't roll forward if we have allocated a lost+found, to avoid conflicts when adding new files in roll-forward. * Make some messages slightly more verbose (e.g. include inode number, and use pwarn() instead of printf() so the messages include the device name when preening). * Change superblock detection/avoidance to use the offset table in the primary superblock, rather than looking at the contents. * Be more verbose about various operations when passed the -d flag, especially roll-forward. * Be more careful about dirops during roll forward, since the cleaner can sometimes write blocks from dirop vnodes. Detect and avoid this problem. * Always check the free list, even if given -i; if we're going to write it we have to check it first. * Mark inodes dirty when blocks are found during roll forward, so the inodes are written with the new block locations. * Update size of inodes if blocks beyond EOF are found during roll forward. * Fix segment accounting for blocks and inodes found during roll forward. * Report statistics on roll forward: how many new/deleted/moved files and how many updated blocks (or "nothing new"). * Don't care if the device being checked is really a device, if we have been passed the -f flag (to facilitate automated testing). * When writing to the disk, use the current time in the segment headers rathern than time 0. * When passed the -i flag, locate the partial segment containing the Ifile inode and use that to calculate lfs_offset, lfs_curseg, lfs_nextseg. (Again for automated testing.)
|
1.12 |
| 23-May-2006 |
jnemeth | Coverity CID 3447: Add extraneous checks to shut up Coverity.
|
1.11 |
| 17-Mar-2006 |
rumble | Check for allocation failures in malloc, calloc, realloc, asprintf, and vasprintf and try to handle them.
|
1.10 |
| 13-Sep-2005 |
christos | rename lfs.h to lfs_user.h so that it does not conflict.
|
1.9 |
| 01-Apr-2005 |
he | Move the definition of simple_lock() and simple_unlock() to a common header, since more of the LFS macros now use these functions. Since we're outside of the kernel, these are defined to be empty.
|
1.8 |
| 25-Mar-2005 |
perseant | "#define lfs_devvp lfs_unlockvp" for readability, since that's what we use it for in fsck_lfs/newfs_lfs.
|
1.7 |
| 26-Feb-2005 |
perseant | branches: 1.7.2; Various minor LFS improvements:
* Extend the lfs library from fsck_lfs(8) so that it can be used with a not-yet-existent LFS. Make newfs_lfs(8) use this library, so it can create LFSs whose Ifile is larger than one segment. * Make newfs_lfs(8) use strsuftoi64() for its arguments, a la newfs(8). * Make fsck_lfs(8) respect the "file system is clean" flag. * Don't let fsck_lfs(8) think it has dirty blocks when invoked with the -n flag.
|
1.6 |
| 24-Dec-2003 |
heas | branches: 1.6.4; Check result of malloc(). reviewed by Martin.
|
1.5 |
| 07-Aug-2003 |
agc | Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22308, verified by myself.
|
1.4 |
| 12-Jul-2003 |
yamt | don't use uninitialized variables. PR/22123 (Izumi Tsutsui)
|
1.3 |
| 02-Apr-2003 |
fvdl | Add support for UFS2. UFS2 is an enhanced FFS, adding support for 64 bit block pointers, extended attribute storage, and a few other things.
This commit does not yet include the code to manipulate the extended storage (for e.g. ACLs), this will be done later.
Originally written by Kirk McKusick and Network Associates Laboratories for FreeBSD.
|
1.2 |
| 31-Mar-2003 |
perseant | Check inode free list tail pointer as well as head pointer, and write both into the CLEANERINFO block of the Ifile as well as into the superblock. Make preen update both superblocks.
|
1.1 |
| 28-Mar-2003 |
perseant | Add working writing ability to fsck_lfs, including roll-forward, based on a partial-segment writer ported from the kernel.
|
1.6.4.1 |
| 10-May-2005 |
riz | Pull up the following revisions (requested by perseant in ticket #1281):
1.8 sys/ufs/lfs/TODO 1.75 sys/ufs/lfs/lfs.h (via patch) 1.74 sys/ufs/lfs/lfs_alloc.c (via patch) 1.49, 1.51 sys/ufs/lfs/lfs_balloc.c (1.51 via patch) 1.78 sys/ufs/lfs/lfs_bio.c 1.62 sys/ufs/lfs/lfs_extern.h (via patch) 1.156 sys/ufs/lfs/lfs_segment.c (via patch) 1.48 sys/ufs/lfs/lfs_subr.c 1.101 sys/ufs/lfs/lfs_syscalls.c 1.163 sys/ufs/lfs/lfs_vfsops.c (via patch) 1.134 sys/ufs/lfs/lfs_vnops.c (via patch) 1.61 sys/ufs/ufs/ufs_readwrite.c (via patch)
1.20 libexec/lfs_cleanerd/clean.h (via patch) 1.52 libexec/lfs_cleanerd/cleanerd.c (via patch) 1.41 libexec/lfs_cleanerd/library.c (via patch)
1.4 regress/sys/fs/lfs/newfs_fsck/Makefile 1.2 regress/sys/fs/lfs/newfs_fsck/mkfs_mount 1.2 regress/sys/fs/lfs/newfs_fsck/smallfiles 1.3 sbin/fsck_lfs/bufcache.c 1.3 sbin/fsck_lfs/bufcache.h 1.3 sbin/fsck_lfs/lfs.h 1.8 sbin/fsck_lfs/lfs.c (via patch) 1.8 sbin/fsck_lfs/pass3.c (via patch) 1.18 sbin/fsck_lfs/pass0.c (via patch) 1.18 sbin/fsck_lfs/utilities.c (via patch) 1.7 sbin/fsck_lfs/segwrite.c 1.19 sbin/fsck_lfs/setup.c (via patch) 1.3 sbin/newfs_lfs/Makefile 0 sbin/newfs_lfs/lfs.c (yes, remove it) 1.1 sbin/newfs_lfs/make_lfs.c 1.15 sbin/newfs_lfs/newfs.c (via patch)
Various minor LFS improvements.
Kernel:
* Note when lfs_putpages(9) thinks it is not going to be writing any pages before calling genfs_putpages(9). This prevents a situation in which blocks can be queued for writing without a segment header. * Correct computation of NRESERVE(), though it is still a gross overestimate in most cases. Note that if NRESERVE() is too high, it may be impossible to create files on the filesystem. We catch this case on filesystem mount and refuse to mount r/w. * Allow filesystems to be mounted whose block size is == MAXBSIZE. * Somewhere along the line, ufs_bmaparray(9) started mangling UNWRITTEN entries in indirect blocks again, triggering a failed assertion "daddr <= LFS_MAX_DADDR". Explicitly convert to and from int32_t to correct this. Should fix PR #29045. * Add a high-water mark for the number of dirty pages any given LFS can hold before triggering a flush. This is settable by sysctl, but off (zero) by default. * Be more careful about the MAX_BYTES and MAX_BUFS computations so we shouldn't see "please increase to at least zero" messages. * Note that VBLK and VCHR vnodes can have nonzero values in di_db[0] even though their v_size == 0. Don't panic when we see this. Fixes PR #26680. * Change lfs_bfree to a signed quantity. The manner in which it is processed before being passed to the cleaner means that sometimes it may drop below zero, and the cleaner must be aware of this. * Never report bfree < 0 (or higher than lfs_dsize) through lfs_statfs(9). This prevents df(1) from ever telling us that our full filesystems have 16TB free. * Account space allocated through lfs_balloc(9) that does not have associated buffer headers, so that the pagedaemon doesn't run us out of segments. * Return ENOSPC from lfs_balloc(9) when bfree drops to zero. * Address a deadlock in lfs_bmapv/lfs_markv when the filesystem is being unmounted. Because vfs_busy() is a shared lock, and lfs_bmapv/lfs_markv mark the filesystem vfs_busy(), the cleaner can be holding the lock that umount() is blocking on, then try to vfs_busy() again in getnewvnode().
cleaner:
* Adapt lfs_cleanerd to use the fcntl call to get the Ifile filehandle, so it need not be in the namespace. * Make lfs_cleanerd be more careful when there are very few available segments. * Make lfs_cleanerd less verbose when the filesystem is unmounted.
newfs_lfs, fsck_lfs, and regression:
* Extend the lfs library from fsck_lfs(8) so that it can be used with a not-yet-existent LFS. Make newfs_lfs(8) use this library, so it can create LFSs whose Ifile is larger than one segment. Addresses PR #11110. * Make newfs_lfs(8) use strsuftoi64() for its arguments, a la newfs(8). * Make fsck_lfs(8) respect the "file system is clean" flag. * Don't let fsck_lfs(8) think it has dirty blocks when invoked with the -n flag. * Remove the Ifile from the filesystem namespace. The cleaner now uses a fcntl call on the root inode to find the Ifile filehandle. (As a side-effect, addresses PR #29144.)
|
1.7.2.1 |
| 07-May-2005 |
tron | Apply patch (requested by perseant in ticket #242): * fsck_lfs buffer cache fixes, including PR #29151 * Change fsck_lfs phase 0 message to reflect reality * fsck_lfs: check phase 5 (cleanerinfo accounting) even on roll-forward * Keep better track of the free list during roll-forward, avoiding a core dump * Improve hash table use for fsck_lfs buffer and vnode cache * Document fsck_lfs flag -f, and implement -q * Add resize_lfs, including kernel support * Add LFS to mountd's list of exportable filesystem types * Make the LFS lkm work again [christos@] * Add MP locking to the LFS kernel subsystem * Fix pager_map deadlock in lfs_putpages() * Avoid incomplete file extension that looks like "partial truncation" to fsck * Use lfs_malloc for cleaner malloc, since the cleaner often runs in low-memory conditions. * Use splay trees, not hash table, to track page allocation for write. * Fix mkdir panic on full fs * Fix page accounting leak by counting differently. * Use rightly named structure for lfs_getattr [skrll@] * Cosmetic changes for readability.
|
1.15.8.1 |
| 06-Nov-2007 |
matt | sync with HEAD
|
1.17.10.1 |
| 18-May-2008 |
yamt | sync with head.
|
1.17.8.1 |
| 02-Jun-2008 |
mjf | Sync with HEAD.
|
1.18.2.1 |
| 23-Jun-2008 |
wrstuden | Sync w/ -current. 34 merge conflicts to follow.
|
1.20.12.3 |
| 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.20.12.2 |
| 23-Jun-2013 |
tls | resync from head
|
1.20.12.1 |
| 25-Feb-2013 |
tls | resync with head
|
1.20.6.2 |
| 22-May-2014 |
yamt | sync with head.
for a reference, the tree before this commit was tagged as yamt-pagecache-tag8.
this commit was splitted into small chunks to avoid a limitation of cvs. ("Protocol error: too many arguments")
|
1.20.6.1 |
| 23-Jan-2013 |
yamt | sync with head
|
1.45.8.1 |
| 30-Oct-2017 |
snj | Pull up following revision(s) (requested by maya in ticket #330): sbin/fsck_lfs/inode.c: 1.69 sbin/fsck_lfs/lfs.c: 1.73 sbin/fsck_lfs/pass6.c: 1.50 sbin/fsck_lfs/segwrite.c: 1.46 sys/ufs/lfs/lfs.h: 1.202-1.203 sys/ufs/lfs/lfs_accessors.h: 1.48 sys/ufs/lfs/lfs_alloc.c: 1.136-1.137 sys/ufs/lfs/lfs_balloc.c: 1.94 sys/ufs/lfs/lfs_bio.c: 1.141 sys/ufs/lfs/lfs_extern.h: 1.113 sys/ufs/lfs/lfs_inode.c: 1.156-1.157 sys/ufs/lfs/lfs_inode.h: 1.20, 1.21, 1.23 sys/ufs/lfs/lfs_itimes.c: 1.20 sys/ufs/lfs/lfs_pages.c: 1.13-1.15 sys/ufs/lfs/lfs_rename.c: 1.22 sys/ufs/lfs/lfs_segment.c: 1.270-1.275 sys/ufs/lfs/lfs_subr.c: 1.94-1.97 sys/ufs/lfs/lfs_syscalls.c: 1.175 sys/ufs/lfs/lfs_vfsops.c: 1.360 sys/ufs/lfs/lfs_vnops.c: 1.316-1.321 sys/ufs/lfs/ulfs_inode.c: 1.20 sys/ufs/lfs/ulfs_inode.h: 1.24 sys/ufs/lfs/ulfs_lookup.c: 1.41 sys/ufs/lfs/ulfs_quota2.c: 1.31 sys/ufs/lfs/ulfs_readwrite.c: 1.24 sys/ufs/lfs/ulfs_vnops.c: 1.49-1.50 Update inode member i_flag --> i_state to keep up with kernel changes Move definition of IN_ALLMOD near the flag it's a mask for. Now we can see that it doesn't match all the flags, but changing that will require more careful thought. Correct confusion between i_flag and i_flags These will have to be renamed. Spotted by Riastradh, thanks! Add an XXX about the missing flags so it's not buried in a commit message. now the XXX count for LFS is 260 Rename i_flag to i_state. The similarity to i_flags has previously caused errors. Use continue to denote the no-op loop to match netbsd style newline for extra clarity. It isn't safe to drain dirops with seglock held, it'll deadlock if there are any dirops. drain before grabbing seglock. lfs_dirops == 0 is always true (as we already drained dirops), so omit that part of the comparison. Fixes a lot of LFS deadlocks. PR kern/52301 Many thanks to dholland for help analyzing coredumps Ifdef out KDASSERT which fires on my machine. Deduplicate sanity check that seglock is held on segunlock Revert r1.272 fix to PR kern/52301, the performance hit is making things unusable. change lfs_nextsegsleep and lfs_allclean_wakeup to use condvar XXX had to use lfs_lock in lfs_segwait, removed kernel_lock, is this appropriate? fix buffer overflow/KASSERT when cookies are supplied lfs no longer uses the ffs-style struct direct, use the correct minimum size from dholland XXX more wrong Consistently use {,UN}MARK_VNODE macros rather than function calls. Not much point doing anything after a panic call Ask some question about the code in a XXX comment XXX question our double-flushing of dirops Fix typo in comment
|
1.46.6.1 |
| 08-Apr-2020 |
martin | Merge changes from current as of 20200406
|
1.48.8.2 |
| 06-Sep-2025 |
perseant | Separate buffer cache code between fsck_lfs and fsck_exfatfs. This may be reunited later, probably as a library.
|
1.48.8.1 |
| 29-Jun-2024 |
perseant | Implementation of exFAT filesystem, with compilation conditional on MKEXFATFS make variable.
|