Exemple #1
0
/**
 * p9_tag_cleanup - cleans up tags structure and reclaims resources
 * @tags: tags structure from the client struct
 *
 * This frees resources associated with the tags structure
 *
 */
static void p9_tag_cleanup(struct p9_client *c)
{
	int row, col;

	/* check to insure all requests are idle */
	for (row = 0; row < (c->max_tag/P9_ROW_MAXTAG); row++) {
		for (col = 0; col < P9_ROW_MAXTAG; col++) {
			if (c->reqs[row][col].status != REQ_STATUS_IDLE) {
				P9_DPRINTK(P9_DEBUG_MUX,
				  "Attempting to cleanup non-free tag %d,%d\n",
				  row, col);
				/* TODO: delay execution of cleanup */
				return;
			}
		}
	}

	if (c->tagpool)
		p9_idpool_destroy(c->tagpool);

	/* free requests associated with tags */
	for (row = 0; row < (c->max_tag/P9_ROW_MAXTAG); row++) {
		for (col = 0; col < P9_ROW_MAXTAG; col++) {
			kfree(c->reqs[row][col].wq);
			kfree(c->reqs[row][col].tc);
			kfree(c->reqs[row][col].rc);
		}
		kfree(c->reqs[row]);
	}
	c->max_tag = 0;
}
Exemple #2
0
void p9_client_destroy(struct p9_client *clnt)
{
	struct p9_fid *fid, *fidptr;

	P9_DPRINTK(P9_DEBUG_MUX, "clnt %p\n", clnt);

	if (clnt->trans_mod)
		clnt->trans_mod->close(clnt);

	v9fs_put_trans(clnt->trans_mod);

	list_for_each_entry_safe(fid, fidptr, &clnt->fidlist, flist)
		p9_fid_destroy(fid);

	if (clnt->fidpool)
		p9_idpool_destroy(clnt->fidpool);

	p9_tag_cleanup(clnt);

	kfree(clnt);
}
Exemple #3
0
void p9_client_destroy(struct p9_client *clnt)
{
    struct p9_fid *fid, *fidptr;

    P9_DPRINTK(P9_DEBUG_9P, "clnt %p\n", clnt);
    if (clnt->conn) {
        p9_conn_destroy(clnt->conn);
        clnt->conn = NULL;
    }

    if (clnt->trans) {
        clnt->trans->close(clnt->trans);
        kfree(clnt->trans);
        clnt->trans = NULL;
    }

    list_for_each_entry_safe(fid, fidptr, &clnt->fidlist, flist)
    p9_fid_destroy(fid);

    if (clnt->fidpool)
        p9_idpool_destroy(clnt->fidpool);

    kfree(clnt);
}