@@ -1611,6 +1611,11 @@ struct cl_io_operations {
struct cl_page_list *queue, int from, int to,
cl_commit_cbt cb);
/**
+ * Release active extent.
+ */
+ void (*cio_extent_release)(const struct lu_env *env,
+ const struct cl_io_slice *slice);
+ /**
* Decide maximum read ahead extent
*
* \pre io->ci_type == CIT_READ
@@ -2439,6 +2444,7 @@ int cl_io_submit_sync(const struct lu_env *env, struct cl_io *io,
int cl_io_commit_async(const struct lu_env *env, struct cl_io *io,
struct cl_page_list *queue, int from, int to,
cl_commit_cbt cb);
+void cl_io_extent_release(const struct lu_env *env, struct cl_io *io);
int cl_io_read_ahead(const struct lu_env *env, struct cl_io *io,
pgoff_t start, struct cl_read_ahead *ra);
@@ -689,6 +689,8 @@ int osc_io_commit_async(const struct lu_env *env,
const struct cl_io_slice *ios,
struct cl_page_list *qin, int from, int to,
cl_commit_cbt cb);
+void osc_io_extent_release(const struct lu_env *env,
+ const struct cl_io_slice *ios);
int osc_io_iter_init(const struct lu_env *env, const struct cl_io_slice *ios);
void osc_io_iter_fini(const struct lu_env *env,
const struct cl_io_slice *ios);
@@ -1318,6 +1318,10 @@ static int lov_io_commit_async(const struct lu_env *env,
break;
from = 0;
+
+ if (lov_comp_entry(index) !=
+ lov_comp_entry(page->cp_lov_index))
+ cl_io_extent_release(sub->sub_env, &sub->sub_io);
}
/* for error case, add the page back into the qin list */
@@ -1325,6 +1325,7 @@ static void mdc_io_data_version_end(const struct lu_env *env,
.cio_read_ahead = mdc_io_read_ahead,
.cio_submit = osc_io_submit,
.cio_commit_async = osc_io_commit_async,
+ .cio_extent_release = osc_io_extent_release,
};
int mdc_io_init(const struct lu_env *env, struct cl_object *obj,
@@ -597,6 +597,18 @@ int cl_io_commit_async(const struct lu_env *env, struct cl_io *io,
}
EXPORT_SYMBOL(cl_io_commit_async);
+void cl_io_extent_release(const struct lu_env *env, struct cl_io *io)
+{
+ const struct cl_io_slice *scan;
+
+ list_for_each_entry(scan, &io->ci_layers, cis_linkage) {
+ if (!scan->cis_iop->cio_extent_release)
+ continue;
+ scan->cis_iop->cio_extent_release(env, scan);
+ }
+}
+EXPORT_SYMBOL(cl_io_extent_release);
+
/**
* Submits a list of pages for immediate io.
*
@@ -373,6 +373,18 @@ int osc_io_commit_async(const struct lu_env *env,
}
EXPORT_SYMBOL(osc_io_commit_async);
+void osc_io_extent_release(const struct lu_env *env,
+ const struct cl_io_slice *ios)
+{
+ struct osc_io *oio = cl2osc_io(env, ios);
+
+ if (oio->oi_active) {
+ osc_extent_release(env, oio->oi_active);
+ oio->oi_active = NULL;
+ }
+}
+EXPORT_SYMBOL(osc_io_extent_release);
+
static bool osc_import_not_healthy(struct obd_import *imp)
{
return imp->imp_invalid || imp->imp_deactive ||
@@ -1218,7 +1230,8 @@ void osc_io_lseek_end(const struct lu_env *env,
},
.cio_read_ahead = osc_io_read_ahead,
.cio_submit = osc_io_submit,
- .cio_commit_async = osc_io_commit_async
+ .cio_commit_async = osc_io_commit_async,
+ .cio_extent_release = osc_io_extent_release
};
/*****************************************************************************