static CuckooInsertStatus Filter_KOInsert(CuckooFilter *filter, SubCF *curFilter,const LookupParams *params) {while (counter++< maxIterations) {uint8_t*bucket =&curFilter->data[ii * bucketSize]; // 计算元素应放入的bucketswapFPs(bucket + victimIx,&fp); // 将bucket的头元素和当前元素互换 ii =getAltHash(fp, ii)% numBuckets; // 为换出来的头元素(这里叫受害者)找下一个位置// Insert the new item in potentially the same bucketuint8_t*empty =Bucket_FindAvailable(&curFilter->data[ii * bucketSize], bucketSize); // 下一个位置可以在本bucket内if (empty) { // 如果下个位置是空的,则直接插入*empty = fp; // 赋值指纹信息return CuckooInsert_Inserted; } victimIx = (victimIx +1) % bucketSize; // 如果换出来的受害者没有地方去了,换下一个受害者尝试 }// If we weren't able to insert, we roll back and try to insert new element in new filter// 超过maxIterations会触发扩容,扩容后这里再试一次// 扩容会加个 filter// ...return CuckooInsert_NoSpace;}