uint64_t MultiQueueMigrator::GetRealChannel( MQMigrator *at, NVMAddress address ) { if(at->IsMigrated(address)) { return at->GetNewChannel(address); } return address.GetChannel(); }
void MQMigrator::StartMigration( NVMAddress& promotee, NVMAddress& demotee ) { /* * The address being demoted is assumed to be in the "fast" memory and * the address being promoted in the slow memory, therefore we define * the promotion channel as the demotion address' value and similarly * for demotion channel. */ //std::cout<<"start migration"<<std::endl; uint64_t demoChannel, promoChannel; demoChannel = promotee.GetChannel( ); promoChannel = demotee.GetChannel( ); /* Get unique keys for each page to migrate. */ uint64_t promokey = GetAddressKey( promotee ); uint64_t demokey = GetAddressKey( demotee ); /* Ensure we are not already migrating a page. */ assert( migrating == false ); /* * Set the new channel decodings immediately, but mark the migration * as being in progress. */ migrationMap[promokey] = promoChannel; migrationMap[demokey] = demoChannel; //std::cout<<"key promo:"<<promokey<<" state is:"<<MQ_MIGRATION_READING<<std::endl; //std::cout<<"key demo:"<<demokey<<" state is:"<<MQ_MIGRATION_READING<<std::endl; migrationState[promokey] = MQ_MIGRATION_READING; migrationState[demokey] = MQ_MIGRATION_READING; /* * Only one migration is allowed at a time; These values hold the * key values for each migration page and marks a migration in * progress. */ migrating = true; inputPage = promokey; outputPage = demokey; }