dragonfly.git
15 years agoHAMMER Utilities: sync with 56A
Matthew Dillon [Tue, 17 Jun 2008 04:03:38 +0000 (04:03 +0000)]
HAMMER Utilities: sync with 56A

* New 'hammer bstats <interval>' command to monitor B-Tree statistics.

* newfs_hammer and related code significantly changed with regards to
  media changes in commit 56A.

15 years agoHAMMER 56A/Many: Performance tuning - MEDIA STRUCTURES CHANGED!
Matthew Dillon [Tue, 17 Jun 2008 04:02:38 +0000 (04:02 +0000)]
HAMMER 56A/Many: Performance tuning - MEDIA STRUCTURES CHANGED!

* MEDIA CHANGE: The blockmaps have been folded into the freemap.  Allocations
  are now made directly out of the freemap.  More work is expected here.

  The blockmaps are still used to sequence allocations, but no block
  number translation is required any more.  This didn't improve performance
  much but it will make it easier for future optimizations to localize
  allocations.

* PERFORMANCE: Removed the holes recording code.  Another commit will
  soon take over the functionality.

* PERFORMANCE: The flusher's slave threads now collect a number of inodes
  into a batch before starting their work, in an attempt to reduce
  deadlocks between slave threads from adjacent inodes.

* PERFORMANCE: B-Tree positional caching now works much better, greatly
  reducing the cpu overhead when accessing the filesystem.

* PERFORMANCE: Added a write-append optimization.  Do not do a
  lookup/iteration to locate records being overwritten when no such
  records should exist.  This cuts the cpu overhead of write-append
  flushes in half.

* PERFORMANCE: Add a vfs.hammer.write_mode sysctl feature to test out
  two different ways of queueing write I/O's.

* Added B-Tree statistics (hammer bstats 1).

15 years agoSerialize bridge configuration operations by netisr0, so that "test and set"
Sepherosa Ziehau [Mon, 16 Jun 2008 14:48:01 +0000 (14:48 +0000)]
Serialize bridge configuration operations by netisr0, so that "test and set"
member interface's if_bridge field could be safe.

15 years agoUpdate build structure for libarchive update.
Peter Avalos [Mon, 16 Jun 2008 08:20:23 +0000 (08:20 +0000)]
Update build structure for libarchive update.

15 years agoMerge from vendor branch LIBARCHIVE:
Peter Avalos [Mon, 16 Jun 2008 08:12:40 +0000 (08:12 +0000)]
Merge from vendor branch LIBARCHIVE:
Import libarchive-2.5.4b.

Requested-by: hasso
15 years agoImport libarchive-2.5.4b.
Peter Avalos [Mon, 16 Jun 2008 08:12:40 +0000 (08:12 +0000)]
Import libarchive-2.5.4b.

Requested-by: hasso
15 years agoWe must process incoming IPI messages when spinning in the thread
Matthew Dillon [Mon, 16 Jun 2008 02:00:05 +0000 (02:00 +0000)]
We must process incoming IPI messages when spinning in the thread
cpu acquisition code.  This avoids a deadlock which can occur between
the cpu whos thread is trying to exit and the cpu receiving the thread.

Reported-by: Gary Allan <dragonfly@gallan.co.uk>
15 years agoThe default value of net.inet6.ip6.v6only is 'on'.
Sascha Wildner [Sun, 15 Jun 2008 19:20:05 +0000 (19:20 +0000)]
The default value of net.inet6.ip6.v6only is 'on'.

Noticed-by: Jordan Gordeev <jgordeev@dir.bg>
15 years ago- In if_up(), purge ifnet.if_snd before turning on IFF_UP, this is used to
Sepherosa Ziehau [Sun, 15 Jun 2008 12:15:08 +0000 (12:15 +0000)]
- In if_up(), purge ifnet.if_snd before turning on IFF_UP, this is used to
  clean up packets that sneaked into ifnet.if_snd after if_down()
- Strip blank line

15 years ago- Don't turn on IFF_OACTIVE when dequeuing ifnet.if_snd; it no longer
Sepherosa Ziehau [Sun, 15 Jun 2008 12:01:32 +0000 (12:01 +0000)]
- Don't turn on IFF_OACTIVE when dequeuing ifnet.if_snd; it no longer
  makes sense
- If parent interface is NULL, purge ifnet.if_snd

15 years ago- Fix a possible race between getting vlan media and changing vlan parent
Sepherosa Ziehau [Sun, 15 Jun 2008 11:41:40 +0000 (11:41 +0000)]
- Fix a possible race between getting vlan media and changing vlan parent
- White space cleanup

15 years agoAdd missing return
Sepherosa Ziehau [Sun, 15 Jun 2008 11:19:15 +0000 (11:19 +0000)]
Add missing return

15 years ago- Add FXP_USABLE_TXCB, which equals (FXP_NTXCB - 1)
Sepherosa Ziehau [Sun, 15 Jun 2008 10:41:00 +0000 (10:41 +0000)]
- Add FXP_USABLE_TXCB, which equals (FXP_NTXCB - 1)
- Turn off IFF_OACTIVE if queued TCBs is less than FXP_USABLE_TXCB
- Call if_devstart() in fxp_tick(), if ifnet.if_snd is not empty
- Remove unnecessary comment about ifnet.if_timer in fxp_init()

