TODO revision 1.3
11.3Sperseant#   $NetBSD: TODO,v 1.3 1999/03/15 00:46:47 perseant Exp $
21.2Scgd
31.3Sperseant- If we put an LFS onto a striped disk, we want to be able to specify
41.3Sperseant  the segment size to be equal to the stripe size, regardless of whether
51.3Sperseant  this is a power of two; also, the first segment should just eat the
61.3Sperseant  label pad, like the segments eat the superblocks.  Then, we could
71.3Sperseant  neatly lay out the segments along stripe boundaries.
81.3Sperseant
91.3Sperseant- Working fsck_lfs.  (Have something that will verify, need something
101.3Sperseant  that will fix too.  Really, need a general-purpose external
111.3Sperseant  partial-segment writer.)
121.3Sperseant
131.3Sperseant- Roll-forward agent, *at least* to verify the newer superblock's
141.3Sperseant  checkpoint (easy) but also to create a valid checkpoint for
151.3Sperseant  post-checkpoint writes (requires an external partial-segment writer).
161.3Sperseant
171.3Sperseant- Blocks created in the cache are currently not marked in any way,
181.3Sperseant  except that b_blkno == b_lblkno, which can happen naturally too.  LFS
191.3Sperseant  needs to know for accounting.
201.3Sperseant
211.3Sperseant- Inode blocks are currently the same size as the fs block size; but all
221.3Sperseant  the ones I've seen are mostly empty, and this will be especially true
231.3Sperseant  if atime information is kept in the ifile instead of the inode.  Could
241.3Sperseant  we shrink the inode block size to 512?  Or parametrize it at fs
251.3Sperseant  creation time?
261.3Sperseant
271.3Sperseant- Get rid of DEV_BSIZE, pay attention to the media block size at mount time.
281.3Sperseant
291.3Sperseant- More fs ops need to call lfs_imtime.  Which ones?  (Blackwell et al., 1995)
301.3Sperseant
311.3Sperseant- lfs_vunref_head exists so that vnodes loaded solely for cleaning can
321.3Sperseant  be put back on the *head* of the vnode free list.  Make sure we
331.3Sperseant  actually do this, since we now take IN_CLEANING off during segment write.
341.3Sperseant
351.3Sperseant- Investigate the "unlocked access" in lfs_bmapv, see if we could wait
361.3Sperseant  there most of the time?  Are we getting inconsistent data?
371.3Sperseant
381.3Sperseant- Change the free_lock to be fs-specific, and change the dirvcount to be
391.3Sperseant  subsystem-wide.
401.3Sperseant
411.3Sperseant- The cleaner could be enhanced to be controlled from other processes,
421.3Sperseant  and possibly perform additional tasks:
431.3Sperseant
441.3Sperseant  - Backups.  At a minimum, turn the cleaner off and on to allow
451.3Sperseant	effective live backups.  More aggressively, the cleaner itself could
461.3Sperseant	be the backup agent, and dump_lfs would merely be a controller.
471.3Sperseant
481.3Sperseant  - Cleaning time policies.  Be able to tweak the cleaner's thresholds
491.3Sperseant	to allow more thorough cleaning during policy-determined idle
501.3Sperseant	periods (regardless of actual idleness) or put off until later
511.3Sperseant	during short, intensive write periods.
521.3Sperseant
531.3Sperseant  - File coalescing and placement.  During periods we expect to be idle,
541.3Sperseant    coalesce fragmented files into one place on disk for better read
551.3Sperseant    performance.  Ideally, move files that have not been accessed in a
561.3Sperseant    while to the extremes of the disk, thereby shortening seek times for
571.3Sperseant    files that are accessed more frequently (though how the cleaner
581.3Sperseant    should communicate "please put this near the beginning or end of the
591.3Sperseant    disk" to the kernel is a very good question; flags to lfs_markv?).
601.3Sperseant
611.3Sperseant  - Versioning.  When it cleans a segment it could write data for files
621.3Sperseant    that were less than n versions old to tape or elsewhere.  Perhaps it
631.3Sperseant    could even write them back onto the disk, although that requires
641.3Sperseant    more thought (and kernel mods).
651.3Sperseant
661.3Sperseant- Move lfs_countlocked() into vfs_bio.c, to replace count_locked_queue;
671.3Sperseant  perhaps keep the name, replace the function.  Could it count referenced
681.3Sperseant  vnodes as well, if it was in vfs_subr.c instead?
691.3Sperseant
701.3Sperseant- If we clean a DIROP vnode, and we toss a fake buffer in favor of a
711.3Sperseant  pending held real buffer, we risk writing part of the dirop during a
721.3Sperseant  synchronous checkpoint.  This is bad.  Now that we're doing `stingy'
731.3Sperseant  cleaning, is there a good reason to favor real blocks over fake ones?
741.3Sperseant
751.3Sperseant- Why not delete the lfs_bmapv call, just mark everything dirty that
761.3Sperseant  isn't deleted/truncated?  Get some numbers about what percentage of
771.3Sperseant  the stuff that the cleaner thinks might be live is live.  If it's
781.3Sperseant  high, get rid of lfs_bmapv.
791.3Sperseant
801.3Sperseant- There is a nasty problem in that it may take *more* room to write the
811.3Sperseant  data to clean a segment than is returned by the new segment because of
821.3Sperseant  indirect blocks in segment 2 being dirtied by the data being copied
831.3Sperseant  into the log from segment 1.  The suggested solution at this point is
841.3Sperseant  to detect it when we have no space left on the filesystem, write the
851.3Sperseant  extra data into the last segment (leaving no clean ones), make it a
861.3Sperseant  checkpoint and shut down the file system for fixing by a utility
871.3Sperseant  reading the raw partition.  Argument is that this should never happen
881.3Sperseant  and is practically impossible to fix since the cleaner would have to
891.3Sperseant  theoretically build a model of the entire filesystem in memory to
901.3Sperseant  detect the condition occurring.  A file coalescing cleaner will help
911.3Sperseant  avoid the problem, and one that reads/writes from the raw disk could
921.3Sperseant  fix it.
931.3Sperseant
941.3Sperseant- Overlap the version and nextfree fields in the IFILE
951.3Sperseant
961.3Sperseant- Change so that only search one sector of inode block file for the
971.3Sperseant  inode by using sector addresses in the ifile instead of
981.3Sperseant  logical disk addresses.
991.3Sperseant
1001.3Sperseant- Fix the use of the ifile version field to use the generation number instead.
1011.3Sperseant
1021.3Sperseant- Need to keep vnode v_numoutput up to date for pending writes?
1031.3Sperseant
1041.3Sperseant- If delete a file that's being executed, the version number isn't
1051.3Sperseant  updated, and fsck_lfs has to figure this out; case is the same as if
1061.3Sperseant  have an inode that no directory references, so the file should be
1071.3Sperseant  reattached into lost+found.
1081.3Sperseant
1091.3Sperseant- Investigate: should the access time be part of the IFILE:
1101.3Sperseant        pro: theoretically, saves disk writes
1111.3Sperseant        con: cacheing inodes should obviate this advantage
1121.3Sperseant             the IFILE is already humongous
1131.3Sperseant
1141.3Sperseant- Currently there's no notion of write error checking.
1151.3Sperseant  + Failed data/inode writes should be rescheduled (kernel level bad blocking).
1161.3Sperseant  + Failed superblock writes should cause selection of new superblock
1171.3Sperseant  for checkpointing.
1181.3Sperseant
1191.3Sperseant- Future fantasies:
1201.3Sperseant  - unrm, versioning
1211.3Sperseant  - transactions
1221.3Sperseant  - extended cleaner policies (hot/cold data, data placement)
1231.3Sperseant
1241.3Sperseant- Problem with the concept of multiple buffer headers referencing the segment:
1251.3Sperseant  Positives:
1261.3Sperseant    Don't lock down 1 segment per file system of physical memory.
1271.3Sperseant    Don't copy from buffers to segment memory.
1281.3Sperseant    Don't tie down the bus to transfer 1M.
1291.3Sperseant    Works on controllers supporting less than large transfers.
1301.3Sperseant    Disk can start writing immediately instead of waiting 1/2 rotation
1311.3Sperseant        and the full transfer.
1321.3Sperseant  Negatives:
1331.3Sperseant    Have to do segment write then segment summary write, since the latter
1341.3Sperseant    is what verifies that the segment is okay.  (Is there another way
1351.3Sperseant    to do this?)
1361.1Smycroft
1371.3Sperseant- The algorithm for selecting the disk addresses of the super-blocks
1381.3Sperseant  has to be available to the user program which checks the file system.
139