Whamcloud - gitweb
EX-7601 ofd: add chunk_size to preprw_write
authorPatrick Farrell <pfarrell@whamcloud.com>
Thu, 2 Nov 2023 21:37:43 +0000 (17:37 -0400)
committerAndreas Dilger <adilger@whamcloud.com>
Tue, 12 Dec 2023 04:03:12 +0000 (04:03 +0000)
preprw_write needs chunk size for rounding.  Add this in a
separate patch to keep things trivial, it will be used in
a subsequent patch.

This patch is really trivial on the write side, since the
read side already did most of this.  But it's being kept
separate for symmetry.

Test-Parameters: trivial
Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: Id25957dbc185b6e61b7f208cee8cf5f897f03944
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/52962
Reviewed-by: Artem Blagodarenko <ablagodarenko@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/ofd/ofd_io.c
lustre/target/tgt_handler.c

index a11ba66..1ef0723 100644 (file)
@@ -740,7 +740,7 @@ 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)
+                           struct niobuf_local *lnb, int chunk_size)
 {
        struct ofd_object *fo;
        int i, j, k, rc = 0, tot_bytes = 0;
@@ -1002,7 +1002,8 @@ int ofd_preprw(const struct lu_env *env, int cmd, struct obd_export *exp,
        if (cmd == OBD_BRW_WRITE) {
                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);
+                                     objcount, obj, rnb, nr_local, lnb,
+                                     chunk_size);
        } 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,
index 35bf91e..8d84fde 100644 (file)
@@ -2810,6 +2810,9 @@ int tgt_brw_write(struct tgt_session_info *tsi)
        const char *obd_name = exp->exp_obd->obd_name;
        /* '1' for consistency with code that checks !mpflag to restore */
        unsigned int mpflags = 1;
+       struct ost_layout_compr *olc;
+       enum ll_compr_type type;
+       int chunk_size = 0;
        ktime_t kstart;
        int nob = 0;
 
@@ -2904,6 +2907,16 @@ int tgt_brw_write(struct tgt_session_info *tsi)
 
        local_nb = tbc->tbc_lnb;
 
+
+       olc = &body->oa.o_layout_compr;
+       type = olc->ol_compr_type;
+       if (type != LL_COMPR_TYPE_NONE) {
+               unsigned int chunk_log_bits;
+
+               chunk_log_bits = olc->ol_compr_chunk_log_bits;
+               chunk_size = COMPR_GET_CHUNK_SIZE(chunk_log_bits);
+       }
+
        rc = tgt_brw_lock(tsi->tsi_env, exp, &tsi->tsi_resid, remote_nb, &lockh,
                          LCK_PW, niocount);
        if (rc != 0)
@@ -2940,7 +2953,8 @@ int tgt_brw_write(struct tgt_session_info *tsi)
        npages = PTLRPC_MAX_BRW_PAGES;
        kstart = ktime_get();
        rc = obd_preprw(tsi->tsi_env, OBD_BRW_WRITE, exp, &repbody->oa,
-                       objcount, ioo, remote_nb, &npages, local_nb, 0);
+                       objcount, ioo, remote_nb, &npages, local_nb,
+                       chunk_size);
        if (rc < 0)
                GOTO(out_lock, rc);
        if (body->oa.o_valid & OBD_MD_FLFLAGS &&