static int osc_io_commit_write(const struct lu_env *env, const struct cl_io_slice *ios, const struct cl_page_slice *slice, unsigned from, unsigned to) { struct osc_io *oio = cl2osc_io(env, ios); struct osc_page *opg = cl2osc_page(slice); struct osc_object *obj = cl2osc(opg->ops_cl.cpl_obj); struct osc_async_page *oap = &opg->ops_oap; LASSERT(to > 0); /* * XXX instead of calling osc_page_touch() here and in * osc_io_fault_start() it might be more logical to introduce * cl_page_touch() method, that generic cl_io_commit_write() and page * fault code calls. */ osc_page_touch(env, cl2osc_page(slice), to); if (!client_is_remote(osc_export(obj)) && capable(CFS_CAP_SYS_RESOURCE)) oap->oap_brw_flags |= OBD_BRW_NOQUOTA; if (oio->oi_lockless) /* see osc_io_prepare_write() for lockless io handling. */ cl_page_clip(env, slice->cpl_page, from, to); return 0; }
/** * Checks that there are no pages being written in the extent being truncated. */ static int trunc_check_cb(const struct lu_env *env, struct cl_io *io, struct cl_page *page, void *cbdata) { const struct cl_page_slice *slice; struct osc_page *ops; struct osc_async_page *oap; __u64 start = *(__u64 *)cbdata; slice = cl_page_at(page, &osc_device_type); LASSERT(slice != NULL); ops = cl2osc_page(slice); oap = &ops->ops_oap; if (oap->oap_cmd & OBD_BRW_WRITE && !list_empty(&oap->oap_pending_item)) CL_PAGE_DEBUG(D_ERROR, env, page, "exists %llu/%s.\n", start, current->comm); { struct page *vmpage = cl_page_vmpage(env, page); if (PageLocked(vmpage)) CDEBUG(D_CACHE, "page %p index %lu locked for %d.\n", ops, page->cp_index, (oap->oap_cmd & OBD_BRW_RWMASK)); } return CLP_GANG_OKAY; }
static struct osc_page *osc_cl_page_osc(struct cl_page *page) { const struct cl_page_slice *slice; slice = cl_page_at(page, &osc_device_type); LASSERT(slice != NULL); return cl2osc_page(slice); }
static struct osc_page *osc_cl_page_osc(struct cl_page *page, struct osc_object *osc) { const struct cl_page_slice *slice; if (osc != NULL) slice = cl_object_page_slice(&osc->oo_cl, page); else slice = cl_page_at(page, &osc_device_type); LASSERT(slice != NULL); return cl2osc_page(slice); }