Home | History | Annotate | Download | only in lfs_cleanerd
History log of /src/libexec/lfs_cleanerd/coalesce.c
RevisionDateAuthorComments
 1.33  10-Oct-2015  dholland 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.
 1.32  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.31  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.30  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.29  12-Aug-2015  dholland 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.
 1.28  28-Jul-2015  dholland Use lfs_accessors.h in conjunction with the cleaner's struct clfs.
Remove previous hacks.
 1.27  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.26  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.25  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.24  29-Mar-2015  chopps - Fix fallout for recent bread() change (removing cred arg).
 1.23  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.22  08-Jun-2013  dholland Missed one of the -I${NETBSDSRCDIR}/sys hacks yesterday; remove it now.
 1.21  06-Jun-2013  dholland ufs -> ulfs for lfs_cleanerd
 1.20  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.19  02-Jan-2012  perseant branches: 1.19.6;
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.
 1.18  06-Aug-2009  pooka branches: 1.18.6;
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).
 1.17  16-Mar-2009  lukem fix WARNS=3 issues;
* sprinkle const
* avoid tests < 0 on unsigned types
* test fwrite() returns nmemb not <0
 1.16  16-May-2008  hannken branches: 1.16.6;
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.15  28-Apr-2008  martin branches: 1.15.2;
Remove clause 3 and 4 from TNF licenses
 1.14  08-Oct-2007  ad branches: 1.14.6;
brelse() now takes two arguments.
 1.13  12-May-2006  perseant branches: 1.13.10;
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.
 1.12  01-Apr-2006  christos Coverity CID 2792: Fix memory leaks
 1.11  30-Mar-2006  perseant A new version of the cleaner. In general, works about as well as the old
cleaner, but with more legible code.

Includes code for reading and writing to the raw disk device (so that an
unmounted fs could be cleaned), for the use of a single daemon to clean
multiple filesystems to save on resources, and for recording the old
contents of cleaned segments to offline storage for regression testing of
the LFS system as a whole; though these new features are not properly
tested at this point.
 1.10  19-Aug-2005  christos 64 bit inode changes.
 1.9  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.8  25-Feb-2003  perseant Make fs-specific fcntl macros take three arguments (approved wrstuden).
Let LFS use fcntl for cleaner functions.
 1.7  24-Feb-2003  perseant Convert lfs_cleanerd over to use the new ioctl calls instead of the
lfs syscalls.
 1.6  24-Jan-2003  fvdl Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.
 1.5  15-Dec-2002  yamt - fix memory leak.
- add more error checks.
- spaces -> tab
 1.4  24-Nov-2002  yamt fix calculation bugs that prevents coalescing from working properly.
PR 19133.
 1.3  14-Jun-2002  perseant Note each type of failure in clean_inode and provide statistics on
failures as well as successes when a run of clean_all_inodes completes.

Explicitly cast to off_t in get_dinode and get_rawblock, to make sure we
read the right block.
 1.2  14-Jun-2002  perseant Don't try to coalesce files that have fewer than NDADDR blocks, due to
a potential problem with cleaning fragments at all.

Better sanity checks when selecting files to coalesce; in particular don't
shift too far left when comparing the number of discontinuities to the log2
of the number of total blocks.

Better log messages: note beginning of coalescing correctly; also take
the log message from add_segment out of "if (debug)" for symmetry with the
"finished segment" message.

Use lfs_bmapv to find the inode, rather than looking it up manually in
the ifile; this should give more up-to-date information, since trolling
through every inode in the fs could take some time.
 1.1  06-Jun-2002  perseant First stab at file coalescing. When the cleaner detects that it might
be digging itself deeper into a hole, it forks off a subprocess
that locates files with too many discontinuities and rewrites them, if
there is enough room.

Optionally the user can manually coaleasce files by running with "-c".

The recent change to lfs_markv is required for the coalescer to do anything.

All of "digging itself deeper", "too many discontinuities", and "enough room"
need to be better defined.
 1.13.10.1  06-Nov-2007  matt sync with HEAD
 1.14.6.1  18-May-2008  yamt sync with head.
 1.15.2.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.16.6.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.18.6.3  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.18.6.2  23-Jan-2013  yamt sync with head
 1.18.6.1  17-Apr-2012  yamt sync with head
 1.19.6.2  23-Jun-2013  tls resync from head
 1.19.6.1  25-Feb-2013  tls resync with head

RSS XML Feed