Allow arc_evict_ghost() to only evict meta data
authorBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 25 Jul 2013 17:28:45 +0000 (10:28 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 9 Aug 2013 17:06:08 +0000 (10:06 -0700)
commit68121a03daf58a7d5b9351f110196b8ce806e1fa
treec8c6a3e402c2e2f76881df9a004f8297815bb418
parent4e59f475118b7081a3f950ebf7c70b5bfc7c9778
Allow arc_evict_ghost() to only evict meta data

The default behavior of arc_evict_ghost() is to start by evicting
data buffers.  Then only if the requested number of bytes to evict
cannot be satisfied by data buffers move on to meta data buffers.

This is ideal for honoring arc_c since it's preferable to keep the
meta data cached.  However, if we're trying to free memory from the
arc to honor the meta limit it's a problem because we will need to
discard all the data to get to the meta data.

To avoid this issue the arc_evict_ghost() is now passed a fourth
argumented describing which buffer type to start with.  The
arc_evict() function already behaves exactly like this for a
same reason so this is consistent with the existing code.

All existing callers have been updated to pass ARC_BUFC_DATA so
this patch introduces no functional change.  New callers may
pass ARC_BUFC_METADATA to skip immediately to evicting meta
data leaving the normal data untouched.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
module/zfs/arc.c