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