15 years agoDon't assume RV2P page size is always 4Kbytes; at least 8Kbytes page size
Sepherosa Ziehau [Sun, 15 Jun 2008 05:14:41 +0000 (05:14 +0000)]
Don't assume RV2P page size is always 4Kbytes; at least 8Kbytes page size
works too.

15 years agoBreak long line
Sepherosa Ziehau [Sun, 15 Jun 2008 02:32:38 +0000 (02:32 +0000)]
Break long line

15 years agoRemove the old FreeBSD logo screen saver.
Sascha Wildner [Sat, 14 Jun 2008 20:09:18 +0000 (20:09 +0000)]
Remove the old FreeBSD logo screen saver.

It has not been built for >4 years now.

15 years agoAdd missing ;
Matthias Schmidt [Sat, 14 Jun 2008 15:30:19 +0000 (15:30 +0000)]
Add missing ;

Reported-by: trevorjk
15 years agoIn the final code block of in_control_internal, remove ia from the hash table
Sepherosa Ziehau [Sat, 14 Jun 2008 08:40:16 +0000 (08:40 +0000)]
In the final code block of in_control_internal, remove ia from the hash table
only if cmd is SIOCDIFADDR.  Add assertions and comment about it.

15 years ago- Check cached ifnet.if_bridge again in bridge_{input,output}()
Sepherosa Ziehau [Sat, 14 Jun 2008 07:58:46 +0000 (07:58 +0000)]
- Check cached ifnet.if_bridge again in bridge_{input,output}()
- Pass cached ifnet.if_bridge to bstp_input()
- Pass the located bif to bstp_input(), so we won't need to locate bif again

These changes make it possible to use following sequence
    ifp->if_bridge = NULL;
    netmsg_service_sync();
to protect ifnet.if_bridge

15 years agoMinor style change
Sepherosa Ziehau [Sat, 14 Jun 2008 06:34:37 +0000 (06:34 +0000)]
Minor style change

15 years agoChange the namecache lock warning delay from 1 to 5 seconds.
Matthew Dillon [Sat, 14 Jun 2008 05:34:06 +0000 (05:34 +0000)]
Change the namecache lock warning delay from 1 to 5 seconds.

15 years agoMember iface's serializer does not need to be held when calling bridge_output()
Sepherosa Ziehau [Sat, 14 Jun 2008 04:35:32 +0000 (04:35 +0000)]
Member iface's serializer does not need to be held when calling bridge_output()

15 years agoRemove unused parameters to bridge_output
Sepherosa Ziehau [Sat, 14 Jun 2008 04:00:51 +0000 (04:00 +0000)]
Remove unused parameters to bridge_output

15 years agoHAMMER Utilities: Sync with commit 55 - MEDIA STRUCTURES CHANGED!
Matthew Dillon [Sat, 14 Jun 2008 01:44:13 +0000 (01:44 +0000)]
HAMMER Utilities: Sync with commit 55 - MEDIA STRUCTURES CHANGED!

* newfs_hammer now creates a new blockmap zone for meta-data

* The hammer utility has been enhanced and brought up-to-date.  One
  can now reblock directories separately from other data.

* The hammer show command now properly understands the B-Tree element
  localization field (fixed improper reporting of 'B'ad B-Tree elements).

15 years agoHAMMER 55: Performance tuning and bug fixes - MEDIA STRUCTURES CHANGED!
Matthew Dillon [Sat, 14 Jun 2008 01:42:13 +0000 (01:42 +0000)]
HAMMER 55: Performance tuning and bug fixes - MEDIA STRUCTURES CHANGED!

* BUG-FIX: Fix a race in hammer_rel_mem_record() which could result in a
  machine lockup.  The code could block at an inappropriate time with both
  the record and a dependancy inode pointer left unprotected.

* BUG-FIX: The direct-write code could assert on (*error != 0) due to an
  incorrect conditional in the in-memory record scanning code.

* Inode data and directory entry data has been given its own zone as a
  stop-gap until the low level allocator can be rewritten.

* Increase the directory object-id cache from 128 entries to 1024 entries.

* General cleanup.

* Introduce a separate reblocking domain for directories: 'hammer reblock-dirs'.

15 years agoStrip "serialized" suffix
Sepherosa Ziehau [Fri, 13 Jun 2008 12:30:19 +0000 (12:30 +0000)]
Strip "serialized" suffix

15 years agoHAMMER 54D/Many: Performance tuning.
Matthew Dillon [Fri, 13 Jun 2008 00:25:33 +0000 (00:25 +0000)]
HAMMER 54D/Many: Performance tuning.

* Remove major barriers to write performance and fix hicups revealed by
  blogbench.

  Change the HAMMER reclaim-delay algorithm to operate like a FIFO instead
  of as a free-for-all.  The idea of introducing a dynamic delay helped some,
  but the addition of the wakeup FIFO allows burst completions by the flusher
  to immediately wakeup processes that were waiting for the reclaim count to
  drain.  The result is far, far smoother operation.

* Remove a major blocking conflict between the buffer cache daemon and
  HAMMER.  The buffer cache was getting stuck on trying to overwrite dirty
  records that had already been queued to the flusher.  The flusher might
  not act on the record(s) for a long period of time, causing the buffer
  cache daemon to stall.

  Fix the problem by properly using the HAMMER_RECF_INTERLOCK_BE flag,
  which stays on only for a very short period of time, instead of testing
  the record's flush state (record->flush_state), which can stay in
  the HAMMER_FST_FLUSH state for a very long time.

