Commit Graph

177 Commits

Author SHA1 Message Date
mrg 7bc3291858 move the compiler hack closer to the source of the fail 2016-03-18 10:10:21 +00:00
mrg 2dc66b067e make the GCC 4.8 specific hack for ci.clean being set GCC >= 4.8. 2016-03-16 18:58:34 +00:00
riastradh 9628679b27 Need <stdbool.h> for true/false. 2016-02-19 03:53:46 +00:00
dholland fbd9d636b3 Enable lfs64 in the cleaner. 2015-10-15 06:25:04 +00:00
dholland 4f6e0f51f3 Use llabs(), not abs(), on the difference of daddr_t's.
Caught by clang, reported by joerg.

Turn off the clang-specific compiler flags that were making the report
nonfatal.
2015-10-10 22:34:46 +00:00
dholland c4e7149610 Use IINFO in the cleaner. 2015-10-03 08:28:30 +00:00
dholland ec175d5025 Add new accessors for the d_type and d_namlen fields of struct lfs_direct.
Napalm the old byteswap access logic for these.
2015-09-01 06:16:58 +00:00
dholland eb2560adae The ifile's inode number is constant. (it is always 1)
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-01 06:12:04 +00:00
dholland 4d398b859d Add byteswapping to the dinode accessors.
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-09-01 06:10:16 +00:00
dholland b1828e0ba3 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.)
2015-08-12 18:28:00 +00:00
dholland e54b457c15 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.
2015-08-12 18:27:01 +00:00
dholland 2e090556c4 Make 32-bit and 64-bit versions of SEGSUM.
Also fix some of the FINFO handling as it's closely entangled.
2015-08-12 18:26:26 +00:00
dholland 32577c4f1c 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...
2015-08-12 18:25:51 +00:00
dholland f11e4edeba 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.
2015-08-12 18:25:03 +00:00
dholland 17964a9f43 Fix assorted 64->32 truncations related to BLOCK_INFO.
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-12 18:23:16 +00:00
dholland 9e5184b86b 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.
2015-08-02 18:18:09 +00:00
dholland 992b9a23af 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.
2015-08-02 18:14:16 +00:00
dholland 078ffcb8d8 Second batch of 64 -> 32 truncations in lfs, along with more minor
tidyups and corrections in passing.
2015-08-02 18:10:07 +00:00
dholland e6aad7b613 Use lfs_accessors.h in conjunction with the cleaner's struct clfs.
Remove previous hacks.
2015-07-28 05:14:23 +00:00
dholland 34f0d74c9e 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.
2015-07-28 05:09:34 +00:00
dholland adca8af59e 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.
2015-07-24 06:59:31 +00:00
dholland f59b8f4b3a 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.
2015-07-24 06:56:41 +00:00
chopps f89312b935 - Fix fallout for recent bread() change (removing cred arg). 2015-03-29 19:35:58 +00:00
joerg 5c4c6caf71 Make the abs() use check non-fatal for a bogus use in the LFS cleanerd. 2014-03-04 21:06:47 +00:00
christos 193b880fad fix unused variable warnings 2013-10-19 17:19:30 +00:00
christos 855bb66ef7 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.
2013-06-18 18:18:57 +00:00
dholland 346c9baa29 Missed one of the -I${NETBSDSRCDIR}/sys hacks yesterday; remove it now. 2013-06-08 21:15:29 +00:00
dholland a65dc3fc86 Redo these changes properly:
-r1.12 libexec/lfs_cleanerd/Makefile
 -r1.15 sbin/fsck_lfs/Makefile
 -r1.6 sbin/newfs_lfs/Makefile

hi ad@
2013-06-08 21:13:19 +00:00
dholland c13a12500a 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.
2013-06-08 02:16:03 +00:00
dholland 5fce92dbf7 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.
2013-06-08 02:09:35 +00:00
dholland a4fc39c06d 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.
2013-06-06 00:54:49 +00:00
dholland a99a5deeff ufs -> ulfs for lfs_cleanerd 2013-06-06 00:53:35 +00:00
dholland dcd34a91c5 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.
2013-01-22 09:39:11 +00:00
joerg 1736013665 Make load_threshold double and restore original value of 0.2.
From NAKAJIMA Yoshihiro.
2012-04-16 10:48:27 +00:00
joerg 53baf6b85e Don't assign non-integral constants to integral variables. 2012-04-12 11:46:14 +00:00
joerg b25f8d4458 Use the same loop order for freeing as for allocation. Simpler code and
easier to process for analyzers.
2012-04-12 10:30:17 +00:00
perseant ccf39d2d9b Shut down the cleaner earlier if the filesystem is unmounted. 2012-02-02 03:47:11 +00:00
perseant 72d61f7290 In lfs_cleanerd, check errno earlier, to avoid premature exit when the
real errno was EAGAIN.

When coalescing, check against NULL to avoid seg fault.
2012-01-02 21:35:17 +00:00
joerg 017dd250ef Fix memset usage. 2011-07-01 02:46:24 +00:00
mlelstv e5275d16e0 Deduce raw device correctly by prepending "r" to basename. 2010-12-23 18:08:41 +00:00
pooka 0fb1ef7452 Don't exit when running as a lib after FS is unmounted, just return
from the mainloop.
2010-08-16 22:11:55 +00:00
pooka d9a3123e84 Do the semaphore trick only if the cleaner is run as a lib -- the
standard installation doesn't get linked against librt or libpthread.
2010-07-29 14:09:45 +00:00
pooka 4f52188eb0 Add a method for posting a semaphore when cleaner init has reached
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-07-29 14:07:39 +00:00
pooka fc729209b1 always add to SRCS 2010-07-28 22:35:52 +00:00
mlelstv b076c4eba1 Read the padded superblocks to avoid problems with disks that have
larger sectors than 512 Bytes.
2010-02-16 23:13:13 +00:00
pooka 977fb405f8 LDADD+= instead of LDADD= 2009-10-09 20:19:44 +00:00
pooka 494379efaf Attempt to recover slightly more gracefully if the kernel socket is shutdown. 2009-10-09 16:35:17 +00:00
wiz 175898c4a2 Describe -D. Bump date. 2009-08-06 21:18:54 +00:00
pooka 709a4d5bb6 Define syscalls of lfs userspace tools (cleaner, mainly) through
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-06 00:51:55 +00:00
pooka 0013bbb8eb add D to getopt so that previous actually works 2009-08-06 00:23:08 +00:00