struct obdo *oa);
int (*o_getattr)(const struct lu_env *env, struct obd_export *exp,
struct obdo *oa);
- int (*o_decompress_read)(const struct lu_env *env,
- struct obd_export *exp, struct obdo *oa,
- struct niobuf_remote *rnb,
- struct niobuf_local *lnb,
- struct obd_ioobj *obj, int npages,
- int eof_rnb, enum ll_compr_type type, int lvl,
- int chunk_bits, bool write);
int (*o_preprw)(const struct lu_env *env, int cmd,
struct obd_export *exp, struct obdo *oa, int objcount,
struct obd_ioobj *obj, struct niobuf_remote *remote,
RETURN(rc);
}
-static inline int obd_decompress_read(const struct lu_env *env,
- struct obd_export *exp, struct obdo *oa,
- struct niobuf_remote *rnb,
- struct niobuf_local *lnb,
- struct obd_ioobj *obj, int npages,
- enum ll_compr_type type, int lvl,
- int chunk_bits)
-{
- int rc;
-
- ENTRY;
-
- rc = exp_check_ops(exp);
- if (rc)
- RETURN(rc);
-
- if (!exp->exp_obd->obd_type->typ_dt_ops->o_decompress_read) {
- CERROR("%s: no %s operation\n",
- (exp)->exp_obd->obd_name, __func__);
- RETURN(-EOPNOTSUPP);
- }
-
- rc = OBP(exp->exp_obd, decompress_read)(env, exp, oa, rnb, lnb, obj,
- npages, -1, type, lvl,
- chunk_bits, false);
-
- RETURN(rc);
-}
-
static inline int obd_preprw(const struct lu_env *env, int cmd,
struct obd_export *exp, struct obdo *oa,
int objcount, struct obd_ioobj *obj,
*/
static int ofd_preprw_read(const struct lu_env *env, struct obd_export *exp,
struct ofd_device *ofd, const struct lu_fid *fid,
- struct lu_attr *la, struct obdo *oa, int niocount,
- struct niobuf_remote *rnb, int *nr_local,
- struct niobuf_local *lnb, int chunk_size)
+ struct lu_attr *la, struct obdo *oa,
+ struct obd_ioobj *obj, struct niobuf_remote *rnb,
+ int *nr_local, struct niobuf_local *lnb,
+ enum ll_compr_type type, int lvl, int chunk_bits)
{
struct ofd_object *fo;
+ int chunk_size = chunk_bits ? 1 << chunk_bits : 0;
enum dt_bufs_type dbt = DT_BUFS_TYPE_READ;
bool compr_unaligned_read = false;
+ int niocount = obj->ioo_bufcnt;
int maxlnb = *nr_local;
__u64 prev_buf_end = 0;
int tot_bytes = 0;
compr_unaligned_read);
if (unlikely(rc))
GOTO(buf_put, rc);
+
+ if (compr_unaligned_read) {
+ rc = ofd_decompress_read(env, exp, oa, rnb, lnb, obj,
+ *nr_local, INT_MAX, type, lvl,
+ chunk_bits, false);
+ if (unlikely(rc))
+ GOTO(buf_put, rc);
+ }
+
ofd_read_unlock(env, fo);
ofd_access(env, ofd,
} else if (cmd == OBD_BRW_READ) {
tgt_grant_prepare_read(env, exp, oa);
rc = ofd_preprw_read(env, exp, ofd, fid, &info->fti_attr, oa,
- obj->ioo_bufcnt, rnb, nr_local, lnb,
- chunk_bits ? 1 << chunk_bits : 0);
+ obj, rnb, nr_local, lnb, type, lvl,
+ chunk_bits);
} else {
CERROR("%s: wrong cmd %d received!\n",
exp->exp_obd->obd_name, cmd);
.o_create = ofd_echo_create,
.o_statfs = ofd_statfs,
.o_setattr = ofd_echo_setattr,
- .o_decompress_read = ofd_decompress_read,
.o_preprw = ofd_preprw,
.o_commitrw = ofd_commitrw,
.o_destroy = ofd_echo_destroy,
if (rc != 0)
GOTO(out_lock, rc);
- /* the server is responsible for decompressing partial chunk reads */
- if (npages_local != npages_remote) {
- rc = obd_decompress_read(tsi->tsi_env, exp, &repbody->oa,
- remote_nb, local_io_nb, ioo,
- npages_local, compr_type, compr_lvl,
- chunk_bits);
- if (rc != 0)
- GOTO(out_commitrw, rc);
- } else {
- /* if there's no compression, the local page count should be
- * identical to that requested by the client
- */
- LASSERT(npages_local == npages_remote);
- }
+ /* if there's no compression, the local page count should be identical
+ * to that requested by the client
+ */
+ LASSERT(ergo(compr_type == LL_COMPR_TYPE_NONE,
+ npages_local == npages_remote));
if (body->oa.o_valid & OBD_MD_FLFLAGS &&
body->oa.o_flags & OBD_FL_SHORT_IO) {