* The parent B-Tree node does not need to be locked when inserting
  into the child.

* Use the new B_AGE semantics to keep meta-data intact longer.  This results
  in another big improvement in random read and write performance.

15 years agoLWPHOLD/LWPRELE must be atomic ops because an IPI can call LWPRELE.
Matthew Dillon [Fri, 13 Jun 2008 00:25:01 +0000 (00:25 +0000)]
LWPHOLD/LWPRELE must be atomic ops because an IPI can call LWPRELE.

15 years agoReimplement B_AGE. Have it cycle the buffer in the queue twice instead of
Matthew Dillon [Thu, 12 Jun 2008 23:26:37 +0000 (23:26 +0000)]
Reimplement B_AGE.  Have it cycle the buffer in the queue twice instead of
placing buffers at the head of the queue (which causes them to be run-down
backwards).  Leave B_AGE set through the write cycle and have the bufdaemon
set the flag when flushing dirty buffers.  B_AGE no longer effects the
ordering of the actual write and is allowed to slide through to the clean
queue when the write completes.

15 years agoAdd missing LWPHOLD/LWPRELE in kinfo code.
Matthew Dillon [Thu, 12 Jun 2008 23:25:02 +0000 (23:25 +0000)]
Add missing LWPHOLD/LWPRELE in kinfo code.

15 years agoFix probable cut-n-paste error.
Hasso Tepper [Thu, 12 Jun 2008 07:09:31 +0000 (07:09 +0000)]
Fix probable cut-n-paste error.

Obtained-from: NetBSD

15 years agoHAMMER 54C/Many: Performing tuning, bug fixes
Matthew Dillon [Thu, 12 Jun 2008 01:55:58 +0000 (01:55 +0000)]
HAMMER 54C/Many: Performing tuning, bug fixes

* Adjust the reclaims delay code

* Fix a direct-read bug.  Truncations were not being properly handled.

15 years agoHAMMER 54B/Many: Performance tuning.
Matthew Dillon [Thu, 12 Jun 2008 00:16:10 +0000 (00:16 +0000)]
HAMMER 54B/Many: Performance tuning.

* Fix a major performance issue in the UNDO generation code.  The code
  was calling hammer_bread() instead of hammer_bnew() for 'new' undo buffers,
  meaning it was doing a read-modify-write on the disk instead of just a
  write.

  This fix results in a MAJOR improvement in performance across the board.

* Replace the only lockmgr lock in the module with a hammer_lock.

* Tweak hammer_inode_waitreclaims().  This will probably need even more
  tweaking as time passes.

15 years agoHAMMER 54/Many: Performance tuning
Matthew Dillon [Wed, 11 Jun 2008 22:33:21 +0000 (22:33 +0000)]
HAMMER 54/Many: Performance tuning

* Implement hammer_vop_bmap().

* Implement cluster_read() support.  This should jump up linear read
  performance almost to the platter speed.  I get 100 MB/sec testing
  vs 35 MB/sec previously.

* Do a better job kicking an inode into the flusher when writing
  sequentially.  This hops up write rate at least +50%.  It isn't
  quite able to run at the platter speed due to B-Tree overheads
  which will be addressed in a later patch.

* Do not create data fragments at the ends of files greater then 16K, use
  a full 16K block.  The reason is that fragments in HAMMER are allocated
  out of a wholely different zone and we do not want to lose the chance of
  making the tail end of the file contiguous.

  Files less then 16K still use data fragments.

* Fix a machine lockup related to an interrupt race with biodone() and
  insertions and deltions from hmp->lose_list.

* Fix a memory exhaustion issue.

Reported-by: Francois Tigeot <ftigeot@wolfpond.org> (machine lockup)
Credit-also: Jonathan Stuart on the 0 byte sized file bug fix.

15 years agoFix a path in the comment.
Sascha Wildner [Wed, 11 Jun 2008 20:01:31 +0000 (20:01 +0000)]
Fix a path in the comment.

15 years agoHAMMER 53H/Many: Performance tuning, bug fixes
Matthew Dillon [Tue, 10 Jun 2008 22:30:21 +0000 (22:30 +0000)]
HAMMER 53H/Many: Performance tuning, bug fixes

* CHANGE THE ON-MEDIA B-TREE STRUCTURE.  The number of elements per node has
  been increased from 16 to 64.  The intent is to reduce the number of seeks
  required in a heavy random-access loading situation.

* Add a shortcut to the B-Tree node scanning code (requires more testing).
  Instead of scanning linearly we do a power-of-2 narrowing search.

* Only do clustered reads for DATA types.  Do not cluster meta-data (aka
  B-Tree) I/O.  Note that the inode data structure is considered to be
  a DATA type.  Reduce the cluster read side from 256K to 64K to avoid
  blowing out the buffer cache.

* Augment hammer locks so one can discern between a normal lock blockage
  and one that is recovering from a deadlock.

* Change the slave work threads for the flusher to pull their work off a
  single queue.  This fixes an issue where one slave work thread would
  sometimes get a disproportionate percentage of the work and the
  master thread then had to wait for it to finish while the other work
  threads were twiddling their thumbs.

* Adjust the wait reclaims code to solve a long standing performance issue.
  The flusher could get so far behind that the system's buffer cache buffers
  would no longer have any locality of reference to what was being flushed,
  causing a massive drop in performance.

* Do not queue a dirty inode to the flusher unconditionally in the strategy
  write code.  Only do it if system resources appear to be stressed.
  The inode will get flushed when the filesystem syncs.

