@@ -36,13 +36,32 @@ impl ExtentInner for SqliteInner {
36
36
self . 0 . lock ( ) . unwrap ( ) . dirty ( )
37
37
}
38
38
39
- fn flush (
39
+ fn pre_flush (
40
40
& mut self ,
41
41
new_flush : u64 ,
42
42
new_gen : u64 ,
43
43
job_id : JobOrReconciliationId ,
44
44
) -> Result < ( ) , CrucibleError > {
45
- self . 0 . lock ( ) . unwrap ( ) . flush ( new_flush, new_gen, job_id)
45
+ self . 0 . lock ( ) . unwrap ( ) . pre_flush ( new_flush, new_gen, job_id)
46
+ }
47
+
48
+ fn flush_inner (
49
+ & mut self ,
50
+ job_id : JobOrReconciliationId ,
51
+ ) -> Result < ( ) , CrucibleError > {
52
+ self . 0 . lock ( ) . unwrap ( ) . flush_inner ( job_id)
53
+ }
54
+
55
+ fn post_flush (
56
+ & mut self ,
57
+ new_flush : u64 ,
58
+ new_gen : u64 ,
59
+ job_id : JobOrReconciliationId ,
60
+ ) -> Result < ( ) , CrucibleError > {
61
+ self . 0
62
+ . lock ( )
63
+ . unwrap ( )
64
+ . post_flush ( new_flush, new_gen, job_id)
46
65
}
47
66
48
67
fn read (
@@ -194,10 +213,10 @@ impl SqliteMoreInner {
194
213
Ok ( self . dirty . get ( ) )
195
214
}
196
215
197
- fn flush (
216
+ fn pre_flush (
198
217
& mut self ,
199
- new_flush : u64 ,
200
- new_gen : u64 ,
218
+ _new_flush : u64 ,
219
+ _new_gen : u64 ,
201
220
job_id : JobOrReconciliationId ,
202
221
) -> Result < ( ) , CrucibleError > {
203
222
// Used for profiling
@@ -207,12 +226,19 @@ impl SqliteMoreInner {
207
226
( job_id. get( ) , self . extent_number. 0 , n_dirty_blocks)
208
227
} ) ;
209
228
229
+ Ok ( ( ) )
230
+ }
231
+
232
+ fn flush_inner (
233
+ & mut self ,
234
+ job_id : JobOrReconciliationId ,
235
+ ) -> Result < ( ) , CrucibleError > {
210
236
/*
211
237
* We must first fsync to get any outstanding data written to disk.
212
238
* This must be done before we update the flush number.
213
239
*/
214
240
cdt:: extent__flush__file__start!( || {
215
- ( job_id. get( ) , self . extent_number. 0 , n_dirty_blocks )
241
+ ( job_id. get( ) , self . extent_number. 0 )
216
242
} ) ;
217
243
if let Err ( e) = self . file . sync_all ( ) {
218
244
/*
@@ -225,9 +251,18 @@ impl SqliteMoreInner {
225
251
) ;
226
252
}
227
253
cdt:: extent__flush__file__done!( || {
228
- ( job_id. get( ) , self . extent_number. 0 , n_dirty_blocks )
254
+ ( job_id. get( ) , self . extent_number. 0 )
229
255
} ) ;
230
256
257
+ Ok ( ( ) )
258
+ }
259
+
260
+ fn post_flush (
261
+ & mut self ,
262
+ new_flush : u64 ,
263
+ new_gen : u64 ,
264
+ job_id : JobOrReconciliationId ,
265
+ ) -> Result < ( ) , CrucibleError > {
231
266
// Clear old block contexts. In order to be crash consistent, only
232
267
// perform this after the extent fsync is done. For each block
233
268
// written since the last flush, remove all block context rows where
@@ -237,7 +272,7 @@ impl SqliteMoreInner {
237
272
// file is rehashed, since in that case we don't have that luxury.
238
273
239
274
cdt:: extent__flush__collect__hashes__start!( || {
240
- ( job_id. get( ) , self . extent_number. 0 , n_dirty_blocks )
275
+ ( job_id. get( ) , self . extent_number. 0 )
241
276
} ) ;
242
277
243
278
// Rehash any parts of the file that we *may have written* data to since
@@ -250,7 +285,7 @@ impl SqliteMoreInner {
250
285
} ) ;
251
286
252
287
cdt:: extent__flush__sqlite__insert__start!( || {
253
- ( job_id. get( ) , self . extent_number. 0 , n_dirty_blocks )
288
+ ( job_id. get( ) , self . extent_number. 0 )
254
289
} ) ;
255
290
256
291
// We put all of our metadb updates into a single transaction to
@@ -265,7 +300,7 @@ impl SqliteMoreInner {
265
300
) ?;
266
301
267
302
cdt:: extent__flush__sqlite__insert__done!( || {
268
- ( job_id. get( ) , self . extent_number. 0 , n_dirty_blocks )
303
+ ( job_id. get( ) , self . extent_number. 0 )
269
304
} ) ;
270
305
271
306
self . set_flush_number ( new_flush, new_gen) ?;
@@ -275,9 +310,7 @@ impl SqliteMoreInner {
275
310
// Finally, reset the file's seek offset to 0
276
311
self . file . seek ( SeekFrom :: Start ( 0 ) ) ?;
277
312
278
- cdt:: extent__flush__done!( || {
279
- ( job_id. get( ) , self . extent_number. 0 , n_dirty_blocks)
280
- } ) ;
313
+ cdt:: extent__flush__done!( || { ( job_id. get( ) , self . extent_number. 0 ) } ) ;
281
314
Ok ( ( ) )
282
315
}
283
316
0 commit comments