From 3c8761178d2024887251bc3707d160e924f8baf2 Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Fri, 3 Nov 2023 12:33:20 -0400 Subject: [PATCH] EX-7601 ofd: switch preprw to chunk_bits The compression/decompression code requires chunk_bits rather than chunk size. Since we need to call this code from ofd_preprw_write, we need chunk_bits there. This modifies the functions so chunk_bits is available there. Test-Parameters: trivial Signed-off-by: Patrick Farrell Change-Id: Id98e6d6364eeaaa7753a8aba059387e3e659d2a2 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/52982 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Artem Blagodarenko --- lustre/include/obd.h | 2 +- lustre/include/obd_class.h | 4 ++-- lustre/ofd/ofd_internal.h | 2 +- lustre/ofd/ofd_io.c | 11 ++++++----- lustre/target/tgt_handler.c | 9 +++++---- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/lustre/include/obd.h b/lustre/include/obd.h index fa616fe..c2448bb 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -1083,7 +1083,7 @@ struct obd_ops { struct obd_export *exp, struct obdo *oa, int objcount, struct obd_ioobj *obj, struct niobuf_remote *remote, int *nr_pages, struct niobuf_local *local, - int chunk_size); + int chunk_bits); int (*o_commitrw)(const struct lu_env *env, int cmd, struct obd_export *exp, struct obdo *oa, int objcount, struct obd_ioobj *obj, diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index 336270e..89f19b8 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -1139,7 +1139,7 @@ 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, struct niobuf_remote *remote, int *pages, - struct niobuf_local *local, int chunk_size) + struct niobuf_local *local, int chunk_bits) { int rc; @@ -1156,7 +1156,7 @@ static inline int obd_preprw(const struct lu_env *env, int cmd, } rc = OBP(exp->exp_obd, preprw)(env, cmd, exp, oa, objcount, obj, remote, - pages, local, chunk_size); + pages, local, chunk_bits); RETURN(rc); } diff --git a/lustre/ofd/ofd_internal.h b/lustre/ofd/ofd_internal.h index 05ef208..d94942e 100644 --- a/lustre/ofd/ofd_internal.h +++ b/lustre/ofd/ofd_internal.h @@ -354,7 +354,7 @@ int ofd_decompress_read(const struct lu_env *env, struct obd_export *exp, int ofd_preprw(const struct lu_env *env,int cmd, struct obd_export *exp, struct obdo *oa, int objcount, struct obd_ioobj *obj, struct niobuf_remote *rnb, int *nr_local, - struct niobuf_local *lnb, int chunk_size); + struct niobuf_local *lnb, int chunk_bits); int ofd_commitrw(const struct lu_env *env, int cmd, struct obd_export *exp, struct obdo *oa, int objcount, struct obd_ioobj *obj, struct niobuf_remote *rnb, int npages, diff --git a/lustre/ofd/ofd_io.c b/lustre/ofd/ofd_io.c index 4e8e5cc..b505f9f 100644 --- a/lustre/ofd/ofd_io.c +++ b/lustre/ofd/ofd_io.c @@ -749,11 +749,12 @@ static int ofd_preprw_write(const struct lu_env *env, struct obd_export *exp, struct lu_attr *la, struct obdo *oa, int objcount, struct obd_ioobj *obj, struct niobuf_remote *rnb, int *nr_local, - struct niobuf_local *lnb, int chunk_size) + struct niobuf_local *lnb, int chunk_bits) { struct ofd_object *fo; int i, j, k, rc = 0, tot_bytes = 0; enum dt_bufs_type dbt = DT_BUFS_TYPE_WRITE; + int chunk_size = chunk_bits ? 1 << chunk_bits : 0; int maxlnb = *nr_local; __u64 begin, end; struct range_lock *range = &ofd_info(env)->fti_write_range; @@ -961,7 +962,7 @@ int ofd_decompress_read(const struct lu_env *env, struct obd_export *exp, struct ofd_device *ofd = ofd_exp(exp); struct lu_fid *fid = &oa->o_oi.oi_fid; struct ofd_object *fo; - int chunk_size = 1 << chunk_bits; + int chunk_size = chunk_bits ? 1 << chunk_bits : 0; int niocount = obj->ioo_bufcnt; int buf_bits = chunk_bits + 1; void *bounce_src = NULL; @@ -1090,7 +1091,7 @@ out: int ofd_preprw(const struct lu_env *env, int cmd, struct obd_export *exp, struct obdo *oa, int objcount, struct obd_ioobj *obj, struct niobuf_remote *rnb, int *nr_local, - struct niobuf_local *lnb, int chunk_size) + struct niobuf_local *lnb, int chunk_bits) { struct tgt_session_info *tsi = tgt_ses_info(env); struct ofd_device *ofd = ofd_exp(exp); @@ -1140,12 +1141,12 @@ int ofd_preprw(const struct lu_env *env, int cmd, struct obd_export *exp, la_from_obdo(&info->fti_attr, oa, OBD_MD_FLGETATTR); rc = ofd_preprw_write(env, exp, ofd, fid, &info->fti_attr, oa, objcount, obj, rnb, nr_local, lnb, - chunk_size); + chunk_bits); } 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_size); + chunk_bits ? 1 << chunk_bits : 0); } else { CERROR("%s: wrong cmd %d received!\n", exp->exp_obd->obd_name, cmd); diff --git a/lustre/target/tgt_handler.c b/lustre/target/tgt_handler.c index db26dd3..1868caa 100644 --- a/lustre/target/tgt_handler.c +++ b/lustre/target/tgt_handler.c @@ -2379,7 +2379,6 @@ int tgt_brw_read(struct tgt_session_info *tsi) bool compr_rounded_read_lock = false; enum ll_compr_type compr_type; int npages_remote = 0; - int chunk_size = 0; int chunk_bits = 0; int no_reply = 0; int npages_local; @@ -2467,6 +2466,7 @@ int tgt_brw_read(struct tgt_session_info *tsi) unsigned int chunk_log_bits; __u64 chunk_start; __u64 chunk_end; + int chunk_size; __u64 io_start; __u64 io_end; @@ -2542,7 +2542,7 @@ int tgt_brw_read(struct tgt_session_info *tsi) rc = obd_preprw(tsi->tsi_env, OBD_BRW_READ, exp, &repbody->oa, 1, ioo, remote_nb, &npages_local, local_io_nb, - chunk_size); + chunk_bits); if (rc != 0) GOTO(out_lock, rc); @@ -2823,7 +2823,7 @@ int tgt_brw_write(struct tgt_session_info *tsi) bool wait_sync = false; bool no_reply = false; int npages_remote = 0; - int chunk_size = 0; + int chunk_bits = 0; int npages_local; ktime_t kstart; int objcount; @@ -2942,6 +2942,7 @@ int tgt_brw_write(struct tgt_session_info *tsi) __u64 io_end; chunk_log_bits = olc->ol_compr_chunk_log_bits; + chunk_bits = chunk_log_bits + COMPR_CHUNK_MIN_BITS; chunk_size = COMPR_GET_CHUNK_SIZE(chunk_log_bits); /* rnbs are in offset order, so we get the start of IO from the @@ -3015,7 +3016,7 @@ int tgt_brw_write(struct tgt_session_info *tsi) kstart = ktime_get(); rc = obd_preprw(tsi->tsi_env, OBD_BRW_WRITE, exp, &repbody->oa, objcount, ioo, remote_nb, &npages_local, local_io_nb, - chunk_size); + chunk_bits); if (rc < 0) GOTO(out_lock, rc); -- 1.8.3.1