* Code cleanup.

* Fix a bug reported by Antonio Huete Jimenez related to 0-length writes
  not working properly.

15 years agoSwitch from bioq_insert_tail() to bioqdisksort(). When the kernel is
Matthew Dillon [Tue, 10 Jun 2008 17:20:52 +0000 (17:20 +0000)]
Switch from bioq_insert_tail() to bioqdisksort().  When the kernel is
juggling hundreds of I/O requests the on-disk controllers, which have limited
queue sizes, are unable to completely optimize the accesses.

This seems to make a pretty big difference on the twe device I tested with
when running blogbench on HAMMER, which can approach 1000 simultaniously
queued I/O's.

15 years agoMake sure host controller interrupts are not enabled until all
Hasso Tepper [Tue, 10 Jun 2008 10:08:11 +0000 (10:08 +0000)]
Make sure host controller interrupts are not enabled until all
initialisation is finished.

Obtained-from: NetBSD

15 years agoRemove the code which disables port status change interrupts for 1 second
Hasso Tepper [Tue, 10 Jun 2008 10:04:06 +0000 (10:04 +0000)]
Remove the code which disables port status change interrupts for 1 second
when one occured. It meant that event get lost or delayed until the next
change leaving the port dead under some circumstances.

Obtained-from: NetBSD

15 years agoHAMMER 53G/Many: Performance tuning.
Matthew Dillon [Tue, 10 Jun 2008 08:51:02 +0000 (08:51 +0000)]
HAMMER 53G/Many: Performance tuning.

* Implement multiple flusher threads.

* Move the call to hammer_inode_waitreclaims() yet again.  Call it from
  hammer_vop_reclaim().

15 years agoHAMMER 53F/Many: Fix deadlock.
Matthew Dillon [Tue, 10 Jun 2008 08:06:28 +0000 (08:06 +0000)]
HAMMER 53F/Many: Fix deadlock.

* Do not sleep waiting for reclaimed inodes to drain while holding
  an inode lock.

15 years agoRemove superfluous recursive lock. This little change makes possible (safe)
Hasso Tepper [Tue, 10 Jun 2008 06:35:59 +0000 (06:35 +0000)]
Remove superfluous recursive lock. This little change makes possible (safe)
to use spinlock(9) instead of lockmgr(9).

15 years agoFix ordering mismatch between KERN_* values and CTL_KERN_NAMES array.
Nicolas Thery [Tue, 10 Jun 2008 05:20:10 +0000 (05:20 +0000)]
Fix ordering mismatch between KERN_* values and CTL_KERN_NAMES array.

15 years agoHAMMER 53E/Many: Performance tuning
Matthew Dillon [Tue, 10 Jun 2008 05:06:20 +0000 (05:06 +0000)]
HAMMER 53E/Many: Performance tuning

* Change the code which waits for reclaims to drain to be more inline with
  the new bwillwrite().  Impose a dynamic delay instead of blocking outright.

* Move the hammer_inode_waitreclaims() call from hammer_vop_open() to
  hammer_get_inode(), and only call it when we would otherwise have to
  create a new inode.

* Sort HAMMER's file list in conf/files.

15 years agoChange bwillwrite() to smooth out performance under heavy loads. Blocking
Matthew Dillon [Tue, 10 Jun 2008 05:02:09 +0000 (05:02 +0000)]
Change bwillwrite() to smooth out performance under heavy loads.  Blocking
based on strict hystersis was being used to try to gang flushes together
but filesystems can still blow out the buffer cache and cause processes
to block for long periods of time waiting for the dirty count to drop
significantly.

Instead, as the number of dirty buffers exceeds the desired maximum
bwillwrite() imposes a dynamic delay which increases as the number of
dirty buffers increase.  This improves the stall behavior under heavy loads
and keeps the system responsive.

TODO: The algorithm needs to have a per-LWP heuristic to penalize heavy
writers more then light ones.

15 years agoHAMMER 53D/Many: Stabilization
Matthew Dillon [Tue, 10 Jun 2008 00:40:31 +0000 (00:40 +0000)]
HAMMER 53D/Many: Stabilization

* Fix an overwrite bug with direct write which could result in file
  corruption.

* Reserve just-freed big blocks for two flush cycles to prevent HAMMER from
  overwriting destroyed data so it does not become corrupt if the system
  crashes.  This is needed because the recover code does not record UNDOs
  for data (nor do we want it to).

* More I/O subsystem work.  There may still be an ellusive panic related
  to calls to regetblk().

15 years agoAdd an extern for hidirtybuffers.
Matthew Dillon [Mon, 9 Jun 2008 16:54:45 +0000 (16:54 +0000)]
Add an extern for hidirtybuffers.

Reported-by: Michael Neumann <mneumann@ntecs.de>
15 years agoParallelize in_ifaddrhashtbl
Sepherosa Ziehau [Mon, 9 Jun 2008 11:24:24 +0000 (11:24 +0000)]
Parallelize in_ifaddrhashtbl

15 years agoMove stack variable near its usage
Sepherosa Ziehau [Mon, 9 Jun 2008 04:59:22 +0000 (04:59 +0000)]
Move stack variable near its usage

15 years agoFix a SMP race in signotify_remote(). LWPHOLD() the lwp being
Matthew Dillon [Mon, 9 Jun 2008 04:33:08 +0000 (04:33 +0000)]
Fix a SMP race in signotify_remote().  LWPHOLD() the lwp being
passed from one cpu to another over an IPI to prevent it from exiting
in the mean time and causing the IPI to panic.

