@@ -651,6 +651,7 @@ struct lu_object *lovsub_object_alloc(const struct lu_env *env,
struct lu_device *dev);
struct lov_stripe_md *lov_lsm_addref(struct lov_object *lov);
+bool lov_page_is_empty(const struct cl_page *page);
int lov_lsm_entry(const struct lov_stripe_md *lsm, u64 offset);
int lov_io_layout_at(struct lov_io *lio, u64 offset);
@@ -990,24 +990,20 @@ static int lov_io_submit(const struct lu_env *env,
int index;
int rc = 0;
- if (lio->lis_nr_subios == 1) {
- int idx = lio->lis_single_subio_index;
-
- sub = lov_sub_get(env, lio, idx);
- LASSERT(!IS_ERR(sub));
- LASSERT(sub == &lio->lis_single_subio);
- rc = cl_io_submit_rw(sub->sub_env, &sub->sub_io,
- crt, queue);
- return rc;
- }
-
cl_page_list_init(plist);
while (qin->pl_nr > 0) {
struct cl_2queue *cl2q = &lov_env_info(env)->lti_cl2q;
- cl_2queue_init(cl2q);
-
page = cl_page_list_first(qin);
+ if (lov_page_is_empty(page)) {
+ cl_page_list_move(&queue->c2_qout, qin, page);
+
+ cl_page_prep(env, ios->cis_io, page, crt);
+ cl_page_completion(env, page, crt, 0);
+ continue;
+ }
+
+ cl_2queue_init(cl2q);
cl_page_list_move(&cl2q->c2_qin, qin, page);
index = lov_page_index(page);
@@ -1055,6 +1051,8 @@ static int lov_io_commit_async(const struct lu_env *env,
if (lio->lis_nr_subios == 1) {
int idx = lio->lis_single_subio_index;
+ LASSERT(!lov_page_is_empty(cl_page_list_first(queue)));
+
sub = lov_sub_get(env, lio, idx);
LASSERT(!IS_ERR(sub));
LASSERT(sub == &lio->lis_single_subio);
@@ -1070,6 +1068,8 @@ static int lov_io_commit_async(const struct lu_env *env,
LASSERT(plist->pl_nr == 0);
page = cl_page_list_first(queue);
+ LASSERT(!lov_page_is_empty(page));
+
cl_page_list_move(plist, queue, page);
index = lov_page_index(page);
@@ -136,6 +136,7 @@ int lov_page_init_empty(const struct lu_env *env, struct cl_object *obj,
struct lov_page *lpg = cl_object_page_slice(obj, page);
void *addr;
+ lpg->lps_index = ~0;
cl_page_slice_add(page, &lpg->lps_cl, obj, index, &lov_empty_page_ops);
addr = kmap(page->cp_vmpage);
memset(addr, 0, cl_page_size(obj));
@@ -144,4 +145,11 @@ int lov_page_init_empty(const struct lu_env *env, struct cl_object *obj,
return 0;
}
+bool lov_page_is_empty(const struct cl_page *page)
+{
+ const struct cl_page_slice *slice = cl_page_at(page, &lov_device_type);
+
+ LASSERT(slice);
+ return slice->cpl_ops == &lov_empty_page_ops;
+}
/** @} lov */