TODO revision 1.9
11.9Sperseant#   $NetBSD: TODO,v 1.9 2005/04/01 21:59:46 perseant Exp $
21.6Sperseant
31.6Sperseant- Now that our cache is basically all of physical memory, we need to make
41.6Sperseant  sure that segwrite is not starving other important things.  Need a way
51.6Sperseant  to prioritize which blocks are most important to write, and write only
61.9Sperseant  those, saving the rest for later.  Does this change our notion of what
71.9Sperseant  a checkpoint is?
81.2Scgd
91.5Sperseant- Investigate alternate inode locking strategy: Inode locks are useful
101.5Sperseant  for locking against simultaneous changes to inode size (balloc,
111.5Sperseant  truncate, write) but because the assignment of disk blocks is also
121.5Sperseant  covered by the segment lock, we don't really need to pay attention to
131.5Sperseant  the inode lock when writing a segment, right?  If this is true, the
141.5Sperseant  locking problem in lfs_{bmapv,markv} goes away and lfs_reserve can go,
151.5Sperseant  too.
161.3Sperseant
171.3Sperseant- Get rid of DEV_BSIZE, pay attention to the media block size at mount time.
181.3Sperseant
191.3Sperseant- More fs ops need to call lfs_imtime.  Which ones?  (Blackwell et al., 1995)
201.3Sperseant
211.3Sperseant- lfs_vunref_head exists so that vnodes loaded solely for cleaning can
221.3Sperseant  be put back on the *head* of the vnode free list.  Make sure we
231.3Sperseant  actually do this, since we now take IN_CLEANING off during segment write.
241.3Sperseant
251.3Sperseant- The cleaner could be enhanced to be controlled from other processes,
261.3Sperseant  and possibly perform additional tasks:
271.3Sperseant
281.3Sperseant  - Backups.  At a minimum, turn the cleaner off and on to allow
291.7Sperseant    effective live backups.  More aggressively, the cleaner itself could
301.7Sperseant    be the backup agent, and dump_lfs would merely be a controller.
311.3Sperseant
321.3Sperseant  - Cleaning time policies.  Be able to tweak the cleaner's thresholds
331.7Sperseant    to allow more thorough cleaning during policy-determined idle
341.7Sperseant    periods (regardless of actual idleness) or put off until later
351.7Sperseant    during short, intensive write periods.
361.3Sperseant
371.3Sperseant  - File coalescing and placement.  During periods we expect to be idle,
381.3Sperseant    coalesce fragmented files into one place on disk for better read
391.3Sperseant    performance.  Ideally, move files that have not been accessed in a
401.3Sperseant    while to the extremes of the disk, thereby shortening seek times for
411.3Sperseant    files that are accessed more frequently (though how the cleaner
421.3Sperseant    should communicate "please put this near the beginning or end of the
431.3Sperseant    disk" to the kernel is a very good question; flags to lfs_markv?).
441.3Sperseant
451.3Sperseant  - Versioning.  When it cleans a segment it could write data for files
461.3Sperseant    that were less than n versions old to tape or elsewhere.  Perhaps it
471.3Sperseant    could even write them back onto the disk, although that requires
481.3Sperseant    more thought (and kernel mods).
491.3Sperseant
501.3Sperseant- Move lfs_countlocked() into vfs_bio.c, to replace count_locked_queue;
511.3Sperseant  perhaps keep the name, replace the function.  Could it count referenced
521.3Sperseant  vnodes as well, if it was in vfs_subr.c instead?
531.3Sperseant
541.3Sperseant- Why not delete the lfs_bmapv call, just mark everything dirty that
551.3Sperseant  isn't deleted/truncated?  Get some numbers about what percentage of
561.3Sperseant  the stuff that the cleaner thinks might be live is live.  If it's
571.3Sperseant  high, get rid of lfs_bmapv.
581.3Sperseant
591.3Sperseant- There is a nasty problem in that it may take *more* room to write the
601.3Sperseant  data to clean a segment than is returned by the new segment because of
611.3Sperseant  indirect blocks in segment 2 being dirtied by the data being copied
621.3Sperseant  into the log from segment 1.  The suggested solution at this point is
631.3Sperseant  to detect it when we have no space left on the filesystem, write the
641.3Sperseant  extra data into the last segment (leaving no clean ones), make it a
651.3Sperseant  checkpoint and shut down the file system for fixing by a utility
661.3Sperseant  reading the raw partition.  Argument is that this should never happen
671.3Sperseant  and is practically impossible to fix since the cleaner would have to
681.3Sperseant  theoretically build a model of the entire filesystem in memory to
691.3Sperseant  detect the condition occurring.  A file coalescing cleaner will help
701.3Sperseant  avoid the problem, and one that reads/writes from the raw disk could
711.3Sperseant  fix it.
721.3Sperseant
731.3Sperseant- Need to keep vnode v_numoutput up to date for pending writes?
741.3Sperseant
751.3Sperseant- If delete a file that's being executed, the version number isn't
761.3Sperseant  updated, and fsck_lfs has to figure this out; case is the same as if
771.3Sperseant  have an inode that no directory references, so the file should be
781.3Sperseant  reattached into lost+found.
791.3Sperseant
801.3Sperseant- Currently there's no notion of write error checking.
811.3Sperseant  + Failed data/inode writes should be rescheduled (kernel level bad blocking).
821.3Sperseant  + Failed superblock writes should cause selection of new superblock
831.3Sperseant  for checkpointing.
841.3Sperseant
851.3Sperseant- Future fantasies:
861.3Sperseant  - unrm, versioning
871.3Sperseant  - transactions
881.3Sperseant  - extended cleaner policies (hot/cold data, data placement)
891.3Sperseant
901.3Sperseant- Problem with the concept of multiple buffer headers referencing the segment:
911.3Sperseant  Positives:
921.3Sperseant    Don't lock down 1 segment per file system of physical memory.
931.3Sperseant    Don't copy from buffers to segment memory.
941.3Sperseant    Don't tie down the bus to transfer 1M.
951.3Sperseant    Works on controllers supporting less than large transfers.
961.3Sperseant    Disk can start writing immediately instead of waiting 1/2 rotation
971.3Sperseant        and the full transfer.
981.3Sperseant  Negatives:
991.3Sperseant    Have to do segment write then segment summary write, since the latter
1001.3Sperseant    is what verifies that the segment is okay.  (Is there another way
1011.3Sperseant    to do this?)
1021.1Smycroft
1031.3Sperseant- The algorithm for selecting the disk addresses of the super-blocks
1041.3Sperseant  has to be available to the user program which checks the file system.
105