Ejemplo n.º 1
0
int lov_page_init_raid0(const struct lu_env *env, struct cl_object *obj,
                        struct cl_page *page, struct page *vmpage)
{
    struct lov_object *loo = cl2lov(obj);
    struct lov_layout_raid0 *r0 = lov_r0(loo);
    struct lov_io     *lio = lov_env_io(env);
    struct cl_page    *subpage;
    struct cl_object  *subobj;
    struct lov_io_sub *sub;
    struct lov_page   *lpg = cl_object_page_slice(obj, page);
    loff_t	     offset;
    obd_off	    suboff;
    int		stripe;
    int		rc;

    offset = cl_offset(obj, page->cp_index);
    stripe = lov_stripe_number(loo->lo_lsm, offset);
    LASSERT(stripe < r0->lo_nr);
    rc = lov_stripe_offset(loo->lo_lsm, offset, stripe,
                           &suboff);
    LASSERT(rc == 0);

    lpg->lps_invalid = 1;
    cl_page_slice_add(page, &lpg->lps_cl, obj, &lov_page_ops);

    sub = lov_sub_get(env, lio, stripe);
    if (IS_ERR(sub))
        GOTO(out, rc = PTR_ERR(sub));

    subobj = lovsub2cl(r0->lo_sub[stripe]);
    subpage = cl_page_find_sub(sub->sub_env, subobj,
                               cl_index(subobj, suboff), vmpage, page);
    lov_sub_put(sub);
    if (IS_ERR(subpage))
        GOTO(out, rc = PTR_ERR(subpage));

    if (likely(subpage->cp_parent == page)) {
        lu_ref_add(&subpage->cp_reference, "lov", page);
        lpg->lps_invalid = 0;
        rc = 0;
    } else {
        CL_PAGE_DEBUG(D_ERROR, env, page, "parent page\n");
        CL_PAGE_DEBUG(D_ERROR, env, subpage, "child page\n");
        LASSERT(0);
    }

out:
    return rc;
}
Ejemplo n.º 2
0
static int slp_page_init(const struct lu_env *env, struct cl_object *obj,
			struct cl_page *page, struct page *vmpage)
{
        struct ccc_page *cpg = cl_object_page_slice(obj, page);

        CLOBINVRNT(env, obj, ccc_object_invariant(obj));

	cpg->cpg_page = vmpage;

	if (page->cp_type == CPT_CACHEABLE) {
		LBUG();
	} else {
		struct ccc_object *clobj = cl2ccc(obj);

		cl_page_slice_add(page, &cpg->cpg_cl, obj,
				&slp_transient_page_ops);
		clobj->cob_transient_pages++;
	}

        return 0;
}