-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.csiden.org/r/131/
-----------------------------------------------------------

Review request for OpenZFS Developer Mailing List.


Bugs: 5056
    https://www.illumos.org/projects/illumos-gate//issues/5056


Repository: illumos-gate


Description
-------

Various improvements the dmu buf user API.
                              
Submitted by:   Justin Gibbs <[email protected]>                         
 
Submitted by:   Will Andrews <[email protected]>                           
 
Sponsored by:   Spectra Logic Corporation                                       
 
                                                                                
 
Collect dmu buf user API support data into a new structure,                     
 
dmu_buf_user_t.  Consumers of this interface must include a dmu_buf_user_t      
 
as a member of the user data structure that will be attached to a               
 
dmu buffer.  This reduces the size of dmu_buf_impl_t by two pointers.           
 
                                                                                
 
Queue dmu buf user eviction processing and defer it until after locks           
 
are dropped.  This prevents FreeBSD witness(4) lock-order reversal              
 
warnings and potential deadlocks.                                               
 
                                                                                
 
Modify existing users of the dmu buf user API to never access the dbuf to       
 
which their data was attached after user eviction has occurred.  Accessing      
 
the dbuf from the callback is no longer safe now that callbacks occur           
 
without the locks that used to protect them.  Enforce this in ZFS_DEBUG         
 
kernel builds by clearing the user's pointer to the dbuf, if any, at            
 
the time of eviction.  Callbacks have also been modified to clear their         
 
dbuf pointer so most errors are caught even on non ZFS_DEBUG kernels.           
 
However, this will not catch accesses from other contexts that occur            
 
between the time of eviction and the processing of the callback.                
 
                                                                                
 
Clarify programmer intent and improve readability by providing specialized      
 
functions for the common user data update actions "remove" and "replace".       
 
                                                                                
 
Provide code-comment documentation for each API call.                           
 
                                                                                
 
Perform runtime validation of proper API usage on ZFS_DEBUG kernels.            
 
                                                                                
 
uts/common/fs/zfs/sys/dbuf.h:                                                   
 
uts/common/fs/zfs/dbuf.c:                                                       
 
        Add dbuf_verify_user() and call it from the dbuf user API and           
 
        during dbuf eviction processing to verify dbuf user API state.          
 
                                                                                
 
        Add a list_t* argument to dbuf_clear(), dbuf_clear_data,                
 
        dbuf_fix_old_data, and dbuf_evict().  This list is initialized          
 
        by the caller of these APIs via dbuf_create_user_evict_list()           
 
        and processed, once locks are dropped, via the                          
 
        dbuf_process_user_evicts() or dbuf_destroy_user_evict_list()            
 
        APIs.  Typically dbuf_destroy_user_evict_list() is used, but            
 
        dbuf_process_user_evicts() may be used to prevent the undue             
 
        deferral of large amounts cleanup work.  See dnode_evict_dbufs()        
 
        for an example of this usage.                                           
 
                                                                                
 
        Replace calls to dbuf_set_data(db, NULL) with more explicit             
 
        db_clear_data().  dbuf_set_data() now asserts that its buffer           
 
        is never NULL.                                                          
 
                                                                                
 
        Implement new dmu buf API functions.                                    
 
                                                                                
 
uts/common/fs/zfs/dnode.c:                                                      
 
uts/common/fs/zfs/dnode_sync.c:                                                 
 
        Allocate and process dmu buf user eviction lists.                       
 
                                                                                
 
uts/common/fs/zfs/dmu_objset.c:                                                 
 
        Modify dmu_objset_evict() so that it doesn't reference the         
        evicted dbuf.                                                           
 
                                                                                
 
uts/common/fs/zfs/dsl_deadlist.c:                                               
 
uts/common/fs/zfs/dsl_dataset.c:                                                
 
        Modify dsl_dataset_evict() so that it doesn't reference the             
 
        evicted dbuf to determine if the deadlist needs to be closed.           
 
        This is achieved by checking ds->ds_deadlist.dl_os instead              
 
        which is now properly cleared when a deadlist is closed prior           
 
        to eviction.                                                            
 
                                                                                
 
uts/common/fs/zfs/sys/dsl_dataset.h:                                            
 
uts/common/fs/zfs/sys/sa_impl.h:                                                
 
uts/common/fs/zfs/dsl_dataset.c:                                                
 
uts/common/fs/zfs/dsl_dir.c:                                                    
 
uts/common/fs/zfs/dsl_prop.c:                                                   
 
uts/common/fs/zfs/sa.c:                                                         
 
uts/common/fs/zfs/zap.c:                                                        
 
uts/common/fs/zfs/zap_micro.c:                                                  
 
        Conform to new dbuf user API.                                           
 
                                                                                
 
