Whamcloud - gitweb
EX-8993 ofd: use niocount consistently
authorPatrick Farrell <pfarrell@whamcloud.com>
Tue, 21 Nov 2023 20:25:34 +0000 (15:25 -0500)
committerAndreas Dilger <adilger@whamcloud.com>
Thu, 18 Jan 2024 09:28:07 +0000 (09:28 +0000)
'niocount' refers to the number of remote niobufs, ie, the
number of separate IOs from the client.  Except for a few
places, where it's used to refer to the number of pages in
the entire RPC.  Eek.

Replace this usage with 'npages', making niocount usage
consistent.

Test-Parameters: trivial
Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: I266087ad8dccadb54c054b0a11fb03dc9868a725
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/53206
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/mdt/mdt_io.c
lustre/ofd/ofd_io.c

index af6514a..69e7172 100644 (file)
@@ -573,7 +573,7 @@ out:
 }
 
 static int mdt_commitrw_read(const struct lu_env *env, struct mdt_device *mdt,
-                            struct mdt_object *mo, int objcount, int niocount,
+                            struct mdt_object *mo, int objcount, int npages,
                             struct niobuf_local *lnb)
 {
        struct dt_object *dob;
@@ -583,8 +583,8 @@ static int mdt_commitrw_read(const struct lu_env *env, struct mdt_device *mdt,
 
        dob = mdt_obj2dt(mo);
 
-       if (niocount)
-               dt_bufs_put(env, dob, lnb, niocount);
+       if (npages)
+               dt_bufs_put(env, dob, lnb, npages);
 
        mdt_dom_read_unlock(mo);
        RETURN(rc);
@@ -593,7 +593,7 @@ static int mdt_commitrw_read(const struct lu_env *env, struct mdt_device *mdt,
 static int mdt_commitrw_write(const struct lu_env *env, struct obd_export *exp,
                              struct mdt_device *mdt, struct mdt_object *mo,
                              struct lu_attr *la, struct obdo *oa, int objcount,
-                             int niocount, struct niobuf_local *lnb,
+                             int npages, struct niobuf_local *lnb,
                              unsigned long granted, int old_rc)
 {
        struct dt_device *dt = mdt->mdt_bottom;
@@ -615,7 +615,7 @@ retry:
        if (!dt_object_exists(dob))
                GOTO(out, rc = -ENOENT);
 
-       if (niocount == 0) {
+       if (npages == 0) {
                rc = -EPROTO;
                DEBUG_REQ(D_WARNING, tgt_ses_req(tgt_ses_info(env)),
                          "%s: commit with no pages for "DFID": rc = %d\n",
@@ -629,7 +629,7 @@ retry:
        if (IS_ERR(th))
                GOTO(out, rc = PTR_ERR(th));
 
-       for (i = 0; i < niocount; i++) {
+       for (i = 0; i < npages; i++) {
                if (!(lnb[i].lnb_flags & OBD_BRW_ASYNC)) {
                        th->th_sync = 1;
                        break;
@@ -639,7 +639,7 @@ retry:
        if (OBD_FAIL_CHECK(OBD_FAIL_OST_DQACQ_NET))
                GOTO(out_stop, rc = -EINPROGRESS);
 
-       rc = dt_declare_write_commit(env, dob, lnb, niocount, th);
+       rc = dt_declare_write_commit(env, dob, lnb, npages, th);
        if (rc)
                GOTO(out_stop, rc);
 
@@ -662,7 +662,7 @@ retry:
                        PFID(mdt_object_fid(mo)));
                GOTO(unlock, rc = 0);
        }
-       rc = dt_write_commit(env, dob, lnb, niocount, th, oa->o_size);
+       rc = dt_write_commit(env, dob, lnb, npages, th, oa->o_size);
        if (rc) {
                restart = th->th_restart_tran;
                GOTO(unlock, rc);
@@ -709,7 +709,7 @@ out_stop:
        }
 
 out:
-       dt_bufs_put(env, dob, lnb, niocount);
+       dt_bufs_put(env, dob, lnb, npages);
        mdt_dom_read_unlock(mo);
        if (granted > 0)
                tgt_grant_commit(exp, granted, old_rc);
index 3ccdb11..668507d 100644 (file)
@@ -1462,7 +1462,7 @@ int ofd_preprw(const struct lu_env *env, int cmd, struct obd_export *exp,
  * \param[in] ofd      OFD device
  * \param[in] fid      object FID
  * \param[in] objcount always 1
- * \param[in] niocount number of local buffers
+ * \param[in] npages   number of local buffers
  * \param[in] lnb      local buffers
  *
  * \retval             0 on successful execution
@@ -1470,14 +1470,14 @@ int ofd_preprw(const struct lu_env *env, int cmd, struct obd_export *exp,
  */
 static int
 ofd_commitrw_read(const struct lu_env *env, struct ofd_device *ofd,
-                 const struct lu_fid *fid, int objcount, int niocount,
+                 const struct lu_fid *fid, int objcount, int npages,
                  struct niobuf_local *lnb)
 {
        struct ofd_object *fo;
 
        ENTRY;
 
-       LASSERT(niocount > 0);
+       LASSERT(npages > 0);
 
        fo = ofd_info(env)->fti_obj;
        LASSERT(fo != NULL);
@@ -1486,7 +1486,7 @@ ofd_commitrw_read(const struct lu_env *env, struct ofd_device *ofd,
         * behind this RPC could have been evicted allowing concurrent
         * OST_DESTROY to remove the object.
         */
-       dt_bufs_put(env, ofd_object_child(fo), lnb, niocount);
+       dt_bufs_put(env, ofd_object_child(fo), lnb, npages);
 
        ofd_object_put(env, fo);
 
@@ -1708,7 +1708,7 @@ static int ofd_soft_sync_cb_add(struct thandle *th, struct obd_export *exp)
  * \param[in] la       object attributes
  * \param[in] ff       parent FID of object
  * \param[in] objcount always 1
- * \param[in] niocount number of local buffers
+ * \param[in] npages   number of local pages/buffers
  * \param[in] lnb      local buffers
  * \param[in] granted  grant space consumed for the bulk I/O
  * \param[in] old_rc   result of processing at this point
@@ -1720,7 +1720,7 @@ static int
 ofd_commitrw_write(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 objcount,
-                  int niocount, struct niobuf_local *lnb,
+                  int npages, struct niobuf_local *lnb,
                   unsigned long granted, int old_rc)
 {
        struct ofd_thread_info *info = ofd_info(env);
@@ -1769,7 +1769,7 @@ ofd_commitrw_write(const struct lu_env *env, struct obd_export *exp,
 
        /* do fake write, to simulate the write case for performance testing */
        if (OBD_FAIL_CHECK_QUIET(OBD_FAIL_OST_FAKE_RW)) {
-               struct niobuf_local *last = &lnb[niocount - 1];
+               struct niobuf_local *last = &lnb[npages - 1];
                __u64 file_size = last->lnb_file_offset + last->lnb_len;
                bool compressed = last->lnb_flags & OBD_BRW_COMPRESSED;
                __u64 user_size = oa->o_size;
@@ -1805,7 +1805,7 @@ retry:
 
        th->th_sync |= ofd->ofd_sync_journal;
        if (th->th_sync == 0) {
-               for (i = 0; i < niocount; i++) {
+               for (i = 0; i < npages; i++) {
                        if (!(lnb[i].lnb_flags & OBD_BRW_ASYNC)) {
                                th->th_sync = 1;
                                break;
@@ -1819,7 +1819,7 @@ retry:
                GOTO(out_stop, rc = -EINPROGRESS);
 
        if (likely(!fake_write)) {
-               rc = dt_declare_write_commit(env, o, lnb, niocount, th);
+               rc = dt_declare_write_commit(env, o, lnb, npages, th);
                if (rc)
                        GOTO(out_stop, rc);
        }
@@ -1856,7 +1856,7 @@ retry:
        if (likely(!fake_write)) {
                OBD_FAIL_TIMEOUT_ORSET(OBD_FAIL_OST_WR_ATTR_DELAY,
                                       OBD_FAIL_ONCE, cfs_fail_val);
-               rc = dt_write_commit(env, o, lnb, niocount, th, oa->o_size);
+               rc = dt_write_commit(env, o, lnb, npages, th, oa->o_size);
                if (rc) {
                        restart = th->th_restart_tran;
                        GOTO(out_unlock, rc);
@@ -1916,7 +1916,7 @@ out:
                range_unlock(&fo->ofo_write_tree, range);
                info->fti_range_locked = 0;
        }
-       dt_bufs_put(env, o, lnb, niocount);
+       dt_bufs_put(env, o, lnb, npages);
        ofd_object_put(env, fo);
        if (granted > 0)
                tgt_grant_commit(exp, granted, old_rc);