~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/block/blk-cgroup-rwstat.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /block/blk-cgroup-rwstat.c (Version linux-6.11.5) and /block/blk-cgroup-rwstat.c (Version linux-4.17.19)


  1 /* SPDX-License-Identifier: GPL-2.0                 1 
  2  *                                                
  3  * Legacy blkg rwstat helpers enabled by CONFI    
  4  * Do not use in new code.                        
  5  */                                               
  6 #include "blk-cgroup-rwstat.h"                    
  7                                                   
  8 int blkg_rwstat_init(struct blkg_rwstat *rwsta    
  9 {                                                 
 10         int i, ret;                               
 11                                                   
 12         ret = percpu_counter_init_many(rwstat-    
 13         if (ret)                                  
 14                 return ret;                       
 15                                                   
 16         for (i = 0; i < BLKG_RWSTAT_NR; i++)      
 17                 atomic64_set(&rwstat->aux_cnt[    
 18         return 0;                                 
 19 }                                                 
 20 EXPORT_SYMBOL_GPL(blkg_rwstat_init);              
 21                                                   
 22 void blkg_rwstat_exit(struct blkg_rwstat *rwst    
 23 {                                                 
 24         percpu_counter_destroy_many(rwstat->cp    
 25 }                                                 
 26 EXPORT_SYMBOL_GPL(blkg_rwstat_exit);              
 27                                                   
 28 /**                                               
 29  * __blkg_prfill_rwstat - prfill helper for a     
 30  * @sf: seq_file to print to                      
 31  * @pd: policy private data of interest           
 32  * @rwstat: rwstat to print                       
 33  *                                                
 34  * Print @rwstat to @sf for the device assocai    
 35  */                                               
 36 u64 __blkg_prfill_rwstat(struct seq_file *sf,     
 37                          const struct blkg_rws    
 38 {                                                 
 39         static const char *rwstr[] = {            
 40                 [BLKG_RWSTAT_READ]      = "Rea    
 41                 [BLKG_RWSTAT_WRITE]     = "Wri    
 42                 [BLKG_RWSTAT_SYNC]      = "Syn    
 43                 [BLKG_RWSTAT_ASYNC]     = "Asy    
 44                 [BLKG_RWSTAT_DISCARD]   = "Dis    
 45         };                                        
 46         const char *dname = blkg_dev_name(pd->    
 47         u64 v;                                    
 48         int i;                                    
 49                                                   
 50         if (!dname)                               
 51                 return 0;                         
 52                                                   
 53         for (i = 0; i < BLKG_RWSTAT_NR; i++)      
 54                 seq_printf(sf, "%s %s %llu\n",    
 55                            rwstat->cnt[i]);       
 56                                                   
 57         v = rwstat->cnt[BLKG_RWSTAT_READ] +       
 58                 rwstat->cnt[BLKG_RWSTAT_WRITE]    
 59                 rwstat->cnt[BLKG_RWSTAT_DISCAR    
 60         seq_printf(sf, "%s Total %llu\n", dnam    
 61         return v;                                 
 62 }                                                 
 63 EXPORT_SYMBOL_GPL(__blkg_prfill_rwstat);          
 64                                                   
 65 /**                                               
 66  * blkg_prfill_rwstat - prfill callback for bl    
 67  * @sf: seq_file to print to                      
 68  * @pd: policy private data of interest           
 69  * @off: offset to the blkg_rwstat in @pd         
 70  *                                                
 71  * prfill callback for printing a blkg_rwstat.    
 72  */                                               
 73 u64 blkg_prfill_rwstat(struct seq_file *sf, st    
 74                        int off)                   
 75 {                                                 
 76         struct blkg_rwstat_sample rwstat = { }    
 77                                                   
 78         blkg_rwstat_read((void *)pd + off, &rw    
 79         return __blkg_prfill_rwstat(sf, pd, &r    
 80 }                                                 
 81 EXPORT_SYMBOL_GPL(blkg_prfill_rwstat);            
 82                                                   
 83 /**                                               
 84  * blkg_rwstat_recursive_sum - collect hierarc    
 85  * @blkg: blkg of interest                        
 86  * @pol: blkcg_policy which contains the blkg_    
 87  * @off: offset to the blkg_rwstat in blkg_pol    
 88  * @sum: blkg_rwstat_sample structure containi    
 89  *                                                
 90  * Collect the blkg_rwstat specified by @blkg,    
 91  * online descendants and their aux counts.  T    
 92  * queue lock for online tests.                   
 93  *                                                
 94  * If @pol is NULL, blkg_rwstat is at @off byt    
 95  * is at @off bytes into @blkg's blkg_policy_d    
 96  */                                               
 97 void blkg_rwstat_recursive_sum(struct blkcg_gq    
 98                 int off, struct blkg_rwstat_sa    
 99 {                                                 
100         struct blkcg_gq *pos_blkg;                
101         struct cgroup_subsys_state *pos_css;      
102         unsigned int i;                           
103                                                   
104         lockdep_assert_held(&blkg->q->queue_lo    
105                                                   
106         memset(sum, 0, sizeof(*sum));             
107         rcu_read_lock();                          
108         blkg_for_each_descendant_pre(pos_blkg,    
109                 struct blkg_rwstat *rwstat;       
110                                                   
111                 if (!pos_blkg->online)            
112                         continue;                 
113                                                   
114                 if (pol)                          
115                         rwstat = (void *)blkg_    
116                 else                              
117                         rwstat = (void *)pos_b    
118                                                   
119                 for (i = 0; i < BLKG_RWSTAT_NR    
120                         sum->cnt[i] += blkg_rw    
121         }                                         
122         rcu_read_unlock();                        
123 }                                                 
124 EXPORT_SYMBOL_GPL(blkg_rwstat_recursive_sum);     
125                                                   

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php