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

TOMOYO Linux Cross Reference
Linux/fs/bcachefs/btree_io.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ 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.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /fs/bcachefs/btree_io.h (Version linux-6.12-rc7) and /fs/bcachefs/btree_io.h (Version linux-6.2.16)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 
  2 #ifndef _BCACHEFS_BTREE_IO_H                      
  3 #define _BCACHEFS_BTREE_IO_H                      
  4                                                   
  5 #include "bkey_methods.h"                         
  6 #include "bset.h"                                 
  7 #include "btree_locking.h"                        
  8 #include "checksum.h"                             
  9 #include "extents.h"                              
 10 #include "io_write_types.h"                       
 11                                                   
 12 struct bch_fs;                                    
 13 struct btree_write;                               
 14 struct btree;                                     
 15 struct btree_iter;                                
 16 struct btree_node_read_all;                       
 17                                                   
 18 static inline void set_btree_node_dirty_acct(s    
 19 {                                                 
 20         if (!test_and_set_bit(BTREE_NODE_dirty    
 21                 atomic_long_inc(&c->btree_cach    
 22 }                                                 
 23                                                   
 24 static inline void clear_btree_node_dirty_acct    
 25 {                                                 
 26         if (test_and_clear_bit(BTREE_NODE_dirt    
 27                 atomic_long_dec(&c->btree_cach    
 28 }                                                 
 29                                                   
 30 static inline unsigned btree_ptr_sectors_writt    
 31 {                                                 
 32         return k.k->type == KEY_TYPE_btree_ptr    
 33                 ? le16_to_cpu(bkey_s_c_to_btre    
 34                 : 0;                              
 35 }                                                 
 36                                                   
 37 struct btree_read_bio {                           
 38         struct bch_fs           *c;               
 39         struct btree            *b;               
 40         struct btree_node_read_all *ra;           
 41         u64                     start_time;       
 42         unsigned                have_ioref:1;     
 43         unsigned                idx:7;            
 44         struct extent_ptr_decoded       pick;     
 45         struct work_struct      work;             
 46         struct bio              bio;              
 47 };                                                
 48                                                   
 49 struct btree_write_bio {                          
 50         struct work_struct      work;             
 51         __BKEY_PADDED(key, BKEY_BTREE_PTR_VAL_    
 52         void                    *data;            
 53         unsigned                data_bytes;       
 54         unsigned                sector_offset;    
 55         struct bch_write_bio    wbio;             
 56 };                                                
 57                                                   
 58 void bch2_btree_node_io_unlock(struct btree *)    
 59 void bch2_btree_node_io_lock(struct btree *);     
 60 void __bch2_btree_node_wait_on_read(struct btr    
 61 void __bch2_btree_node_wait_on_write(struct bt    
 62 void bch2_btree_node_wait_on_read(struct btree    
 63 void bch2_btree_node_wait_on_write(struct btre    
 64                                                   
 65 enum compact_mode {                               
 66         COMPACT_LAZY,                             
 67         COMPACT_ALL,                              
 68 };                                                
 69                                                   
 70 bool bch2_compact_whiteouts(struct bch_fs *, s    
 71                             enum compact_mode)    
 72                                                   
 73 static inline bool should_compact_bset_lazy(st    
 74                                             st    
 75 {                                                 
 76         unsigned total_u64s = bset_u64s(t);       
 77         unsigned dead_u64s = bset_dead_u64s(b,    
 78                                                   
 79         return dead_u64s > 64 && dead_u64s * 3    
 80 }                                                 
 81                                                   
 82 static inline bool bch2_maybe_compact_whiteout    
 83 {                                                 
 84         for_each_bset(b, t)                       
 85                 if (should_compact_bset_lazy(b    
 86                         return bch2_compact_wh    
 87                                                   
 88         return false;                             
 89 }                                                 
 90                                                   
 91 static inline struct nonce btree_nonce(struct     
 92 {                                                 
 93         return (struct nonce) {{                  
 94                 [0] = cpu_to_le32(offset),        
 95                 [1] = ((__le32 *) &i->seq)[0],    
 96                 [2] = ((__le32 *) &i->seq)[1],    
 97                 [3] = ((__le32 *) &i->journal_    
 98         }};                                       
 99 }                                                 
100                                                   
101 static inline int bset_encrypt(struct bch_fs *    
102 {                                                 
103         struct nonce nonce = btree_nonce(i, of    
104         int ret;                                  
105                                                   
106         if (!offset) {                            
107                 struct btree_node *bn = contai    
108                 unsigned bytes = (void *) &bn-    
109                                                   
110                 ret = bch2_encrypt(c, BSET_CSU    
111                                    &bn->flags,    
112                 if (ret)                          
113                         return ret;               
114                                                   
115                 nonce = nonce_add(nonce, round    
116         }                                         
117                                                   
118         return bch2_encrypt(c, BSET_CSUM_TYPE(    
119                             vstruct_end(i) - (    
120 }                                                 
121                                                   
122 void bch2_btree_sort_into(struct bch_fs *, str    
123                                                   
124 void bch2_btree_node_drop_keys_outside_node(st    
125                                                   
126 void bch2_btree_build_aux_trees(struct btree *    
127 void bch2_btree_init_next(struct btree_trans *    
128                                                   
129 int bch2_btree_node_read_done(struct bch_fs *,    
130                               struct btree *,     
131 void bch2_btree_node_read(struct btree_trans *    
132 int bch2_btree_root_read(struct bch_fs *, enum    
133                          const struct bkey_i *    
134                                                   
135 bool bch2_btree_post_write_cleanup(struct bch_    
136                                                   
137 enum btree_write_flags {                          
138         __BTREE_WRITE_ONLY_IF_NEED = BTREE_WRI    
139         __BTREE_WRITE_ALREADY_STARTED,            
140 };                                                
141 #define BTREE_WRITE_ONLY_IF_NEED        BIT(__    
142 #define BTREE_WRITE_ALREADY_STARTED     BIT(__    
143                                                   
144 void __bch2_btree_node_write(struct bch_fs *,     
145 void bch2_btree_node_write(struct bch_fs *, st    
146                            enum six_lock_type,    
147                                                   
148 static inline void btree_node_write_if_need(st    
149                                             en    
150 {                                                 
151         bch2_btree_node_write(c, b, lock_held,    
152 }                                                 
153                                                   
154 bool bch2_btree_flush_all_reads(struct bch_fs     
155 bool bch2_btree_flush_all_writes(struct bch_fs    
156                                                   
157 static inline void compat_bformat(unsigned lev    
158                                   unsigned ver    
159                                   int write, s    
160 {                                                 
161         if (version < bcachefs_metadata_versio    
162             btree_id == BTREE_ID_inodes) {        
163                 swap(f->bits_per_field[BKEY_FI    
164                      f->bits_per_field[BKEY_FI    
165                 swap(f->field_offset[BKEY_FIEL    
166                      f->field_offset[BKEY_FIEL    
167         }                                         
168                                                   
169         if (version < bcachefs_metadata_versio    
170             (level || btree_type_has_snapshots    
171                 u64 max_packed =                  
172                         ~(~0ULL << f->bits_per    
173                                                   
174                 f->field_offset[BKEY_FIELD_SNA    
175                         ? 0                       
176                         : cpu_to_le64(U32_MAX     
177         }                                         
178 }                                                 
179                                                   
180 static inline void compat_bpos(unsigned level,    
181                                unsigned versio    
182                                int write, stru    
183 {                                                 
184         if (big_endian != CPU_BIG_ENDIAN)         
185                 bch2_bpos_swab(p);                
186                                                   
187         if (version < bcachefs_metadata_versio    
188             btree_id == BTREE_ID_inodes)          
189                 swap(p->inode, p->offset);        
190 }                                                 
191                                                   
192 static inline void compat_btree_node(unsigned     
193                                      unsigned     
194                                      int write    
195                                      struct bt    
196 {                                                 
197         if (version < bcachefs_metadata_versio    
198             btree_id_is_extents(btree_id) &&      
199             !bpos_eq(bn->min_key, POS_MIN) &&     
200             write)                                
201                 bn->min_key = bpos_nosnap_pred    
202                                                   
203         if (version < bcachefs_metadata_versio    
204             write)                                
205                 bn->max_key.snapshot = 0;         
206                                                   
207         compat_bpos(level, btree_id, version,     
208         compat_bpos(level, btree_id, version,     
209                                                   
210         if (version < bcachefs_metadata_versio    
211             !write)                               
212                 bn->max_key.snapshot = U32_MAX    
213                                                   
214         if (version < bcachefs_metadata_versio    
215             btree_id_is_extents(btree_id) &&      
216             !bpos_eq(bn->min_key, POS_MIN) &&     
217             !write)                               
218                 bn->min_key = bpos_nosnap_succ    
219 }                                                 
220                                                   
221 void bch2_btree_write_stats_to_text(struct pri    
222                                                   
223 #endif /* _BCACHEFS_BTREE_IO_H */                 
224                                                   

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