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