- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.9k
          txg: generalise txg_wait_synced_sig() to txg_wait_synced_flags()
          #17284
        
          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
          
     Merged
      
      
    Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    
              
                    allanjude
  
              
              approved these changes
              
                  
                    Apr 28, 2025 
                  
              
              
            
            
              
                    amotin
  
              
              approved these changes
              
                  
                    Apr 29, 2025 
                  
              
              
            
            
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no objections, primarily a worry whether we'll be able to watch for few things same time. They'd need to have similar locking. But that's later. Meanwhile just couple things to consider.
txg_wait_synced_sig() is "wait for txg, unless a signal arrives". We expect that future development will require similar "wait unless X" behaviour. This generalises the API as txg_wait_synced_flags(), where the provided flags describe the events that should cause the call to return. Instead of a boolean, the return is now an error code, which the caller can use to know which event caused the call to return. The existing call to txg_wait_synced_sig() is now txg_wait_synced_flags(TXG_WAIT_SIGNAL). Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Signed-off-by: Rob Norris <[email protected]>
              
                    amotin
  
              
              approved these changes
              
                  
                    May 2, 2025 
                  
              
              
            
            
    
  robn 
      added a commit
        to robn/zfs
      that referenced
      this pull request
    
      May 23, 2025 
    
    
      
  
    
      
    
  
…nzfs#17284) txg_wait_synced_sig() is "wait for txg, unless a signal arrives". We expect that future development will require similar "wait unless X" behaviour. This generalises the API as txg_wait_synced_flags(), where the provided flags describe the events that should cause the call to return. Instead of a boolean, the return is now an error code, which the caller can use to know which event caused the call to return. The existing call to txg_wait_synced_sig() is now txg_wait_synced_flags(TXG_WAIT_SIGNAL). Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Signed-off-by: Rob Norris <[email protected]> Reviewed-by: Allan Jude <[email protected]> Reviewed-by: Alexander Motin <[email protected]> (cherry picked from commit a7de203)
    
  robn 
      added a commit
        to robn/zfs
      that referenced
      this pull request
    
      May 24, 2025 
    
    
      
  
    
      
    
  
…nzfs#17284) txg_wait_synced_sig() is "wait for txg, unless a signal arrives". We expect that future development will require similar "wait unless X" behaviour. This generalises the API as txg_wait_synced_flags(), where the provided flags describe the events that should cause the call to return. Instead of a boolean, the return is now an error code, which the caller can use to know which event caused the call to return. The existing call to txg_wait_synced_sig() is now txg_wait_synced_flags(TXG_WAIT_SIGNAL). Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Signed-off-by: Rob Norris <[email protected]> Reviewed-by: Allan Jude <[email protected]> Reviewed-by: Alexander Motin <[email protected]> (cherry picked from commit a7de203)
    
  tonyhutter 
      pushed a commit
      that referenced
      this pull request
    
      May 28, 2025 
    
    
      
  
    
      
    
  
) txg_wait_synced_sig() is "wait for txg, unless a signal arrives". We expect that future development will require similar "wait unless X" behaviour. This generalises the API as txg_wait_synced_flags(), where the provided flags describe the events that should cause the call to return. Instead of a boolean, the return is now an error code, which the caller can use to know which event caused the call to return. The existing call to txg_wait_synced_sig() is now txg_wait_synced_flags(TXG_WAIT_SIGNAL). Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Signed-off-by: Rob Norris <[email protected]> Reviewed-by: Allan Jude <[email protected]> Reviewed-by: Alexander Motin <[email protected]> (cherry picked from commit a7de203)
    
  spauka 
      pushed a commit
        to spauka/zfs
      that referenced
      this pull request
    
      Aug 30, 2025 
    
    
      
  
    
      
    
  
…nzfs#17284) txg_wait_synced_sig() is "wait for txg, unless a signal arrives". We expect that future development will require similar "wait unless X" behaviour. This generalises the API as txg_wait_synced_flags(), where the provided flags describe the events that should cause the call to return. Instead of a boolean, the return is now an error code, which the caller can use to know which event caused the call to return. The existing call to txg_wait_synced_sig() is now txg_wait_synced_flags(TXG_WAIT_SIGNAL). Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Signed-off-by: Rob Norris <[email protected]> Reviewed-by: Allan Jude <[email protected]> Reviewed-by: Alexander Motin <[email protected]>
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
[Sponsors: Klara, Inc., Wasabi Technology, Inc.]
Motivation and Context
We have work in progress that will require breaking out of a
txg_wait_synced()call in some situations. These are still in development, and may change, but are:fsync()return error when the pool suspends,txg_wait_synced()needs to return when the pool suspendstxg_wait_synced().This is the supporting API change to allow these kind of things to be added in the future.
Description
txg_wait_synced_sig()is "wait for txg, unless a signal arrives". We expect that future development will require similar "wait unless X" behaviour.This generalises the API as
txg_wait_synced_flags(), where the provided flags describe the events that should cause the call to return.Instead of a boolean, the return is now an error code, which the caller can use to know which event caused the call to return.
The existing call to
txg_wait_synced_sig()is nowtxg_wait_synced_flags(TXG_WAIT_SIGNAL).How Has This Been Tested?
Compile checked on Linux and FreeBSD. Basic sanity checks done.
(Tested a lot on internal projects too).
Types of changes
Checklist:
Signed-off-by.