15 years agoHAMMER 53C/Many: Stabilization
Matthew Dillon [Mon, 9 Jun 2008 04:19:10 +0000 (04:19 +0000)]
HAMMER 53C/Many: Stabilization

* HAMMER queues dirty inodes reclaimed by the kernel to the backend for
  their final sync.  Programs like blogbench can overload the backend and
  generate more new inodes then the backend can dispose of, running
  M_HAMMER out of memory.

  Add code to stall on vop_open() when this condition is detected to
  give the backend a chance to catch-up.  (see NOTE 1 below).

* HAMMER could build up too many meta-data buffers and cause the system
  to deadlock in newbuf.  Recode the flusher to allow a block of UNDOs,
  the volume header, and all related meta-data buffers to be flushed
  piecemeal, and then continue the flush loop without closing out the
  transaction.   If a crash occurs the recovery code will undo the partial
  flushes.

* Fix an issue located by FSX under load.  The in-memory/on-disk record
  merging code was not dealing with in-memory data records properly
  The key field for data records is (base_offset + data_len), not just
  (base_off), so a 'match' between an in-memory data record and an on-disk
  data records requires a special case test.  This is the case where the
  in-memory record is intended to overwrite the on-disk record, so the
  in-memory record must be chosen and the on-disk record discarded for
  the purposes of read().

* Fix a bug in hammer_io.c related to the handling of B_LOCKED buffers
  that resulted in an assertion at umount time.  Buffer cache buffers
  were not being properly disassociated from their hammer_buffer countparts
  in the direct-write case.

* The frontend's direct-write capability for truncated buffers (such as
  used with small files) was causing an assertion to occur on the backend.
  Add an interlock on the related hammer_buffer to prevent the frontend
  from attempting to modify the buffer while the backend is trying to
  write it to the media.

* Dynamically size the dirty buffer limit.  This still needs some work.

(NOTE 1): On read/write performance issues.  Currently HAMMER's frontend
VOPs are massively disassociated from modifying B-Tree updates.  Even though
a direct-write capability now exists, it applies only to bulk data writes
to disk and NOT to B-Tree updates.  Each direct write creates a record
which must be queued to the backend to do the B-Tree update on the
media.  The flusher is currently single-threaded and when HAMMER gets
too far behind doing these updates the current safeties will cause
performance to degrade drastically.  This is a known issue that
will be addressed.

15 years agoFix typo.
Sascha Wildner [Sun, 8 Jun 2008 20:40:38 +0000 (20:40 +0000)]
Fix typo.

15 years agoFix typos.
Sascha Wildner [Sun, 8 Jun 2008 20:40:15 +0000 (20:40 +0000)]
Fix typos.

15 years agoHAMMER 53B/Many: Complete overhaul of strategy code, reservations, etc
Matthew Dillon [Sun, 8 Jun 2008 18:16:26 +0000 (18:16 +0000)]
HAMMER 53B/Many: Complete overhaul of strategy code, reservations, etc

* Completely overhaul the strategy code.  Implement direct reads and writes
  for all cases.  REMOVE THE BACKEND BIO QUEUE.  BIOs are no longer queued
  to the flusher under any circumstances.

  Remove numerous hacks that were previously emplaced to deal with BIO's
  being queued to the flusher.

* Add a mechanism to invalidate buffer cache buffers that might be shadowed
  by direct I/O.  e.g. if a strategy write uses the vnode's bio directly
  there may be a shadow hammer_buffer that will then become stale and must
  be invalidated.

* Implement a reservation tracking structure (hammer_reserve) to track
  storage reservations made by the frontend.  The backend will not attempt
  to free or reuse reserved space if it encounters it.

  Use reservations to back cached holes (struct hammer_hole) for the
  same reason.

* Index hammer_buffer on the zone-X offset instead of the zone-2 offset.
  Base the RB tree in the hammer_mount instead of (zone-2) hammer_volume.
  This removes nearly all blockmap lookup operations from the critical path.

* Do a much better job tracking cached dirty data for the purposes of
  calculating whether the filesystem will become full or not.

* Fix a critical bug in the CRC generation of short data buffers.

* Fix a VM deadlock.

* Use 16-byte alignment for all on-disk data instead of 8-byte alignment.

* Major code cleanup.

As-of this commit write performance is now extremely good.

15 years agoHAMMER Utilities: Critical bug in newfs_hammer
Matthew Dillon [Sun, 8 Jun 2008 17:19:09 +0000 (17:19 +0000)]
HAMMER Utilities: Critical bug in newfs_hammer

* newfs_hammer was not properly setting up the small-data zone.

15 years agoAdd tunable to enable/disable PBCC support in acx(4) and it is enabled
Sepherosa Ziehau [Sun, 8 Jun 2008 10:06:05 +0000 (10:06 +0000)]
Add tunable to enable/disable PBCC support in acx(4) and it is enabled
by default.

15 years agoParallelize in_ifaddrhead operation
Sepherosa Ziehau [Sun, 8 Jun 2008 08:38:06 +0000 (08:38 +0000)]
Parallelize in_ifaddrhead operation

15 years agoAssert that move in directory entry hash table can't fail.
Nicolas Thery [Sun, 8 Jun 2008 07:56:06 +0000 (07:56 +0000)]
Assert that move in directory entry hash table can't fail.

