summaryrefslogtreecommitdiff
path: root/libexec/lfs_cleanerd/lfs_cleanerd.c
AgeCommit message (Collapse)Author
2019-08-30Add support for passing the raw device name separate from thebrad
filesystem. This is useful in the case where the cleaner is compiled into code, such as rump_lfs and the ATF tests. This helps to fix bin/54488
2019-08-22Use getdiskrawname to find the device namebrad
Reviewed by Christos
2016-03-18move the compiler hack closer to the source of the failmrg
2016-03-16make the GCC 4.8 specific hack for ci.clean being set GCC >= 4.8.mrg
2016-02-19Need <stdbool.h> for true/false.riastradh
2015-10-15Enable lfs64 in the cleaner.dholland
2015-10-03Use IINFO in the cleaner.dholland
2015-09-01Add new accessors for the d_type and d_namlen fields of struct lfs_direct.dholland
Napalm the old byteswap access logic for these.
2015-09-01The ifile's inode number is constant. (it is always 1)dholland
Therefore, storing the value in the superblock and reading it out again is silly and offers the opportunity for it to become corrupted. So, don't do that (most of the code already didn't) and use the existing constant instead. Initialize new 32-bit superblocks with the value for the sake of old userland programs, but don't keep the value in the 64-bit superblock at all. (approved by Margo Seltzer)
2015-09-01Add byteswapping to the dinode accessors.dholland
This prevents regressions in the ulfs code when switching to the new accessors. Note that while adding byteswapping to the other accessors is straightforward, I haven't done it yet; and that also is not enough to make LFS_EI work, because there are places lying around that bypass the accessors for one reason and another and all of them need to be updated. That is going to have to wait for a later day as LFS_EI is not on the critical path right now.
2015-08-12Hack up dinode usage to be 64 vs. 32 as needed. Part 1.dholland
(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.)
2015-08-12Provide 32-bit and 64-bit versions of FINFO.dholland
This also entailed sorting out part of struct segment, as that contains a pointer into the current FINFO data.
2015-08-12Make 32-bit and 64-bit versions of SEGSUM.dholland
Also fix some of the FINFO handling as it's closely entangled.
2015-08-12Add IFILE32 and IFILE64 structures for the on-disk ifile entries.dholland
Add and use accessors. There are also a bunch of places that cast and I hope I've found them all...
2015-08-12Make 32-bit and 64-bit versions of CLEANERINFO.dholland
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.
2015-08-12Fix assorted 64->32 truncations related to BLOCK_INFO.dholland
Also make note of a cleaner limitation: it seems that when it goes to coalesce discontiguous files, it mallocs an array with one BLOCK_INFO for every block in the file. Therefore, with 64-bit LFS, on a 32-bit platform it will be possible to have files large enough to overflow the cleaner's address space. Currently these will be skipped and cause warnings via syslog. At some point someone should rewrite the logic to coalesce files to use chunks of some reasonable size, as discontinuity between such chunks is immaterial and mallocing this much space is silly and fragile. Also, the kernel only accepts up to 65536 blocks at a time for bmapv and markv, so processing more than this at once probably isn't useful and may not even work currently. I don't want to change this around just now as it's not entirely trivial.
2015-08-02Add a (draft) 64-bit superblock. Make things build again.dholland
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.
2015-08-02Use accessor functions for the version field of the lfs superblock.dholland
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.
2015-08-02Second batch of 64 -> 32 truncations in lfs, along with more minordholland
tidyups and corrections in passing.
2015-07-28Use lfs_accessors.h in conjunction with the cleaner's struct clfs.dholland
Remove previous hacks.
2015-07-24More lfs superblock accessors.dholland
(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.
2015-07-24Switch to accessor functions for elements of the LFS on-diskdholland
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.
2015-03-29- Fix fallout for recent bread() change (removing cred arg).chopps
2013-10-19fix unused variable warningschristos
2013-06-18Prefix most of the cpp macros with lfs_ and LFS_ to avoid conflicts with ffs.christos
This was done so that boot blocks that want to compile both FFS and LFS in the same file work.
2013-06-08Missed one of the -I${NETBSDSRCDIR}/sys hacks yesterday; remove it now.dholland
2013-06-08Move the dinode (on-disk inode) structures to lfs.h, since they aredholland
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.
2013-06-06ufs -> ulfs for lfs_cleanerddholland
2013-01-22Stuff UFS_ in front of a few of ufs's symbols to reduce namespacedholland
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.
2012-04-16Make load_threshold double and restore original value of 0.2.joerg
From NAKAJIMA Yoshihiro.
2012-04-12Don't assign non-integral constants to integral variables.joerg
2012-02-02Shut down the cleaner earlier if the filesystem is unmounted.perseant
2012-01-02In lfs_cleanerd, check errno earlier, to avoid premature exit when theperseant
real errno was EAGAIN. When coalescing, check against NULL to avoid seg fault.
2010-12-23Deduce raw device correctly by prepending "r" to basename.mlelstv
2010-08-16Don't exit when running as a lib after FS is unmounted, just returnpooka
from the mainloop.
2010-07-29Do the semaphore trick only if the cleaner is run as a lib -- thepooka
standard installation doesn't get linked against librt or libpthread.
2010-07-29Add a method for posting a semaphore when cleaner init has reachedpooka
the main loop. This is useful for very quickly executed lfs runs such as those in tests, as an initialization phase cleaner may prevent file system unmount.
2010-02-16Read the padded superblocks to avoid problems with disks that havemlelstv
larger sectors than 512 Bytes.
2009-10-09Attempt to recover slightly more gracefully if the kernel socket is shutdown.pooka
2009-08-06Define syscalls of lfs userspace tools (cleaner, mainly) throughpooka
a struct called kernelops, which contains standard system calls for the normal case and rump system calls for the rump case. Make it possible to run the lfs cleaner in a library fashion (taking the quick route with the implementation).
2009-08-06add D to getopt so that previous actually workspooka
2009-08-06add -D, which prompts to stay on foreground without debug spewagepooka
2009-08-06Check main loop fcntl return value and error out if it fails.pooka
Prevents e.g. from 5.0 cleaner looping forever against -current lfs driver (fcntl data structure sizes are different).
2009-03-16fix WARNS=3 issues;lukem
* sprinkle const * avoid tests < 0 on unsigned types * test fwrite() returns nmemb not <0
2009-03-15avoid a shadowed variablelukem
2008-05-16Make sure all cached buffers with valid, not yet written data have beenhannken
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>
2008-04-28Remove clause 3 and 4 from TNF licensesmartin
2007-10-08brelse() now takes two arguments.ad
2006-11-18Temporarily disable -c (file coalescing) until data corruption issues cantls
be resolved.
2006-09-01Pay attention to the new LFS_CLEANER_MUST_CLEAN flag in the Ifile.perseant