xref: /dflybsd-src/sys/vfs/hammer2/TODO (revision 72ebfa75f3003ec60b55c850545bb5cd151dbb51)
18c280d5dSMatthew Dillon
2*72ebfa75SMatthew Dillon* check inode shared lock ... can end up in endless loop if following
3*72ebfa75SMatthew Dillon  hardlink because ip->chain is not updated in the exclusive lock cycle
4*72ebfa75SMatthew Dillon  when following hardlink.
5*72ebfa75SMatthew Dillon
60924b3f8SMatthew Dilloncpdup /build/boomdata/jails/bleeding-edge/usr/share/man/man4 /mnt/x3
70924b3f8SMatthew Dillon
8623d43d4SMatthew Dillon
9623d43d4SMatthew Dillon        * The block freeing code.  At the very least a bulk scan is needed
10623d43d4SMatthew Dillon          to implement freeing blocks.
11623d43d4SMatthew Dillon
12623d43d4SMatthew Dillon        * Crash stability.  Right now the allocation table on-media is not
13623d43d4SMatthew Dillon          properly synchronized with the flush.  This needs to be adjusted
14623d43d4SMatthew Dillon          such that H2 can do an incremental scan on mount to fixup
15623d43d4SMatthew Dillon          allocations on mount as part of its crash recovery mechanism.
16623d43d4SMatthew Dillon
17623d43d4SMatthew Dillon        * We actually have to start checking and acting upon the CRCs being
18623d43d4SMatthew Dillon          generated.
19623d43d4SMatthew Dillon
20623d43d4SMatthew Dillon        * Remaining known hardlink issues need to be addressed.
21623d43d4SMatthew Dillon
22623d43d4SMatthew Dillon        * Core 'copies' mechanism needs to be implemented to support multiple
23623d43d4SMatthew Dillon          copies on the same media.
24623d43d4SMatthew Dillon
25623d43d4SMatthew Dillon        * Core clustering mechanism needs to be implemented to support
26623d43d4SMatthew Dillon          mirroring and basic multi-master operation from a single host
27623d43d4SMatthew Dillon          (multi-host requires additional network protocols and won't
28623d43d4SMatthew Dillon          be as easy).
29623d43d4SMatthew Dillon
30fdf62707SMatthew Dillon* make sure we aren't using a shared lock during RB_SCAN's?
31fdf62707SMatthew Dillon
3291abd410SMatthew Dillon* overwrite in write_file case w/compression - if device block size changes
3391abd410SMatthew Dillon  the block has to be deleted and reallocated.  See hammer2_assign_physical()
3491abd410SMatthew Dillon  in vnops.
3591abd410SMatthew Dillon
361a7cfe5aSMatthew Dillon* freemap / clustering.  Set block size on 2MB boundary so the cluster code
371a7cfe5aSMatthew Dillon  can be used for reading.
381a7cfe5aSMatthew Dillon
391a7cfe5aSMatthew Dillon* need API layer for shared buffers (unfortunately).
401a7cfe5aSMatthew Dillon
41731b2a84SMatthew Dillon* add magic number to inode header, add parent inode number too, to
42731b2a84SMatthew Dillon  help with brute-force recovery.
43731b2a84SMatthew Dillon
44731b2a84SMatthew Dillon* modifications past our flush point do not adjust vchain.
45731b2a84SMatthew Dillon  need to make vchain dynamic so we can (see flush_scan2).??
46731b2a84SMatthew Dillon
471a7cfe5aSMatthew Dillon* MINIOSIZE/RADIX set to 1KB for now to avoid buffer cache deadlocks
481a7cfe5aSMatthew Dillon  on multiple locked inodes.  Fix so we can use LBUFSIZE!  Or,
491a7cfe5aSMatthew Dillon  alternatively, allow a smaller I/O size based on the sector size
501a7cfe5aSMatthew Dillon  (not optimal though).
511a7cfe5aSMatthew Dillon
52a864c5d9SMatthew Dillon* When making a snapshot, do not allow the snapshot to be mounted until
53a864c5d9SMatthew Dillon  the in-memory chain has been freed in order to break the shared core.
54a864c5d9SMatthew Dillon
55a864c5d9SMatthew Dillon* Snapshotting a sub-directory does not snapshot any
56a864c5d9SMatthew Dillon  parent-directory-spanning hardlinks.
57a864c5d9SMatthew Dillon
58731b2a84SMatthew Dillon* Snapshot / flush-synchronization point.  remodified data that crosses
59731b2a84SMatthew Dillon  the synchronization boundary is not currently reallocated.  see
60731b2a84SMatthew Dillon  hammer2_chain_modify(), explicit check (requires logical buffer cache
61731b2a84SMatthew Dillon  buffer handling).
62731b2a84SMatthew Dillon
6351bf8e9bSMatthew Dillon* on fresh mount with multiple hardlinks present separate lookups will
6451bf8e9bSMatthew Dillon  result in separate vnodes pointing to separate inodes pointing to a
6551bf8e9bSMatthew Dillon  common chain (the hardlink target).
6651bf8e9bSMatthew Dillon
6751bf8e9bSMatthew Dillon  When the hardlink target consolidates upward only one vp/ip will be
6851bf8e9bSMatthew Dillon  adjusted.  We need code to fixup the other chains (probably put in
6951bf8e9bSMatthew Dillon  inode_lock_*()) which will be pointing to an older deleted hardlink
7051bf8e9bSMatthew Dillon  target.
7151bf8e9bSMatthew Dillon
7232b800e6SMatthew Dillon* Filesystem must ensure that modify_tid is not too large relative to
7332b800e6SMatthew Dillon  the iterator in the volume header, on load, or flush sequencing will
7432b800e6SMatthew Dillon  not work properly.  We should be able to just override it, but we
7532b800e6SMatthew Dillon  should complain if it happens.
7632b800e6SMatthew Dillon
778c280d5dSMatthew Dillon* Kernel-side needs to clean up transaction queues and make appropriate
788c280d5dSMatthew Dillon  callbacks.
798c280d5dSMatthew Dillon
808c280d5dSMatthew Dillon* Userland side needs to do the same for any initiated transactions.
818c280d5dSMatthew Dillon
82222d9e22SMatthew Dillon* Nesting problems in the flusher.
83222d9e22SMatthew Dillon
8401eabad4SMatthew Dillon* Inefficient vfsync due to thousands of file buffers, one per-vnode.
8501eabad4SMatthew Dillon  (need to aggregate using a device buffer?)
8601eabad4SMatthew Dillon
878cce658dSMatthew Dillon* Use bp->b_dep to interlock the buffer with the chain structure so the
888cce658dSMatthew Dillon  strategy code can calculate the crc and assert that the chain is marked
898cce658dSMatthew Dillon  modified (not yet flushed).
908cce658dSMatthew Dillon
918cce658dSMatthew Dillon* Deleted inode not reachable via tree for volume flush but still reachable
928cce658dSMatthew Dillon  via fsync/inactive/reclaim.  Its tree can be destroyed at that point.
938cce658dSMatthew Dillon
94866d5273SMatthew Dillon* The direct write code needs to invalidate any underlying physical buffers.
95866d5273SMatthew Dillon  Direct write needs to be implemented.
96866d5273SMatthew Dillon
97866d5273SMatthew Dillon* Make sure a resized block (hammer2_chain_resize()) calculates a new
98222d9e22SMatthew Dillon  hash code in the parent bref
99866d5273SMatthew Dillon
100995e78dcSMatthew Dillon* The freemap allocator needs to getblk/clrbuf/bdwrite any partial
101995e78dcSMatthew Dillon  block allocations (less than 64KB) that allocate out of a new 64K
102995e78dcSMatthew Dillon  block, to avoid causing a read-before-write I/O.
103995e78dcSMatthew Dillon
104995e78dcSMatthew Dillon* Check flush race upward recursion setting SUBMODIFIED vs downward
105995e78dcSMatthew Dillon  recursion checking SUBMODIFIED then locking (must clear before the
106995e78dcSMatthew Dillon  recursion and might need additional synchronization)
107995e78dcSMatthew Dillon
108db0c2eb3SMatthew Dillon* There is definitely a flush race in the hardlink implementation between
109db0c2eb3SMatthew Dillon  the forwarding entries and the actual (hidden) hardlink inode.
110db0c2eb3SMatthew Dillon
111db0c2eb3SMatthew Dillon  This will require us to associate a small hard-link-adjust structure
112db0c2eb3SMatthew Dillon  with the chain whenever we create or delete hardlinks, on top of
113db0c2eb3SMatthew Dillon  adjusting the hardlink inode itself.  Any actual flush to the media
114db0c2eb3SMatthew Dillon  has to synchronize the correct nlinks value based on whether related
115db0c2eb3SMatthew Dillon  created or deleted hardlinks were also flushed.
116db0c2eb3SMatthew Dillon
117995e78dcSMatthew Dillon* When a directory entry is created and also if an indirect block is
118995e78dcSMatthew Dillon  created and entries moved into it, the directory seek position can
119995e78dcSMatthew Dillon  potentially become incorrect during a scan.
120995e78dcSMatthew Dillon
121995e78dcSMatthew Dillon* When a directory entry is deleted a directory seek position depending
122995e78dcSMatthew Dillon  on that key can cause readdir to skip entries.
123db0c2eb3SMatthew Dillon
12473e441b9SMatthew Dillon* TWO PHASE COMMIT - store two data offsets in the chain, and
12573e441b9SMatthew Dillon  hammer2_chain_delete() needs to leave the chain intact if MODIFIED2 is
12673e441b9SMatthew Dillon  set on its buffer until the flusher gets to it?
12773e441b9SMatthew Dillon
128db0c2eb3SMatthew Dillon
129db0c2eb3SMatthew Dillon				OPTIMIZATIONS
130db0c2eb3SMatthew Dillon
131db0c2eb3SMatthew Dillon* If a file is unlinked buts its descriptors is left open and used, we
132db0c2eb3SMatthew Dillon  should allow data blocks on-media to be reused since there is no
133db0c2eb3SMatthew Dillon  topology left to point at them.
134