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