kernel/eka/drivers/locmedia/locmedia.cpp
branchRCL_3
changeset 26 c734af59ce98
parent 19 4a8fed1c0ef6
child 28 5b5d147c7838
equal deleted inserted replaced
24:41f0cfe18c80 26:c734af59ce98
  3613 // For data-paging media, calls DPagingDevice::NotifyBusy() when count goes positive
  3613 // For data-paging media, calls DPagingDevice::NotifyBusy() when count goes positive
  3614 //
  3614 //
  3615 void DPrimaryMediaBase::RequestCountInc()
  3615 void DPrimaryMediaBase::RequestCountInc()
  3616 	{
  3616 	{
  3617 	__ASSERT_DEBUG(iBody, LOCM_FAULT());
  3617 	__ASSERT_DEBUG(iBody, LOCM_FAULT());
  3618 	TInt oldVal = (TInt) __e32_atomic_add_ord32(&iBody->iRequestCount, (TUint) 1);
  3618 	if (iBody->iPagingDevice)
  3619 //Kern::Printf("RCINC: this %x cnt %d, old %d", this, iBody->iRequestCount, oldVal);
  3619 		{
  3620 	
  3620 		NFastMutex* lock = iBody->iPagingDevice->NotificationLock();
  3621 	OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DPRIMARYMEDIABASE_REQUESTCOUNTINC, "new count=%d; old count=%d", iBody->iRequestCount, oldVal );
  3621 		NKern::FMWait(lock);
  3622 	
  3622 		TInt oldVal = iBody->iRequestCount++;
  3623 	if (oldVal == 0 && iBody->iPagingDevice)
  3623 		//Kern::Printf("RCINC: this %x cnt %d, old %d", this, iBody->iRequestCount, oldVal);
  3624 		{
  3624 		OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DPRIMARYMEDIABASE_REQUESTCOUNTINC, "new count=%d; old count=%d", iBody->iRequestCount, oldVal );
  3625 //Kern::Printf("RCINC: NotifyBusy()");
  3625 		if (oldVal == 0)
  3626 		iBody->iPagingDevice->NotifyBusy();
  3626 			{
       
  3627 			//Kern::Printf("RCINC: NotifyBusy()");
       
  3628 			iBody->iPagingDevice->NotifyBusy();
       
  3629 			}
       
  3630 		NKern::FMSignal(lock);
  3627 		}
  3631 		}
  3628 	}
  3632 	}
  3629 
  3633 
  3630 // RequestCountDec()
  3634 // RequestCountDec()
  3631 // 
  3635 // 
  3633 // For data-paging media, calls DPagingDevice::NotifyIdle() when count reaches zero
  3637 // For data-paging media, calls DPagingDevice::NotifyIdle() when count reaches zero
  3634 //
  3638 //
  3635 void DPrimaryMediaBase::RequestCountDec()
  3639 void DPrimaryMediaBase::RequestCountDec()
  3636 	{
  3640 	{
  3637 	__ASSERT_DEBUG(iBody, LOCM_FAULT());
  3641 	__ASSERT_DEBUG(iBody, LOCM_FAULT());
  3638 	TInt oldVal = (TInt) __e32_atomic_add_ord32(&iBody->iRequestCount, (TUint) -1);
  3642 	if (iBody->iPagingDevice)
  3639 //Kern::Printf("RCDEC: this %x cnt %d, old %d", this, iBody->iRequestCount, oldVal);
  3643 		{
  3640 	
  3644 		NFastMutex* lock = iBody->iPagingDevice->NotificationLock();
  3641 	OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DPRIMARYMEDIABASE_REQUESTCOUNTDEC, "new count=%d; old count=%d", iBody->iRequestCount, oldVal );
  3645 		NKern::FMWait(lock);
  3642 	
  3646 		TInt oldVal = iBody->iRequestCount--;
  3643 	if (oldVal == 1 && iBody->iPagingDevice)
  3647 		//Kern::Printf("RCDEC: this %x cnt %d, old %d", this, iBody->iRequestCount, oldVal);
  3644 		{
  3648 		OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DPRIMARYMEDIABASE_REQUESTCOUNTDEC, "new count=%d; old count=%d", iBody->iRequestCount, oldVal );
  3645 //Kern::Printf("RCDEC: NotifyIdle()");
  3649 		if (oldVal == 1)
  3646 		iBody->iPagingDevice->NotifyIdle();
  3650 			{
  3647 		}
  3651 			//Kern::Printf("RCDEC: NotifyIdle()");
  3648 	__ASSERT_DEBUG(iBody->iRequestCount >= 0, LOCM_FAULT());
  3652 			iBody->iPagingDevice->NotifyIdle();
       
  3653 			}		
       
  3654 		NKern::FMSignal(lock);
       
  3655 		__ASSERT_DEBUG(iBody->iRequestCount >= 0, LOCM_FAULT());
       
  3656 		}
  3649 	}
  3657 	}
  3650 #endif	// __DEMAND_PAGING__
  3658 #endif	// __DEMAND_PAGING__
  3651 
  3659 
  3652 TPartitionInfo::TPartitionInfo()
  3660 TPartitionInfo::TPartitionInfo()
  3653 //
  3661 //