uts/common/fs/zfs/sys/dmu.h:                                                    
 
        Add prototypes, data structures, and code comment documentation         
 
        for the dmu buf user api.                                               
 
                                                                                
 
uts/common/fs/zfs/sys/dmu.h:                                                    
 
uts/common/fs/zfs/zfs_sa.c:                                                     
 
        Pull in definitions for list_node_t via zfs_context.h.                  
 
                                                                                
 
cmd/truss/expound.c:                                                            
 
cmd/zstreamdump/zstreamdump.c:                                                  
 
common/zfs/zfs_deleg.c:                                                         
 
lib/libzfs/common/libzfs_impl.h:                                                
 
lib/libzfs/common/libzfs_pool.c:                                                
 
lib/libzfs/common/sys/zfs_context.h:                                            
 
lib/libzfs_core/common/libzfs_core.h:                                           
 
        Pull in stddef.h so that offsetof() is available for use                
 
        by the ZFS headers.


Diffs
-----

  usr/src/uts/common/fs/zfs/zfs_sa.c ed5f27647510d51ec35b3e1bd213dec892d2d6dd 
  usr/src/uts/common/fs/zfs/zap_micro.c 
81ea4f730f97251ec54aefa91ae9de70e356ca8a 
  usr/src/uts/common/fs/zfs/zap.c de2d4deb00ebe665939bbbb64088c9eedacaac68 
  usr/src/uts/common/fs/zfs/sys/zap_leaf.h 
cd8b74a77a8c62098c701aac01c6bedd57f20a6b 
  usr/src/uts/common/fs/zfs/sys/zap_impl.h 
0d4fc69815fcadf7323206aad69383a6ef9e8662 
  usr/src/uts/common/fs/zfs/sys/sa_impl.h 
6b9af2ef4f89760047d1f8c67bf5e641b6f08de7 
  usr/src/uts/common/fs/zfs/sys/dsl_dir.h 
490455dce7a05137e79fd567edd342c234e7a946 
  usr/src/uts/common/fs/zfs/sys/dsl_dataset.h 
3160a05a8c59a9d504dd2e34b78296a377975a0a 
  usr/src/uts/common/fs/zfs/sys/dnode.h 
5668af1fef08f5785173af7d3ee0bb41d27d1e12 
  usr/src/uts/common/fs/zfs/sys/dmu.h 24473daa6d2b5f9b5af2b4857d4f6e4b6d1abc7f 
  usr/src/uts/common/fs/zfs/sys/dbuf.h 8be8ed6bc85bf1a30673d3755c40f6b02a5c11b2 
  usr/src/uts/common/fs/zfs/sa.c 27d8513541a45e158321fd2ef3c54de9a02ac5ee 
  usr/src/uts/common/fs/zfs/dsl_dir.c f49584168344629463041e177d3202fa6d4e396b 
  usr/src/uts/common/fs/zfs/dsl_deadlist.c 
4ac562bfdba32382d2d1d807293640c9c1430657 
  usr/src/uts/common/fs/zfs/dsl_dataset.c 
5baf5c3c0a11db1deb546fa3b365f6faa1bfd4ca 
  usr/src/uts/common/fs/zfs/dnode_sync.c 
2a57aee904fd643b24c7f07d42c4df51b934a1e9 
  usr/src/uts/common/fs/zfs/dnode.c 250dd9f9415ed1d670de2aef983d022002fa169a 
  usr/src/uts/common/fs/zfs/dmu_objset.c 
e39264cc2f9324fb17746876b80d1454f1920b7d 
  usr/src/uts/common/fs/zfs/dbuf.c bcf66bc53d7b5b3320f78679a9a631e16adb8c10 
  usr/src/lib/libzfs_core/common/libzfs_core.h 
bdd6c951ee496dc1e21a297e7a69b1342aecf79b 
  usr/src/lib/libzfs/common/sys/zfs_context.h 
6305bf562e553b42d4d50fb6ddbf6cd43c3f2c60 
  usr/src/lib/libzfs/common/libzfs_pool.c 
675286c756b7ffa23615357a9258eaf9e3c172b0 
  usr/src/lib/libzfs/common/libzfs_impl.h 
ad4142da3fa83aca9da67b9b8117aeb067b19f5c 
  usr/src/common/zfs/zfs_deleg.c 49540ead1d9770756383cf2e95105885bec60999 
  usr/src/cmd/zstreamdump/zstreamdump.c 
d99d8014f049def80fafae01a7408b199d6c0794 
  usr/src/cmd/truss/expound.c 915ec4626b0f2458c531afde4b57161e1e08a036 

Diff: https://reviews.csiden.org/r/131/diff/


Testing
-------


Thanks,

Justin Gibbs

_______________________________________________
developer mailing list
[email protected]
http://lists.open-zfs.org/mailman/listinfo/developer

Reply via email to