@@ -795,11 +795,6 @@ struct cl_page {
*/
struct cl_page_slice {
struct cl_page *cpl_page;
- /**
- * Object slice corresponding to this page slice. Immutable after
- * creation.
- */
- struct cl_object *cpl_obj;
const struct cl_page_operations *cpl_ops;
};
@@ -858,6 +858,11 @@ static inline pgoff_t osc_index(struct osc_page *opg)
return opg->ops_oap.oap_obj_off >> PAGE_SHIFT;
}
+static inline struct osc_object *osc_page_object(struct osc_page *ops)
+{
+ return ops->ops_oap.oap_obj;
+}
+
static inline struct cl_page *oap2cl_page(struct osc_async_page *oap)
{
return oap2osc(oap)->ops_cl.cpl_page;
@@ -1078,7 +1078,6 @@ void cl_page_slice_add(struct cl_page *cl_page, struct cl_page_slice *slice,
LASSERT(cl_page->cp_layer_count < CP_MAX_LAYER);
LASSERT(offset < (1 << sizeof(cl_page->cp_layer_offset[0]) * 8));
cl_page->cp_layer_offset[cl_page->cp_layer_count++] = offset;
- slice->cpl_obj = obj;
slice->cpl_ops = ops;
slice->cpl_page = cl_page;
}
@@ -1328,14 +1328,13 @@ static int osc_refresh_count(const struct lu_env *env,
{
struct osc_page *opg = oap2osc_page(oap);
pgoff_t index = osc_index(oap2osc(oap));
- struct cl_object *obj;
+ struct cl_object *obj = osc2cl(osc_page_object(opg));
struct cl_attr *attr = &osc_env_info(env)->oti_attr;
int result;
loff_t kms;
/* readpage queues with _COUNT_STABLE, shouldn't get here. */
LASSERT(!(cmd & OBD_BRW_READ));
- obj = opg->ops_cl.cpl_obj;
cl_object_attr_lock(obj);
result = cl_object_attr_get(env, obj, attr);
@@ -1378,7 +1377,7 @@ static int osc_completion(const struct lu_env *env, struct osc_async_page *oap,
/* statistic */
if (rc == 0 && srvlock) {
- struct lu_device *ld = opg->ops_cl.cpl_obj->co_lu.lo_dev;
+ struct lu_device *ld = osc_page_object(opg)->oo_cl.co_lu.lo_dev;
struct osc_stats *stats = &lu2osc_dev(ld)->od_stats;
size_t bytes = oap->oap_count;
@@ -2588,7 +2587,7 @@ int osc_flush_async_page(const struct lu_env *env, struct cl_io *io,
struct osc_page *ops)
{
struct osc_extent *ext = NULL;
- struct osc_object *obj = cl2osc(ops->ops_cl.cpl_obj);
+ struct osc_object *obj = osc_page_object(ops);
struct cl_page *cp = ops->ops_cl.cpl_page;
pgoff_t index = osc_index(ops);
struct osc_async_page *oap = &ops->ops_oap;
@@ -86,7 +86,7 @@ static void osc_page_transfer_put(const struct lu_env *env,
static void osc_page_transfer_add(const struct lu_env *env,
struct osc_page *opg, enum cl_req_type crt)
{
- struct osc_object *obj = cl2osc(opg->ops_cl.cpl_obj);
+ struct osc_object *obj = osc_page_object(opg);
osc_lru_use(osc_cli(obj), opg);
}
@@ -129,7 +129,7 @@ static int osc_page_print(const struct lu_env *env,
{
struct osc_page *opg = cl2osc_page(slice);
struct osc_async_page *oap = &opg->ops_oap;
- struct osc_object *obj = cl2osc(slice->cpl_obj);
+ struct osc_object *obj = osc_page_object(opg);
struct client_obd *cli = &osc_export(obj)->exp_obd->u.cli;
return (*printer)(env, cookie, LUSTRE_OSC_NAME
@@ -171,7 +171,7 @@ static void osc_page_delete(const struct lu_env *env,
const struct cl_page_slice *slice)
{
struct osc_page *opg = cl2osc_page(slice);
- struct osc_object *obj = cl2osc(opg->ops_cl.cpl_obj);
+ struct osc_object *obj = osc_page_object(opg);
int rc;
CDEBUG(D_TRACE, "%p\n", opg);
@@ -235,7 +235,7 @@ static void osc_page_touch(const struct lu_env *env,
const struct cl_page_slice *slice, size_t to)
{
struct osc_page *opg = cl2osc_page(slice);
- struct cl_object *obj = opg->ops_cl.cpl_obj;
+ struct cl_object *obj = osc2cl(osc_page_object(opg));
osc_page_touch_at(env, obj, osc_index(opg), to);
}