Commit Graph

154 Commits

Author SHA1 Message Date
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
pooka b5cf475347 add -D, which prompts to stay on foreground without debug spewage 2009-08-06 00:20:45 +00:00
pooka e2863984f7 Check main loop fcntl return value and error out if it fails.
Prevents e.g. from 5.0 cleaner looping forever against -current
lfs driver (fcntl data structure sizes are different).
2009-08-06 00:05:01 +00:00
christos 1b829b2a68 PR/40965: NAKAJIMA Yoshihiro: lfs_cleanerd isn't adapted to !MKDYNAMICROOT 2009-06-21 20:20:50 +00:00
lukem 500db00274 Default to WARNS=4
Exceptions that need a lower level are:
	getty ld.elf_so lfs_cleanerd makewhatis telnetd tftpd
	hpropd ipropd-master ipropd-slave kadmind kpasswdd
2009-03-16 02:24:55 +00:00
lukem bb15c5ac36 fix WARNS=3 issues;
* sprinkle const
* avoid tests < 0 on unsigned types
* test fwrite() returns nmemb not <0
2009-03-16 00:08:10 +00:00
lukem f3479fb8e4 avoid a shadowed variable 2009-03-15 23:56:24 +00:00
hannken 5d2bff060a 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>
2008-05-16 09:21:59 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
ad 2b5d04688e Make it build with src/sys from the vmlocking2 branch. 2007-12-28 21:44:32 +00:00
ad 9c5739f1c6 brelse() now takes two arguments. 2007-10-08 21:41:12 +00:00
wiz fc86b06120 Bump date for previous. 2006-12-23 07:21:34 +00:00
tls 86c7b9ff84 Temporarily disable -c (file coalescing) until data corruption issues can
be resolved.
2006-11-18 18:43:25 +00:00
jmmv 2947e73b43 Move lfs_cleanerd from /usr/libexec to /libexec. This is to allow putting
the root file system on a LFS volume.

Addresses PR bin/30407.  No objections in tech-userlevel@.
2006-11-11 14:47:27 +00:00
perseant a2ecf39b35 Pay attention to the new LFS_CLEANER_MUST_CLEAN flag in the Ifile. 2006-09-01 19:43:51 +00:00
martin b4cb63a646 Make filehandles opaque to userland 2006-07-31 16:34:42 +00:00
martin a3b5baed42 Fix alignement problems for fhandle_t, exposed by gcc4.1.
While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).
2006-07-13 12:00:24 +00:00
perseant 21393db687 Place an upper bound on the number of segments to clean at one time, no
matter how empty they are.

Note that if two blocks have the same inode and block number, they sort
the same (this should never happen, but if it does there's no reason to
have qsort scramble the list).

Add some diagnostic syslog messages for unusual cases.
2006-07-07 18:19:30 +00:00
christos df73c1693c Coverity CID 3766: Avoid null pointer deref 2006-05-19 14:46:17 +00:00
perseant 45dc123d6e Be more careful about checking return value of {m,re}alloc().
In determining when to stop reading segments when counting bytes (-b flag),
total the sizes of the blocks we're actually writing instead of assuming
they are all full blocks: many could be fragments or inode blocks.  This
increases the number of segments per Ifile write, markedly improving the
efficiency of the cleaner in the small file case.
2006-05-12 19:33:02 +00:00
mrg bb50bce731 avoid some char * vs. u_char * issues. 2006-05-11 12:26:38 +00:00
perseant 0cdeebe9fa When checking hidden cleaning costs, don't erroneously add the first
indirect block when considering the cleaning of block numbers less
than NDADDR (which do not use indirect blocks).

Also, note the loss of only half a block per segment to fragmentation
when considering the benefit function, rather than a whole block.
2006-04-14 00:58:32 +00:00
perseant 1b08b7c6a1 Look for the inode pointers in the right place if lfs_bsize != lfs_fsize. 2006-04-05 21:42:49 +00:00
perseant 2c3f7b46ba Handle the case of inode blocks misidentified by the segment headers
correctly, a problem reported by Kurt Schreiner; as well as similar
error cases (realloc returning NULL or no cleanable segments found).
2006-04-05 20:29:40 +00:00