Exemple #1
0
uint32_t llm_noq_lock_make_req (bdbm_drv_info_t* bdi, bdbm_llm_req_t* llm_req)
{
	uint32_t ret;
	uint64_t punit_id;
	struct bdbm_llm_noq_lock_private* p;
	static uint64_t cnt = 0;

	p = (struct bdbm_llm_noq_lock_private*)BDBM_LLM_PRIV(bdi);

	/* get a parallel unit ID */
	punit_id = llm_req->phyaddr.punit_id;

	/* wait until a parallel unit becomes idle */
	bdbm_sema_lock (&p->punit_locks[punit_id]);

	if (cnt % 50000 == 0) {
		bdbm_msg ("llm_make_req: %llu", cnt);
	}
	cnt++;

	pmu_update_sw (bdi, llm_req);

	/* send a request to a device manager */
	ret = bdi->ptr_dm_inf->make_req (bdi, llm_req);

	/* handle error cases */
	if (ret != 0) {
		/* complete a lock */
		bdbm_sema_unlock (&p->punit_locks[punit_id]);
		bdbm_error ("llm_make_req failed");
	}

	return ret;
}
Exemple #2
0
uint32_t llm_rmq_make_req (h4h_drv_info_t* bdi, h4h_llm_req_t* r)
{
	uint32_t ret;
	uint64_t punit_id;
	struct h4h_llm_rmq_private* p = (struct h4h_llm_rmq_private*)H4H_LLM_PRIV(bdi);

	/* FIXME: ugry */
	rd_prior_iotype_t type;
	if (r->req_type == REQTYPE_READ ||
		r->req_type == REQTYPE_READ_DUMMY ||
		r->req_type == REQTYPE_RMW_READ || 
		r->req_type == REQTYPE_GC_READ ||
		r->req_type == REQTYPE_META_READ) {
		type = RD_PRIORITY_READ;
	} else {
		type = RD_PRIORITY_WRITE;
	}

#if defined(ENABLE_SEQ_DBG)
	h4h_sema_lock (&p->dbg_seq);
#endif

	/* obtain the elapsed time taken by FTL algorithms */
	pmu_update_sw (bdi, r);

	/* get a parallel unit ID */
	punit_id = r->phyaddr->punit_id;

	while (h4h_rd_prior_queue_get_nr_items (p->q) >= 96) {
		/*yield ();*/
		h4h_thread_yield ();
	}

	/* put a request into Q */
#if defined(QUICK_FIX_FOR_RWM)
	if (r->req_type == REQTYPE_RMW_READ) {
		/* FIXME: this is a quick fix to support RMW; it must be improved later */
		/* step 1: put READ first */
		if ((ret = h4h_rd_prior_queue_enqueue (p->q, punit_id, r->lpa, (void*)r, type))) {
			h4h_msg ("h4h_prior_queue_enqueue failed");
		}

		/* step 2: put WRITE second with the same LPA */
		punit_id = r->phyaddr_w.punit_id;
		if ((ret = h4h_rd_prior_queue_enqueue (p->q, punit_id, r->lpa, (void*)r, type))) {
			h4h_msg ("h4h_prior_queue_enqueue failed");
		}
	} else {
		if ((ret = h4h_rd_prior_queue_enqueue (p->q, punit_id, r->lpa, (void*)r, type))) {
			h4h_msg ("h4h_prior_queue_enqueue failed");
		}
	}
#else
	if ((ret = h4h_rd_prior_queue_enqueue (p->q, punit_id, r->lpa, (void*)r, type))) {
		h4h_msg ("h4h_prior_queue_enqueue failed");
	}
#endif

	/* wake up thread if it sleeps */
	h4h_thread_wakeup (p->llm_thread);

	return ret;
}