bool directio = false;
bool enable_checksum = true;
struct cl_page *clpage;
+ bool page_access_allowed = true;
bool compressed = false;
ENTRY;
if (clpage->cp_type == CPT_TRANSIENT)
directio = true;
+ if (lnet_is_rdma_only_page(pga[0]->pg)) {
+ /* RDMA only pages cannot be accessed by the CPU, so
+ * functionality which requires read/write access to
+ * the file data in these pages must be disabled
+ * (encryption, compression, checksums, and
+ * short io (RPC data inlining))
+ */
+ page_access_allowed = false;
+ }
+
+ /* If compression disabled for the file NONE is set for all
+ * pages, so it is enough to check only one
+ */
compressed = clpage->cp_comp_type != LL_COMPR_TYPE_NONE;
}
if (OBD_FAIL_CHECK(OBD_FAIL_OSC_BRW_PREP_REQ))
oap->oap_page_off;
}
- if (opc == OST_WRITE && compressed) {
- /*
- * If compression disabled for the file -1 is set to
- * all pages, so it is enough to check only one
- * */
- if ((oap2cl_page(brw_page2oap(pga[0])))->cp_comp_type
- == LL_COMPR_TYPE_NONE) {
- compressed = 0;
- goto skip_compression;
- }
+ if (compressed && !page_access_allowed)
+ RETURN(-EINVAL);
+
+ if (inode && IS_ENCRYPTED(inode) && !page_access_allowed)
+ RETURN(-EINVAL);
+ if (opc == OST_WRITE && compressed) {
rc = compress_request(obd_name, oa, pga, &pga, page_count,
&page_count);
if (rc) {
}
}
-skip_compression:
if (opc == OST_WRITE && inode && IS_ENCRYPTED(inode) &&
llcrypt_has_encryption_key(inode)) {
struct page **pa = NULL;
req_capsule_set_size(pill, &RMF_NIOBUF_REMOTE, RCL_CLIENT,
niocount * sizeof(*niobuf));
- for (i = 0; i < page_count; i++) {
- short_io_size += pga[i]->count;
- if (!inode || !IS_ENCRYPTED(inode) ||
- !ll_has_encryption_key(inode)) {
- pga[i]->bp_count_diff = 0;
- pga[i]->bp_off_diff = 0;
+ /* short writes require that the CPU be able to access page contents */
+ if (page_access_allowed) {
+ for (i = 0; i < page_count; i++) {
+ short_io_size += pga[i]->count;
+ if (!inode || !IS_ENCRYPTED(inode) ||
+ !ll_has_encryption_key(inode)) {
+ pga[i]->bp_count_diff = 0;
+ pga[i]->bp_off_diff = 0;
+ }
}
}
- if (lnet_is_rdma_only_page(pga[0]->pg)) {
- enable_checksum = false;
- short_io_size = 0;
- }
-
/* Check if read/write is small enough to be a short io. */
if (short_io_size > cli->cl_max_short_io_bytes || niocount > 1 ||
!imp_connect_shortio(cli->cl_import))
if (osc_should_shrink_grant(cli))
osc_shrink_grant_local(cli, &body->oa);
- if (!cli->cl_checksum || sptlrpc_flavor_has_bulk(&req->rq_flvr))
+ if (!cli->cl_checksum || sptlrpc_flavor_has_bulk(&req->rq_flvr) ||
+ !page_access_allowed)
enable_checksum = false;
/* size[REQ_REC_OFF] still sizeof (*body) */