15 years ago- oia is no longer used
Sepherosa Ziehau [Sun, 8 Jun 2008 03:58:03 +0000 (03:58 +0000)]
- oia is no longer used
- Tranform for(;;) loop into while() loop

15 years agoMove fetching of "hw.hasbrokenint12" tunable closer to it's usage.
Michael Neumann [Sat, 7 Jun 2008 12:30:26 +0000 (12:30 +0000)]
Move fetching of "hw.hasbrokenint12" tunable closer to it's usage.

15 years agoCosmetic changes (remove whitespace).
Michael Neumann [Sat, 7 Jun 2008 12:15:33 +0000 (12:15 +0000)]
Cosmetic changes (remove whitespace).

15 years agoRemove unnecessary conversion to kilobytes (divide by 1024) to then later
Michael Neumann [Sat, 7 Jun 2008 12:03:52 +0000 (12:03 +0000)]
Remove unnecessary conversion to kilobytes (divide by 1024) to then later
multiply it again by 1024 to get to bytes.

15 years agoUse NULL instead of 0.
Michael Neumann [Sat, 7 Jun 2008 11:44:04 +0000 (11:44 +0000)]
Use NULL instead of 0.

15 years agoCorrect typos.
Michael Neumann [Sat, 7 Jun 2008 11:37:23 +0000 (11:37 +0000)]
Correct typos.

15 years agoHAMMER 53A/Many: Read and write performance enhancements, etc.
Matthew Dillon [Sat, 7 Jun 2008 07:41:51 +0000 (07:41 +0000)]
HAMMER 53A/Many: Read and write performance enhancements, etc.

* Add hammer_io_direct_read().  For full-block reads this code allows
  a high-level frontend buffer cache buffer associated with the
  regular file vnode to directly access the underlying storage,
  instead of loading that storage via a hammer_buffer and bcopy()ing it.

* Add a write bypass, allowing the frontend to bypass the flusher and
  write full-blocks directly to the underlying storage, greatly improving
  frontend write performance.  Caveat: See note at bottom.

  The write bypass is implemented by adding a feature whereby the frontend
  can soft-reserve unused disk space on the physical media without having
  to interact (much) with on-disk meta-data structures.  This allows the
  frontend to flush high-level buffer cache buffers directly to disk
  and release the buffer for reuse by the system, resulting in very high
  write performance.

  To properly associate the reserved space with the filesystem so it can be
  accessed in later reads, an in-memory hammer_record is created referencing
  it.  This record is queued to the backend flusher for final disposition.
  The backend disposes of the record by inserting the appropriate B-Tree
  element and marking the storage as allocated.  At that point the storage
  becomes official.

