@@ -95,9 +95,7 @@ typedef struct fd_rpc_reasm_map_elem fd_rpc_reasm_map_elem_t;
95
95
#define FD_REASM_MAP_COL_HEIGHT (128UL)
96
96
struct fd_rpc_reasm_map {
97
97
struct fd_rpc_reasm_map_column {
98
- ulong max_idx ; /* The max shred index set in this column + 1 */
99
- ulong used_cnt ; /* The number of shreds received in this column */
100
- uchar end_found ; /* Whether the last slice of the slot has been found */
98
+ ulong ele_cnt ; /* The number of shreds received in this column */ uchar end_found ; /* Whether the last slice of the slot has been found */
101
99
fd_rpc_reasm_map_elem_t * ele [FD_REASM_MAP_COL_HEIGHT ];
102
100
} cols [FD_REASM_MAP_COL_CNT ];
103
101
ulong head ; /* Next open column */
@@ -185,8 +183,8 @@ fd_rpc_history_debug(fd_rpc_history_t * hist) {
185
183
for ( ulong slot = reasm_map -> tail ; slot < reasm_map -> head ; slot ++ ) {
186
184
ulong col_idx = slot & (FD_REASM_MAP_COL_CNT - 1 );
187
185
struct fd_rpc_reasm_map_column * col = & reasm_map -> cols [col_idx ];
188
- FD_LOG_NOTICE (( "slot %lu: %lu fecs, %lu max, %d end_found " , slot , col -> used_cnt , col -> max_idx , ( int ) col -> end_found ));
189
- tot_cnt += col -> used_cnt ;
186
+ FD_LOG_NOTICE (( "slot %lu: %lu fecs" , slot , col -> ele_cnt ));
187
+ tot_cnt += col -> ele_cnt ;
190
188
}
191
189
FD_LOG_NOTICE (( "%lu head, %lu tail, %lu total fecs, %lu total blocks" ,
192
190
reasm_map -> head , reasm_map -> tail , tot_cnt , reasm_map -> head - reasm_map -> tail ));
@@ -269,13 +267,13 @@ fd_rpc_history_process_column(fd_rpc_history_t * hist, struct fd_rpc_reasm_map_c
269
267
/* Assemble the block */
270
268
ulong slot = fec -> slot ;
271
269
ulong blk_sz = 0 ;
272
- for ( ulong i = 0 ; i < col -> max_idx ; i ++ ) {
270
+ for ( ulong i = 0 ; i < col -> ele_cnt ; i ++ ) {
273
271
fd_rpc_reasm_map_elem_t * ele = col -> ele [i ];
274
272
blk_sz += ele -> data .data_sz ;
275
273
}
276
274
uchar * blk_data = fd_spad_alloc ( hist -> spad , alignof(ulong ), blk_sz );
277
275
ulong blk_off = 0 ;
278
- for ( ulong i = 0 ; i < col -> max_idx ; i ++ ) {
276
+ for ( ulong i = 0 ; i < col -> ele_cnt ; i ++ ) {
279
277
fd_rpc_reasm_map_elem_t * ele = col -> ele [i ];
280
278
fd_memcpy ( blk_data + blk_off , ele -> data .data , ele -> data .data_sz );
281
279
blk_off += ele -> data .data_sz ;
@@ -304,16 +302,14 @@ static void
304
302
fd_rpc_history_discard_column (fd_rpc_reasm_map_t * reasm_map , fd_rpc_reasm_map_elem_t * reasm_pool , ulong slot ) {
305
303
ulong col_idx = slot & (FD_REASM_MAP_COL_CNT - 1 );
306
304
struct fd_rpc_reasm_map_column * col = & reasm_map -> cols [col_idx ];
307
- for ( ulong i = 0 ; i < col -> max_idx ; i ++ ) {
305
+ for ( ulong i = 0 ; i < col -> ele_cnt ; i ++ ) {
308
306
fd_rpc_reasm_map_elem_t * ele = col -> ele [i ];
309
307
if ( ele ) {
310
308
fd_rpc_reasm_pool_ele_release ( reasm_pool , ele );
311
309
col -> ele [i ] = NULL ;
312
310
}
313
311
}
314
- col -> max_idx = 0 ;
315
- col -> used_cnt = 0 ;
316
- col -> end_found = 0 ;
312
+ col -> ele_cnt = 0 ;
317
313
}
318
314
319
315
void
@@ -336,24 +332,16 @@ fd_rpc_history_save_fec(fd_rpc_history_t * hist, fd_store_t * store, fd_reasm_fe
336
332
while ( fec_msg -> slot >= reasm_map -> head ) {
337
333
ulong col_idx = (reasm_map -> head ++ ) & (FD_REASM_MAP_COL_CNT - 1 );
338
334
struct fd_rpc_reasm_map_column * col = & reasm_map -> cols [col_idx ];
339
- col -> max_idx = 0 ;
340
- col -> used_cnt = 0 ;
341
- col -> end_found = 0 ;
335
+ col -> ele_cnt = 0 ;
342
336
}
343
337
FD_TEST ( fec_msg -> slot >= reasm_map -> tail && fec_msg -> slot < reasm_map -> head && reasm_map -> head - reasm_map -> tail <= FD_REASM_MAP_COL_CNT );
344
338
345
339
ulong col_idx = fec_msg -> slot & (FD_REASM_MAP_COL_CNT - 1 );
346
340
struct fd_rpc_reasm_map_column * col = & reasm_map -> cols [col_idx ];
347
341
348
- FD_TEST ( fec_msg -> fec_set_idx < FD_REASM_MAP_COL_HEIGHT );
342
+ FD_TEST ( col -> ele_cnt < FD_REASM_MAP_COL_HEIGHT );
349
343
350
- /* See if we've already received this fec */
351
- if ( col -> max_idx > fec_msg -> fec_set_idx && col -> ele [fec_msg -> fec_set_idx ] != NULL ) return ;
352
- while ( col -> max_idx <= fec_msg -> fec_set_idx ) {
353
- col -> ele [col -> max_idx ++ ] = NULL ;
354
- }
355
-
356
- /* Acquire space for the shred. If we've run out of space, discard the oldest column */
344
+ /* Acquire space for the fec data. If we've run out of space, discard the oldest column */
357
345
fd_rpc_reasm_map_elem_t * ele = NULL ;
358
346
do {
359
347
ele = fd_rpc_reasm_pool_ele_acquire ( reasm_pool );
@@ -364,11 +352,9 @@ fd_rpc_history_save_fec(fd_rpc_history_t * hist, fd_store_t * store, fd_reasm_fe
364
352
365
353
ulong data_sz = ele -> data .data_sz = fec_p -> data_sz ;
366
354
fd_memcpy ( ele -> data .data , fec_p -> data , data_sz );
367
- col -> ele [fec_msg -> fec_set_idx ] = ele ;
368
- col -> used_cnt ++ ;
369
- if ( FD_UNLIKELY ( fec_msg -> slot_complete ) ) col -> end_found = 1 ;
355
+ col -> ele [col -> ele_cnt ++ ] = ele ;
370
356
371
- if ( col -> end_found && col -> used_cnt == col -> max_idx ) {
357
+ if ( fec_msg -> slot_complete ) {
372
358
/* We've received all the shreds for this slot. Process it. */
373
359
fd_rpc_history_process_column ( hist , col , fec_msg );
374
360
fd_rpc_history_discard_column ( reasm_map , reasm_pool , fec_msg -> slot );
0 commit comments