@@ -60,7 +60,7 @@ struct osc_quota_info {
struct rcu_head rcu;
};
-enum async_flags {
+enum oap_async_flags {
ASYNC_READY = 0x1, /* osc_make_ready will not be called
* before this page is added to an rpc
*/
@@ -71,24 +71,32 @@ enum async_flags {
* to give the caller a chance to update
* or cancel the size of the io
*/
- ASYNC_HP = 0x10,
+ ASYNC_HP = 0x8,
+ OAP_ASYNC_MAX,
+ OAP_ASYNC_BITS = 4
};
+/* add explicit padding to keep fields aligned despite "packed",
+ * which is needed to pack with following field in osc_page
+ */
+#define OAP_PAD_BITS (16 - OBD_BRW_WRITE - OAP_ASYNC_BITS)
struct osc_async_page {
- unsigned short oap_cmd;
+ unsigned short oap_page_off; /* :PAGE_SHIFT */
+ unsigned int oap_cmd:OBD_BRW_WRITE;
+ enum oap_async_flags oap_async_flags:OAP_ASYNC_BITS;
+ unsigned int oap_padding1:OAP_PAD_BITS; /* unused */
+ unsigned int oap_padding2; /* unused */
struct list_head oap_pending_item;
struct list_head oap_rpc_item;
u64 oap_obj_off;
- unsigned int oap_page_off;
- enum async_flags oap_async_flags;
-
- struct brw_page oap_brw_page;
struct ptlrpc_request *oap_request;
struct osc_object *oap_obj;
-};
+
+ struct brw_page oap_brw_page;
+} __packed;
#define oap_page oap_brw_page.pg
#define oap_count oap_brw_page.count
@@ -96,6 +104,7 @@ struct osc_async_page {
static inline struct osc_async_page *brw_page2oap(struct brw_page *pga)
{
+ BUILD_BUG_ON(OAP_ASYNC_MAX - 1 >= (1 << OAP_ASYNC_BITS));
return container_of(pga, struct osc_async_page, oap_brw_page);
}
@@ -123,8 +123,7 @@ struct brw_page {
u16 bp_off_diff;
/* used for encryption: difference with count in clear text page */
u16 bp_count_diff;
- u32 bp_padding;
-};
+} __packed;
struct timeout_item {
enum timeout_event ti_event;
@@ -514,9 +514,8 @@ static bool trunc_check_cb(const struct lu_env *env, struct cl_io *io,
start, current->comm);
if (PageLocked(page->cp_vmpage))
- CDEBUG(D_CACHE, "page %p index %lu locked for %d.\n",
- ops, osc_index(ops),
- oap->oap_cmd & OBD_BRW_RWMASK);
+ CDEBUG(D_CACHE, "page %p index %lu locked for cmd=%d\n",
+ ops, osc_index(ops), oap->oap_cmd);
}
return true;
}
@@ -296,10 +296,8 @@ void osc_page_submit(const struct lu_env *env, struct osc_page *opg,
oap->oap_count = opg->ops_to - opg->ops_from + 1;
oap->oap_brw_flags = OBD_BRW_SYNC | brw_flags;
- if (oio->oi_cap_sys_resource) {
+ if (oio->oi_cap_sys_resource)
oap->oap_brw_flags |= OBD_BRW_SYS_RESOURCE;
- oap->oap_cmd |= OBD_BRW_SYS_RESOURCE;
- }
osc_page_transfer_get(opg, "transfer\0imm");
osc_page_transfer_add(env, opg, crt);