* Clean up numerous procedures to support the above new features.  In
  particular, do a major cleanup of the cached truncation offset code
  (this is the code which allows HAMMER to implement wholely asynchronous
  truncate()/ftruncate() support.

  Also clean up the flusher triggering code, removing numerous hacks that
  had been in place to deal with the lack of a direct-write mechanism.

* Start working on statistics gathering to track record and B-Tree
  operations.

* CAVEAT: The backend flusher creates a significant cpu burden when flushing
  a large number of in-memory data records.  Even though the data itself
  has already been written to disk, there is currently a great deal of
  overhead involved in manipulating the B-Tree to insert the new records.
  Overall write performance will only be modestly improved until these
  code paths are optimized.

15 years agoUse ASSERT_IFAC_VALID whenever possible
Sepherosa Ziehau [Sat, 7 Jun 2008 07:22:22 +0000 (07:22 +0000)]
Use ASSERT_IFAC_VALID whenever possible

15 years agoAdd ASSERT_IFAC_VALID
Sepherosa Ziehau [Sat, 7 Jun 2008 06:34:57 +0000 (06:34 +0000)]
Add ASSERT_IFAC_VALID

15 years ago- Expose ifa_forwardmsg()
Sepherosa Ziehau [Sat, 7 Jun 2008 04:59:01 +0000 (04:59 +0000)]
- Expose ifa_forwardmsg()
- Add ifa_domsg()

# They will be needed soon

15 years agoDon't use NULL where 0 is meant.
Sascha Wildner [Fri, 6 Jun 2008 13:19:25 +0000 (13:19 +0000)]
Don't use NULL where 0 is meant.

15 years agoMake sure that ifac is still valid before unlinking it from or linking it to ifnet
Sepherosa Ziehau [Fri, 6 Jun 2008 12:35:27 +0000 (12:35 +0000)]
Make sure that ifac is still valid before unlinking it from or linking it to ifnet

15 years agoAdd periodic rf calibration support for acx111 part. This seems to stablize
Sepherosa Ziehau [Fri, 6 Jun 2008 10:47:14 +0000 (10:47 +0000)]
Add periodic rf calibration support for acx111 part.  This seems to stablize
performance during long time TX stress.

15 years ago* Fix some cases where NULL was used but 0 was meant (and vice versa).
Sascha Wildner [Thu, 5 Jun 2008 18:06:33 +0000 (18:06 +0000)]
* Fix some cases where NULL was used but 0 was meant (and vice versa).

* Remove some bogus casts of NULL to (void *).

15 years agoRemove some unneeded definitions of NULL.
Sascha Wildner [Thu, 5 Jun 2008 18:01:49 +0000 (18:01 +0000)]
Remove some unneeded definitions of NULL.

15 years agoInclude <sys/_null.h> for the definition of NULL.
Sascha Wildner [Thu, 5 Jun 2008 17:53:10 +0000 (17:53 +0000)]
Include <sys/_null.h> for the definition of NULL.

15 years agoAdd <sys/_null.h> for the definition of NULL:
Sascha Wildner [Thu, 5 Jun 2008 17:49:53 +0000 (17:49 +0000)]
Add <sys/_null.h> for the definition of NULL:

[...]
#ifndef __cplusplus
#define NULL ((void *)0)
#else
#define NULL 0
#endif
[...]

15 years agoAdd rt_cpuid, which records rtentry's owning CPU id. It could ease route
Sepherosa Ziehau [Thu, 5 Jun 2008 15:29:47 +0000 (15:29 +0000)]
Add rt_cpuid, which records rtentry's owning CPU id.  It could ease route
entry related debugging and sanity checks.

15 years agoFix bugs in spin_trylock_wr():
Nicolas Thery [Wed, 4 Jun 2008 04:34:54 +0000 (04:34 +0000)]
Fix bugs in spin_trylock_wr():

- globaldata.gd_spinlock_wr was not decremented back on failure;

- incorrect comparison in loop trying to clear cached shared bits (loop
  must fail if spinlock is still held for read by another cpu).

Reviewed-by: dillon@
15 years agoHAMMER 52/Many: Read-only mounts and mount upgrades/downgrades.
Matthew Dillon [Tue, 3 Jun 2008 18:47:25 +0000 (18:47 +0000)]
HAMMER 52/Many: Read-only mounts and mount upgrades/downgrades.

* Finish implementing MNT_UPDATE, allowing a HAMMER mount to be upgraded
  or downgraded.

* Adjust the recovery code to not flush buffers dirtied by recovery
  operations (running the UNDOs) when the mount is read-only.  The
  buffers will be flushed when the mount is updated to read-write.

* Improve recovery performance by not flushing dirty buffers until the
  end (if a read-write mount).

* A crash which occurs during recovery might cause the next recovery to
  fail.  Delay writing out the recovered volume header until all the other
  buffers have been written out to fix the problem.

15 years agoHAMMER Utilities: Enhance mount_hammer
Matthew Dillon [Tue, 3 Jun 2008 18:43:34 +0000 (18:43 +0000)]
HAMMER Utilities: Enhance mount_hammer

* Allow devices to be specified as dev:dev:dev, so a multi-volume hammer
  mount can be specified in /etc/fstab.

* Implement -u (mount update)

15 years agoDo not update f_offset on EINVAL.
Matthew Dillon [Tue, 3 Jun 2008 16:16:40 +0000 (16:16 +0000)]
Do not update f_offset on EINVAL.

Reported-by: VOROSKOI Andras <voroskoi@gmail.com>
15 years agomdoc cleanup
Sascha Wildner [Tue, 3 Jun 2008 12:40:09 +0000 (12:40 +0000)]
mdoc cleanup

15 years agoFix a crash when "Arctic Ocean" was selected.
Sascha Wildner [Tue, 3 Jun 2008 09:33:27 +0000 (09:33 +0000)]
Fix a crash when "Arctic Ocean" was selected.

Taken-from: FreeBSD

15 years agoHAMMER Utilities: More pre-formatting, cleanup
Matthew Dillon [Tue, 3 Jun 2008 06:20:30 +0000 (06:20 +0000)]
HAMMER Utilities: More pre-formatting, cleanup

* Fully initialize the large-data and small-data blockmaps in addition
  to the B-Tree blockmap.

* Set vol0_stat_bigblocks properly so used space shows as 0, or otherwise
  a fairly small number, when the volume is empty.

* Display the total amount of space pre-allocated by newfs_hammer for
  the boot-area, memory-log, undo-buffer, and blockmap infrastructure.

15 years agoAdd 'options HAMMER' to LINT.
Sascha Wildner [Mon, 2 Jun 2008 20:40:07 +0000 (20:40 +0000)]
Add 'options HAMMER' to LINT.

Noticed-by: Dionysus Blazakis <dion.blazakis@gmail.com>
15 years agoHAMMER 51/Many: Filesystem full casework, nohistory flag.
Matthew Dillon [Mon, 2 Jun 2008 20:19:03 +0000 (20:19 +0000)]
HAMMER 51/Many: Filesystem full casework, nohistory flag.

* Track the amount of unsynced information and return ENOSPC if the
  filesystem would become full.  The idea here is to detect that the
  filesystem is full and yet still give the flusher enough runway to
  flush cached dirty data and inodes.

* Implement the NOHISTORY flag.  Implement inheritance of NOHISTORY and
  NODUMP.

  The NOHISTORY flag tells HAMMER not to retain historical information on
  a filesystem object.  If set on a directory any objects created in that
  directory will also inherit the flag.  For example, it could be set
  on /usr/obj.

15 years agoReport the nohistory, noshistory, and nouhistory flags, and allow them
Matthew Dillon [Mon, 2 Jun 2008 20:17:07 +0000 (20:17 +0000)]
Report the nohistory, noshistory, and nouhistory flags, and allow them
to be specified with chflags.

Set the inverted field for nosunlink, nosunlnk, nouunlink, nouulnk.  This
is an inverted flag.

15 years agoAdd the UF_NOHISTORY and SF_NOHISTORY chflags flags. The nohistory flag
Matthew Dillon [Mon, 2 Jun 2008 20:13:38 +0000 (20:13 +0000)]
Add the UF_NOHISTORY and SF_NOHISTORY chflags flags.  The nohistory flag
allows you to mount a HAMMER filesystem normally and still specify that
certain files and directory not retain historical information.

If set on a directory the flag will be inherited by any objects
created within that directory.

Adjust UFS to inherit the NOHISTORY and NODUMP flags from the parent
directory when creating new objects.  NODUMP used to be ufs-specific
and UFS's backup/restore remembered the inheritance.  As a more generic
flag it needs to be inherited within the filesystem.  Note that UFS
has no historical retention capability and ignores the NOHISTORY flag,
but we might use it with the journaling audit trail later.

15 years agoDisallow negative seek positions for regular files, directories, and
Matthew Dillon [Mon, 2 Jun 2008 20:06:36 +0000 (20:06 +0000)]
Disallow negative seek positions for regular files, directories, and
character-special devices to conform to OpenGroup specifications.

Reported-by: VOROSKOI Andras <voroskoi@gmail.com>
15 years agoAdd missing exit(1).
Matthew Dillon [Mon, 2 Jun 2008 20:03:22 +0000 (20:03 +0000)]
Add missing exit(1).

Reported-by: Johannes Hofmann <hofmann@blob.baaderstrasse.com>
15 years agoHAMMER Utilities: Correct vol0_stat_freebigblocks.
Matthew Dillon [Mon, 2 Jun 2008 16:57:53 +0000 (16:57 +0000)]
HAMMER Utilities: Correct vol0_stat_freebigblocks.

* The root_vol->ondisk->vol0_stat_freebigblocks was not being properly
  decremented when newfs_hammer allocated big blocks, causing it to report
  a value that is too large.

15 years agoFix kernel compile warnings.
Matthew Dillon [Mon, 2 Jun 2008 16:55:08 +0000 (16:55 +0000)]
Fix kernel compile warnings.

15 years agoEven using the objcache we need a one-per-cpu free-thread cache in order
Matthew Dillon [Mon, 2 Jun 2008 16:54:21 +0000 (16:54 +0000)]
Even using the objcache we need a one-per-cpu free-thread cache in order
to keep an exiting thread intact throughout its exit sequence.

This fixes a double-fault which can occur on shutdown.  The bug was mainly
tickled by exiting kernel threads.

15 years agoAccording to SUSv3 including just regex.h must be enough. Fixes build of
Hasso Tepper [Mon, 2 Jun 2008 06:50:08 +0000 (06:50 +0000)]
According to SUSv3 including just regex.h must be enough. Fixes build of
several pkgsrc packages.

15 years agoUnbreak buildworld.
Hasso Tepper [Mon, 2 Jun 2008 06:42:45 +0000 (06:42 +0000)]
Unbreak buildworld.

15 years agoHAMMER 50/Many: VFS_STATVFS() support, stabilization.
Matthew Dillon [Sun, 1 Jun 2008 21:05:39 +0000 (21:05 +0000)]
HAMMER 50/Many: VFS_STATVFS() support, stabilization.

* Add support for VFS_STATVFS(), returning 64 bit quantities for available
  space, etc.

* When freeing a big-block any holes cached for that block must be
  cleaned out.

* Fix a conditional testing whether a layer2 big-block must be allocated in
  layer1.  The bug could only occur if a layer2 big-block gets freed in
  layer1, and we currently never do this.

* Clean-up comments related to freeing blocks.

15 years agoHAMMER Utilities: Performance adjustments, bug fixes.
Matthew Dillon [Sun, 1 Jun 2008 20:59:29 +0000 (20:59 +0000)]
HAMMER Utilities: Performance adjustments, bug fixes.

* Newfs_hammer now pre-allocates the layer1 and layer2 blockmap blocks,
  and pre-sizes each blockmap to 4x the initial filesystem size instead
  of 100x the initial filesystem size.

  The blockmap can be dynamically resized at any time, given a little code.
  In addition, there is simply no need to give it a 100x initial dynamic
  range.  This only bloats the size of the layer-2 map unnecessarily.

* Change alloc_blockmap() to use rootmap->next_offset for allocations
  instead of rootmap->alloc_offset and fix a bug where rootmap->phys_offset
  was improperly being incremented (it is a fixed field once set).

  The bug was in a code-path that could not by executed by current
  incarnations of newfs_hammer.

15 years agoUse newly available libc and system calls related to statvfs to make df
Matthew Dillon [Sun, 1 Jun 2008 20:52:21 +0000 (20:52 +0000)]
Use newly available libc and system calls related to statvfs to make df
work with 64 bit statvfs fields.  Tested with a 4TB VN-backed HAMMER
filesystem.

15 years agoAdd getmntvinfo() which uses the new getvfsstat() system call.
Matthew Dillon [Sun, 1 Jun 2008 20:46:45 +0000 (20:46 +0000)]
Add getmntvinfo() which uses the new getvfsstat() system call.

15 years agoMore header file cleanups related statvfs.
Matthew Dillon [Sun, 1 Jun 2008 20:44:45 +0000 (20:44 +0000)]
More header file cleanups related statvfs.

15 years agoClean up statvfs() and related prototypes. Place the prototypes in the
Matthew Dillon [Sun, 1 Jun 2008 20:18:03 +0000 (20:18 +0000)]
Clean up statvfs() and related prototypes.  Place the prototypes in the
correct file.