Beispiel #1
0
static void
conn_put_locked(cfs_hash_t *hs, cfs_hlist_node_t *hnode)
{
    struct ptlrpc_connection *conn;

    conn = cfs_hlist_entry(hnode, struct ptlrpc_connection, c_hash);
    cfs_atomic_dec(&conn->c_refcount);
}
Beispiel #2
0
static
void null_free_rs(struct ptlrpc_reply_state *rs)
{
        LASSERT_ATOMIC_GT(&rs->rs_svc_ctx->sc_refcount, 1);
        cfs_atomic_dec(&rs->rs_svc_ctx->sc_refcount);

        if (!rs->rs_prealloc)
                OBD_FREE(rs, rs->rs_size);
}
Beispiel #3
0
static void cfs_tage_free(struct cfs_trace_page *tage)
{
        __LASSERT(tage != NULL);
        __LASSERT(tage->page != NULL);

        cfs_free_page(tage->page);
        cfs_free(tage);
        cfs_atomic_dec(&cfs_tage_allocated);
}
Beispiel #4
0
static
void ctx_destroy_pf(struct ptlrpc_sec *sec, struct ptlrpc_cli_ctx *ctx)
{
        struct gss_cli_ctx *gctx = ctx2gctx(ctx);

        if (gss_cli_ctx_fini_common(sec, ctx))
                return;

        OBD_FREE_PTR(gctx);

        cfs_atomic_dec(&sec->ps_nctx);
        sptlrpc_sec_put(sec);
}
/*
 * __free_page
 *   To free the struct page including the page
 *
 * Arguments:
 *   pg:  pointer to the struct page strcture
 *
 * Return Value:
 *   N/A
 *
 * Notes: 
 *   N/A
 */
void __free_page(struct page *pg)
{
	ASSERT(pg != NULL);
	ASSERT(pg->addr  != NULL);
	ASSERT(cfs_atomic_read(&pg->count) <= 1);

	if (!test_bit(PG_virt, &pg->flags)) {
		kmem_cache_free(cfs_page_p_slab, pg->addr);
		cfs_atomic_dec(&libcfs_total_pages);
	} else {
		cfs_enter_debugger();
	}
	kmem_cache_free(cfs_page_t_slab, pg);
}
Beispiel #6
0
/*
 * XXX: for the moment I don't want to use lnb_flags for osd-internal
 *      purposes as it's not very well defined ...
 *      instead I use the lowest bit of the address so that:
 *        arc buffer:  .lnb_obj = abuf          (arc we loan for write)
 *        dbuf buffer: .lnb_obj = dbuf | 1      (dbuf we get for read)
 *        copy buffer: .lnb_page->mapping = obj (page we allocate for write)
 *
 *      bzzz, to blame
 */
static int osd_bufs_put(const struct lu_env *env, struct dt_object *dt,
			struct niobuf_local *lnb, int npages)
{
	struct osd_object *obj  = osd_dt_obj(dt);
	struct osd_device *osd = osd_obj2dev(obj);
	unsigned long      ptr;
	int                i;

	LASSERT(dt_object_exists(dt));
	LASSERT(obj->oo_db);

	for (i = 0; i < npages; i++) {
		if (lnb[i].page == NULL)
			continue;
		if (lnb[i].page->mapping == (void *)obj) {
			/* this is anonymous page allocated for copy-write */
			lnb[i].page->mapping = NULL;
			__free_page(lnb[i].page);
			cfs_atomic_dec(&osd->od_zerocopy_alloc);
		} else {
			/* see comment in osd_bufs_get_read() */
			ptr = (unsigned long)lnb[i].dentry;
			if (ptr & 1UL) {
				ptr &= ~1UL;
				dmu_buf_rele((void *)ptr, osd_zerocopy_tag);
				cfs_atomic_dec(&osd->od_zerocopy_pin);
			} else if (lnb[i].dentry != NULL) {
				dmu_return_arcbuf((void *)lnb[i].dentry);
				cfs_atomic_dec(&osd->od_zerocopy_loan);
			}
		}
		lnb[i].page = NULL;
		lnb[i].dentry = NULL;
	}

	return 0;
}
Beispiel #7
0
/*mds still need lov setup here*/
static int mds_cmd_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
{
        struct mds_obd *mds = &obd->u.mds;
        struct lvfs_run_ctxt saved;
        const char     *dev;
        struct vfsmount *mnt;
        struct lustre_sb_info *lsi;
        struct lustre_mount_info *lmi;
        struct dentry  *dentry;
        int rc = 0;
        ENTRY;

        CDEBUG(D_INFO, "obd %s setup \n", obd->obd_name);
        if (strncmp(obd->obd_name, MDD_OBD_NAME, strlen(MDD_OBD_NAME)))
                RETURN(0);

        if (lcfg->lcfg_bufcount < 5) {
                CERROR("invalid arg for setup %s\n", MDD_OBD_NAME);
                RETURN(-EINVAL);
        }
        dev = lustre_cfg_string(lcfg, 4);
        lmi = server_get_mount(dev);
        LASSERT(lmi != NULL);

        lsi = s2lsi(lmi->lmi_sb);
        mnt = lmi->lmi_mnt;
        /* FIXME: MDD LOV initialize objects.
         * we need only lmi here but not get mount
         * OSD did mount already, so put mount back
         */
        cfs_atomic_dec(&lsi->lsi_mounts);
        mntput(mnt);
        cfs_init_rwsem(&mds->mds_notify_lock);

        obd->obd_fsops = fsfilt_get_ops(MT_STR(lsi->lsi_ldd));
        mds_init_ctxt(obd, mnt);

        push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
        dentry = simple_mkdir(current->fs->pwd, mnt, "OBJECTS", 0777, 1);
        if (IS_ERR(dentry)) {
                rc = PTR_ERR(dentry);
                CERROR("cannot create OBJECTS directory: rc = %d\n", rc);
                GOTO(err_putfs, rc);
        }
        mds->mds_objects_dir = dentry;

        dentry = ll_lookup_one_len("__iopen__", current->fs->pwd,
                                strlen("__iopen__"));
        if (IS_ERR(dentry)) {
                rc = PTR_ERR(dentry);
                CERROR("cannot lookup __iopen__ directory: rc = %d\n", rc);
                GOTO(err_objects, rc);
        }

        mds->mds_fid_de = dentry;
        if (!dentry->d_inode || is_bad_inode(dentry->d_inode)) {
                rc = -ENOENT;
                CERROR("__iopen__ directory has no inode? rc = %d\n", rc);
                GOTO(err_fid, rc);
        }
        rc = mds_lov_init_objids(obd);
        if (rc != 0) {
               CERROR("cannot init lov objid rc = %d\n", rc);
               GOTO(err_fid, rc );
        }

        rc = mds_lov_presetup(mds, lcfg);
        if (rc < 0)
                GOTO(err_objects, rc);

        /* Don't wait for mds_postrecov trying to clear orphans */
        obd->obd_async_recov = 1;
        rc = mds_postsetup(obd);
        /* Bug 11557 - allow async abort_recov start
           FIXME can remove most of this obd_async_recov plumbing
        obd->obd_async_recov = 0;
        */

        if (rc)
                GOTO(err_objects, rc);

err_pop:
        pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
        RETURN(rc);
err_fid:
        dput(mds->mds_fid_de);
err_objects:
        dput(mds->mds_objects_dir);
err_putfs:
        fsfilt_put_ops(obd->obd_fsops);
        goto err_pop;
}