Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZFS_IOC_COUNT_FILLED does unnecessary txg_wait_synced() #13368

Merged
merged 2 commits into from
Mar 14, 2023

Commits on Mar 13, 2023

  1. ZFS_IOC_COUNT_FILLED does unnecessary txg_wait_synced()

    `lseek(SEEK_DATA | SEEK_HOLE)` are only accurate when the on-disk blocks
    reflect all writes, i.e. when there are no dirty data blocks.  To ensure
    this, if the target dnode is dirty, they wait for the open txg to be
    synced, so we can call them "stabilizing operations".  If they cause
    txg_wait_synced often, it can be detrimental to performance.
    
    Typically, a group of files are all modified, and then SEEK_DATA/HOLE
    are performed on them.  In this case, the first SEEK does a
    txg_wait_synced(), and subsequent SEEKs don't need to wait, so
    performance is good.
    
    However, if a workload involves an interleaved metadata modification,
    the subsequent SEEK may do a txg_wait_synced() unnecessarily.  For
    example, if we do a `read()` syscall to each file before we do its SEEK.
    This applies even with `relatime=on`, when the `read()` is the first
    read after the last write.  The txg_wait_synced() is unnecessary because
    the SEEK operations only care that the structure of the tree of indirect
    and data blocks is up to date on disk.  They don't care about metadata
    like the contents of the bonus or spill blocks.  (They also don't care
    if an existing data block is modified, but this would be more involved
    to filter out.)
    
    This commit changes the behavior of SEEK_DATA/HOLE operations such that
    they do not call txg_wait_synced() if there is only a pending change to
    the bonus or spill block.
    
    Signed-off-by: Matthew Ahrens <[email protected]>
    ahrens committed Mar 13, 2023
    Configuration menu
    Copy the full SHA
    b0365d9 View commit details
    Browse the repository at this point in the history
  2. new file is holey

    ahrens committed Mar 13, 2023
    Configuration menu
    Copy the full SHA
    60ef5d5 View commit details
    Browse the repository at this point in the history