}
EXPORT_SYMBOL(cl_io_rw_init);
+#ifdef HAVE_LIST_CMP_FUNC_T
+static int cl_lock_descr_cmp(void *priv,
+ const struct list_head *a,
+ const struct list_head *b)
+#else /* !HAVE_LIST_CMP_FUNC_T */
static int cl_lock_descr_cmp(void *priv,
struct list_head *a, struct list_head *b)
+#endif /* HAVE_LIST_CMP_FUNC_T */
{
const struct cl_io_lock_link *l0 = list_entry(a, struct cl_io_lock_link,
cill_linkage);
*/
void cl_page_list_splice(struct cl_page_list *src, struct cl_page_list *dst)
{
-#ifdef USE_LU_REF
+#ifdef CONFIG_LUSTRE_DEBUG_LU_REF
struct cl_page *page;
struct cl_page *tmp;
-
ENTRY;
- cl_page_list_for_each_safe(page, tmp, list)
+ cl_page_list_for_each_safe(page, tmp, src)
lu_ref_set_at(&page->cp_reference, &page->cp_queue_ref,
"queue", src, dst);
#else
cl_page_put(env, page);
}
- if (!is_sync_kiocb(aio->cda_iocb) && !aio->cda_no_aio_complete)
+ if (!aio->cda_no_aio_complete)
aio_complete(aio->cda_iocb, ret ?: aio->cda_bytes, 0);
EXIT;
* Hold one ref so that it won't be released until
* every pages is added.
*/
- cl_sync_io_init_notify(&aio->cda_sync, 1, is_sync_kiocb(iocb) ?
- NULL : aio, cl_aio_end);
+ cl_sync_io_init_notify(&aio->cda_sync, 1, aio, cl_aio_end);
cl_page_list_init(&aio->cda_pages);
aio->cda_iocb = iocb;
- aio->cda_no_aio_complete = 0;
+ if (is_sync_kiocb(iocb))
+ aio->cda_no_aio_complete = 1;
+ else
+ aio->cda_no_aio_complete = 0;
cl_object_get(obj);
aio->cda_obj = obj;
}
wake_up_locked(&anchor->csi_waitq);
if (end_io)
end_io(env, anchor);
- if (anchor->csi_aio)
- aio = anchor->csi_aio;
+
+ aio = anchor->csi_aio;
spin_unlock(&anchor->csi_waitq.lock);
/**
- * If anchor->csi_aio is set, we are responsible for freeing
- * memory here rather than when cl_sync_io_wait() completes.
+ * For AIO (!is_sync_kiocb), we are responsible for freeing
+ * memory here. This is because we are the last user of this
+ * aio struct, whereas in other cases, we will call
+ * cl_sync_io_wait to wait after this, and so the memory is
+ * freed after that call.
*/
- cl_aio_free(env, aio);
+ if (aio && !is_sync_kiocb(aio->cda_iocb))
+ cl_aio_free(env, aio);
}
EXIT;
}