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

TOMOYO Linux Cross Reference
Linux/net/ceph/pagevec.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 /net/ceph/pagevec.c (Version linux-6.11.5) and /net/ceph/pagevec.c (Version linux-6.6.45)


** Warning: Cannot open xref database.

  1 // SPDX-License-Identifier: GPL-2.0                 1 
  2 #include <linux/ceph/ceph_debug.h>                
  3                                                   
  4 #include <linux/module.h>                         
  5 #include <linux/sched.h>                          
  6 #include <linux/slab.h>                           
  7 #include <linux/file.h>                           
  8 #include <linux/namei.h>                          
  9 #include <linux/writeback.h>                      
 10                                                   
 11 #include <linux/ceph/libceph.h>                   
 12                                                   
 13 void ceph_put_page_vector(struct page **pages,    
 14 {                                                 
 15         int i;                                    
 16                                                   
 17         for (i = 0; i < num_pages; i++) {         
 18                 if (dirty)                        
 19                         set_page_dirty_lock(pa    
 20                 put_page(pages[i]);               
 21         }                                         
 22         kvfree(pages);                            
 23 }                                                 
 24 EXPORT_SYMBOL(ceph_put_page_vector);              
 25                                                   
 26 void ceph_release_page_vector(struct page **pa    
 27 {                                                 
 28         int i;                                    
 29                                                   
 30         for (i = 0; i < num_pages; i++)           
 31                 __free_pages(pages[i], 0);        
 32         kfree(pages);                             
 33 }                                                 
 34 EXPORT_SYMBOL(ceph_release_page_vector);          
 35                                                   
 36 /*                                                
 37  * allocate a vector new pages                    
 38  */                                               
 39 struct page **ceph_alloc_page_vector(int num_p    
 40 {                                                 
 41         struct page **pages;                      
 42         int i;                                    
 43                                                   
 44         pages = kmalloc_array(num_pages, sizeo    
 45         if (!pages)                               
 46                 return ERR_PTR(-ENOMEM);          
 47         for (i = 0; i < num_pages; i++) {         
 48                 pages[i] = __page_cache_alloc(    
 49                 if (pages[i] == NULL) {           
 50                         ceph_release_page_vect    
 51                         return ERR_PTR(-ENOMEM    
 52                 }                                 
 53         }                                         
 54         return pages;                             
 55 }                                                 
 56 EXPORT_SYMBOL(ceph_alloc_page_vector);            
 57                                                   
 58 /*                                                
 59  * copy user data into a page vector              
 60  */                                               
 61 int ceph_copy_user_to_page_vector(struct page     
 62                                          const    
 63                                          loff_    
 64 {                                                 
 65         int i = 0;                                
 66         int po = off & ~PAGE_MASK;                
 67         int left = len;                           
 68         int l, bad;                               
 69                                                   
 70         while (left > 0) {                        
 71                 l = min_t(int, PAGE_SIZE-po, l    
 72                 bad = copy_from_user(page_addr    
 73                 if (bad == l)                     
 74                         return -EFAULT;           
 75                 data += l - bad;                  
 76                 left -= l - bad;                  
 77                 po += l - bad;                    
 78                 if (po == PAGE_SIZE) {            
 79                         po = 0;                   
 80                         i++;                      
 81                 }                                 
 82         }                                         
 83         return len;                               
 84 }                                                 
 85 EXPORT_SYMBOL(ceph_copy_user_to_page_vector);     
 86                                                   
 87 void ceph_copy_to_page_vector(struct page **pa    
 88                                     const void    
 89                                     loff_t off    
 90 {                                                 
 91         int i = 0;                                
 92         size_t po = off & ~PAGE_MASK;             
 93         size_t left = len;                        
 94                                                   
 95         while (left > 0) {                        
 96                 size_t l = min_t(size_t, PAGE_    
 97                                                   
 98                 memcpy(page_address(pages[i])     
 99                 data += l;                        
100                 left -= l;                        
101                 po += l;                          
102                 if (po == PAGE_SIZE) {            
103                         po = 0;                   
104                         i++;                      
105                 }                                 
106         }                                         
107 }                                                 
108 EXPORT_SYMBOL(ceph_copy_to_page_vector);          
109                                                   
110 void ceph_copy_from_page_vector(struct page **    
111                                     void *data    
112                                     loff_t off    
113 {                                                 
114         int i = 0;                                
115         size_t po = off & ~PAGE_MASK;             
116         size_t left = len;                        
117                                                   
118         while (left > 0) {                        
119                 size_t l = min_t(size_t, PAGE_    
120                                                   
121                 memcpy(data, page_address(page    
122                 data += l;                        
123                 left -= l;                        
124                 po += l;                          
125                 if (po == PAGE_SIZE) {            
126                         po = 0;                   
127                         i++;                      
128                 }                                 
129         }                                         
130 }                                                 
131 EXPORT_SYMBOL(ceph_copy_from_page_vector);        
132                                                   
133 /*                                                
134  * Zero an extent within a page vector.  Offse    
135  * start of the first page.                       
136  */                                               
137 void ceph_zero_page_vector_range(int off, int     
138 {                                                 
139         int i = off >> PAGE_SHIFT;                
140                                                   
141         off &= ~PAGE_MASK;                        
142                                                   
143         dout("zero_page_vector_page %u~%u\n",     
144                                                   
145         /* leading partial page? */               
146         if (off) {                                
147                 int end = min((int)PAGE_SIZE,     
148                 dout("zeroing %d %p head from     
149                      (int)off);                   
150                 zero_user_segment(pages[i], of    
151                 len -= (end - off);               
152                 i++;                              
153         }                                         
154         while (len >= PAGE_SIZE) {                
155                 dout("zeroing %d %p len=%d\n",    
156                 zero_user_segment(pages[i], 0,    
157                 len -= PAGE_SIZE;                 
158                 i++;                              
159         }                                         
160         /* trailing partial page? */              
161         if (len) {                                
162                 dout("zeroing %d %p tail to %d    
163                 zero_user_segment(pages[i], 0,    
164         }                                         
165 }                                                 
166 EXPORT_SYMBOL(ceph_zero_page_vector_range);       
167                                                   

~ [ 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