Whamcloud - gitweb
LU-5061 obd: add rnb_ prefix to struct niobuf_remote members 52/10452/3
authorJohn L. Hammond <john.hammond@intel.com>
Fri, 30 May 2014 09:41:13 +0000 (04:41 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 24 Jul 2014 22:21:08 +0000 (22:21 +0000)
Add the prefix rnb_ to the members of struct niobuf_remote. Delete the
relevant compat macros from ofd_internal.h.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: I51cfba173b63f8d4213faa223130fff829fdd66c
Reviewed-on: http://review.whamcloud.com/10452
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
14 files changed:
lustre/include/dt_object.h
lustre/include/lustre/lustre_idl.h
lustre/obdecho/echo.c
lustre/obdecho/echo_client.c
lustre/ofd/ofd_dev.c
lustre/ofd/ofd_internal.h
lustre/osc/osc_request.c
lustre/osd-ldiskfs/osd_io.c
lustre/ptlrpc/nrs_orr.c
lustre/ptlrpc/pack_generic.c
lustre/ptlrpc/wiretest.c
lustre/target/tgt_handler.c
lustre/utils/wirecheck.c
lustre/utils/wiretest.c

index a39c461..9247b4d 100644 (file)
@@ -1237,15 +1237,15 @@ static inline struct obd_capa *dt_capa_get(const struct lu_env *env,
 }
 
 static inline int dt_bufs_get(const struct lu_env *env, struct dt_object *d,
-                              struct niobuf_remote *rnb,
-                              struct niobuf_local *lnb, int rw,
-                              struct lustre_capa *capa)
-{
-        LASSERT(d);
-        LASSERT(d->do_body_ops);
-        LASSERT(d->do_body_ops->dbo_bufs_get);
-        return d->do_body_ops->dbo_bufs_get(env, d, rnb->offset,
-                                            rnb->len, lnb, rw, capa);
+                             struct niobuf_remote *rnb,
+                             struct niobuf_local *lnb, int rw,
+                             struct lustre_capa *capa)
+{
+       LASSERT(d);
+       LASSERT(d->do_body_ops);
+       LASSERT(d->do_body_ops->dbo_bufs_get);
+       return d->do_body_ops->dbo_bufs_get(env, d, rnb->rnb_offset,
+                                           rnb->rnb_len, lnb, rw, capa);
 }
 
 static inline int dt_bufs_put(const struct lu_env *env, struct dt_object *d,
index aa2de2b..ba64fd0 100644 (file)
@@ -1905,12 +1905,12 @@ extern void lustre_swab_obd_ioobj (struct obd_ioobj *ioo);
 
 /* multiple of 8 bytes => can array */
 struct niobuf_remote {
-        __u64 offset;
-        __u32 len;
-        __u32 flags;
+       __u64   rnb_offset;
+       __u32   rnb_len;
+       __u32   rnb_flags;
 };
 
-extern void lustre_swab_niobuf_remote (struct niobuf_remote *nbr);
+void lustre_swab_niobuf_remote(struct niobuf_remote *nbr);
 
 /* lock value block communicated between the filter and llite */
 
index 389167b..5ece81d 100644 (file)
@@ -298,8 +298,8 @@ static int echo_map_nb_to_lb(struct obdo *oa, struct obd_ioobj *obj,
                           (oa->o_valid & OBD_MD_FLFLAGS) != 0 &&
                           (oa->o_flags & OBD_FL_DEBUG_CHECK) != 0);
        struct niobuf_local *res = lb;
-       obd_off offset = nb->offset;
-       int len = nb->len;
+       obd_off offset = nb->rnb_offset;
+       int len = nb->rnb_len;
 
        while (len > 0) {
                int plen = PAGE_CACHE_SIZE - (offset & (PAGE_CACHE_SIZE-1));
@@ -360,8 +360,8 @@ static int echo_finalize_lb(struct obdo *oa, struct obd_ioobj *obj,
                            struct niobuf_local *lb, int verify)
 {
        struct niobuf_local *res = lb;
-       obd_off start  = rb->offset >> PAGE_CACHE_SHIFT;
-       obd_off end    = (rb->offset + rb->len + PAGE_CACHE_SIZE - 1) >>
+       obd_off start  = rb->rnb_offset >> PAGE_CACHE_SHIFT;
+       obd_off end    = (rb->rnb_offset + rb->rnb_len + PAGE_CACHE_SIZE - 1) >>
                         PAGE_CACHE_SHIFT;
        int     count  = (int)(end - start);
        int     rc     = 0;
@@ -442,7 +442,7 @@ static int echo_preprw(const struct lu_env *env, int cmd,
                         if (rc)
                                 GOTO(preprw_cleanup, rc);
 
-                        tot_bytes += nb->len;
+                       tot_bytes += nb->rnb_len;
                 }
         }
 
index 6905ce6..8b1a526 100644 (file)
@@ -2532,9 +2532,9 @@ static int echo_client_prep_commit(const struct lu_env *env,
                         npages = tot_pages;
 
                for (i = 0; i < npages; i++, off += PAGE_CACHE_SIZE) {
-                        rnb[i].offset = off;
-                       rnb[i].len = PAGE_CACHE_SIZE;
-                       rnb[i].flags = brw_flags;
+                       rnb[i].rnb_offset = off;
+                       rnb[i].rnb_len = PAGE_CACHE_SIZE;
+                       rnb[i].rnb_flags = brw_flags;
                 }
 
                 ioo.ioo_bufcnt = npages;
@@ -2564,13 +2564,13 @@ static int echo_client_prep_commit(const struct lu_env *env,
                        if (rw == OBD_BRW_WRITE)
                                echo_client_page_debug_setup(lsm, page, rw,
                                                            ostid_id(&oa->o_oi),
-                                                            rnb[i].offset,
-                                                            rnb[i].len);
+                                                            rnb[i].rnb_offset,
+                                                            rnb[i].rnb_len);
                        else
                                echo_client_page_debug_check(lsm, page,
                                                            ostid_id(&oa->o_oi),
-                                                            rnb[i].offset,
-                                                            rnb[i].len);
+                                                            rnb[i].rnb_offset,
+                                                            rnb[i].rnb_len);
                }
 
                ret = obd_commitrw(env, rw, exp, oa, 1, &ioo,
index 774ec02..f758e1e 100644 (file)
@@ -1842,9 +1842,9 @@ static int ofd_rw_hpreq_lock_match(struct ptlrpc_request *req,
        rnb = req_capsule_client_get(&req->rq_pill, &RMF_NIOBUF_REMOTE);
        LASSERT(rnb != NULL);
 
-       ext.start = rnb->offset;
+       ext.start = rnb->rnb_offset;
        rnb += ioo->ioo_bufcnt - 1;
-       ext.end = rnb->offset + rnb->len - 1;
+       ext.end = rnb->rnb_offset + rnb->rnb_len - 1;
 
        LASSERT(lock->l_resource != NULL);
        if (!ostid_res_name_eq(&ioo->ioo_oid, &lock->l_resource->lr_name))
@@ -1894,11 +1894,11 @@ static int ofd_rw_hpreq_check(struct ptlrpc_request *req)
 
        rnb = req_capsule_client_get(&req->rq_pill, &RMF_NIOBUF_REMOTE);
        LASSERT(rnb != NULL);
-       LASSERT(!(rnb->flags & OBD_BRW_SRVLOCK));
+       LASSERT(!(rnb->rnb_flags & OBD_BRW_SRVLOCK));
 
-       start = rnb->offset;
+       start = rnb->rnb_offset;
        rnb += ioo->ioo_bufcnt - 1;
-       end = rnb->offset + rnb->len - 1;
+       end = rnb->rnb_offset + rnb->rnb_len - 1;
 
        DEBUG_REQ(D_RPCTRACE, req, "%s %s: refresh rw locks: "DFID
                                   " ("LPU64"->"LPU64")\n",
@@ -2004,7 +2004,7 @@ static void ofd_hp_brw(struct tgt_session_info *tsi)
                LASSERT(rnb != NULL); /* must exist after request preprocessing */
 
                /* no high priority if server lock is needed */
-               if (rnb->flags & OBD_BRW_SRVLOCK)
+               if (rnb->rnb_flags & OBD_BRW_SRVLOCK)
                        return;
        }
        tgt_ses_req(tsi)->rq_ops = &ofd_hpreq_rw;
index caac45e..1533963 100644 (file)
@@ -616,9 +616,4 @@ static inline void ofd_prepare_fidea(struct filter_fid *ff,
        ff->ff_parent.f_ver = cpu_to_le32(oa->o_stripe_idx);
 }
 
-/* niobuf_remote has no rnb_ prefix in master */
-#define rnb_offset offset
-#define rnb_flags  flags
-#define rnb_len    len
-
 #endif /* _OFD_INTERNAL_H */
index 80b195a..93567bc 100644 (file)
@@ -1344,11 +1344,11 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli,struct obdo *oa,
 
                 if (i > 0 && can_merge_pages(pg_prev, pg)) {
                         niobuf--;
-                        niobuf->len += pg->count;
-                } else {
-                        niobuf->offset = pg->off;
-                        niobuf->len    = pg->count;
-                        niobuf->flags  = pg->flag;
+                       niobuf->rnb_len += pg->count;
+               } else {
+                       niobuf->rnb_offset = pg->off;
+                       niobuf->rnb_len    = pg->count;
+                       niobuf->rnb_flags  = pg->flag;
                 }
                 pg_prev = pg;
         }
index 935478c..af11680 100644 (file)
@@ -396,7 +396,7 @@ static int osd_map_remote_to_local(loff_t offset, ssize_t len, int *nrpages,
                lnb->lnb_file_offset = offset;
                lnb->lnb_page_offset = poff;
                lnb->lnb_len = plen;
-               /* lnb->lnb_flags = rnb->flags; */
+               /* lnb->lnb_flags = rnb->rnb_flags; */
                lnb->lnb_flags = 0;
                lnb->lnb_page = NULL;
                lnb->lnb_rc = 0;
index 6d54e6d..34eb687 100644 (file)
@@ -196,9 +196,9 @@ static void nrs_orr_range_fill_logical(struct niobuf_remote *nb, int niocount,
                                       struct nrs_orr_req_range *range)
 {
        /* Should we do this at page boundaries ? */
-       range->or_start = nb[0].offset & CFS_PAGE_MASK;
-       range->or_end = (nb[niocount - 1].offset +
-                        nb[niocount - 1].len - 1) | ~CFS_PAGE_MASK;
+       range->or_start = nb[0].rnb_offset & CFS_PAGE_MASK;
+       range->or_end = (nb[niocount - 1].rnb_offset +
+                        nb[niocount - 1].rnb_len - 1) | ~CFS_PAGE_MASK;
 }
 
 /**
index 7768e41..889c457 100644 (file)
@@ -1798,11 +1798,11 @@ void lustre_swab_obd_ioobj(struct obd_ioobj *ioo)
 }
 EXPORT_SYMBOL(lustre_swab_obd_ioobj);
 
-void lustre_swab_niobuf_remote (struct niobuf_remote *nbr)
+void lustre_swab_niobuf_remote(struct niobuf_remote *nbr)
 {
-        __swab64s (&nbr->offset);
-        __swab32s (&nbr->len);
-        __swab32s (&nbr->flags);
+       __swab64s(&nbr->rnb_offset);
+       __swab32s(&nbr->rnb_len);
+       __swab32s(&nbr->rnb_flags);
 }
 EXPORT_SYMBOL(lustre_swab_niobuf_remote);
 
@@ -2331,8 +2331,8 @@ EXPORT_SYMBOL(dump_ioo);
 
 void dump_rniobuf(struct niobuf_remote *nb)
 {
-        CDEBUG(D_RPCTRACE, "niobuf_remote: offset="LPU64", len=%d, flags=%x\n",
-               nb->offset, nb->len, nb->flags);
+       CDEBUG(D_RPCTRACE, "niobuf_remote: offset="LPU64", len=%d, flags=%x\n",
+              nb->rnb_offset, nb->rnb_len, nb->rnb_flags);
 }
 EXPORT_SYMBOL(dump_rniobuf);
 
index 62ddffa..4e3d903 100644 (file)
@@ -1906,18 +1906,18 @@ void lustre_assert_wire_constants(void)
        /* Checks for struct niobuf_remote */
        LASSERTF((int)sizeof(struct niobuf_remote) == 16, "found %lld\n",
                 (long long)(int)sizeof(struct niobuf_remote));
-       LASSERTF((int)offsetof(struct niobuf_remote, offset) == 0, "found %lld\n",
-                (long long)(int)offsetof(struct niobuf_remote, offset));
-       LASSERTF((int)sizeof(((struct niobuf_remote *)0)->offset) == 8, "found %lld\n",
-                (long long)(int)sizeof(((struct niobuf_remote *)0)->offset));
-       LASSERTF((int)offsetof(struct niobuf_remote, len) == 8, "found %lld\n",
-                (long long)(int)offsetof(struct niobuf_remote, len));
-       LASSERTF((int)sizeof(((struct niobuf_remote *)0)->len) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct niobuf_remote *)0)->len));
-       LASSERTF((int)offsetof(struct niobuf_remote, flags) == 12, "found %lld\n",
-                (long long)(int)offsetof(struct niobuf_remote, flags));
-       LASSERTF((int)sizeof(((struct niobuf_remote *)0)->flags) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct niobuf_remote *)0)->flags));
+       LASSERTF((int)offsetof(struct niobuf_remote, rnb_offset) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct niobuf_remote, rnb_offset));
+       LASSERTF((int)sizeof(((struct niobuf_remote *)0)->rnb_offset) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct niobuf_remote *)0)->rnb_offset));
+       LASSERTF((int)offsetof(struct niobuf_remote, rnb_len) == 8, "found %lld\n",
+                (long long)(int)offsetof(struct niobuf_remote, rnb_len));
+       LASSERTF((int)sizeof(((struct niobuf_remote *)0)->rnb_len) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct niobuf_remote *)0)->rnb_len));
+       LASSERTF((int)offsetof(struct niobuf_remote, rnb_flags) == 12, "found %lld\n",
+                (long long)(int)offsetof(struct niobuf_remote, rnb_flags));
+       LASSERTF((int)sizeof(((struct niobuf_remote *)0)->rnb_flags) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct niobuf_remote *)0)->rnb_flags));
        LASSERTF(OBD_BRW_READ == 0x01, "found 0x%.8x\n",
                OBD_BRW_READ);
        LASSERTF(OBD_BRW_WRITE == 0x02, "found 0x%.8x\n",
index de964ff..bab3ff2 100644 (file)
@@ -1542,15 +1542,16 @@ int tgt_brw_lock(struct ldlm_namespace *ns, struct ldlm_res_id *res_id,
        LASSERT(mode == LCK_PR || mode == LCK_PW);
        LASSERT(!lustre_handle_is_used(lh));
 
-       if (nrbufs == 0 || !(nb[0].flags & OBD_BRW_SRVLOCK))
+       if (nrbufs == 0 || !(nb[0].rnb_flags & OBD_BRW_SRVLOCK))
                RETURN(0);
 
        for (i = 1; i < nrbufs; i++)
-               if (!(nb[i].flags & OBD_BRW_SRVLOCK))
+               if (!(nb[i].rnb_flags & OBD_BRW_SRVLOCK))
                        RETURN(-EFAULT);
 
-       RETURN(tgt_extent_lock(ns, res_id, nb[0].offset,
-                              nb[nrbufs - 1].offset + nb[nrbufs - 1].len - 1,
+       RETURN(tgt_extent_lock(ns, res_id, nb[0].rnb_offset,
+                              nb[nrbufs - 1].rnb_offset +
+                              nb[nrbufs - 1].rnb_len - 1,
                               lh, mode, &flags));
 }
 EXPORT_SYMBOL(tgt_brw_lock);
@@ -1561,8 +1562,10 @@ void tgt_brw_unlock(struct obd_ioobj *obj, struct niobuf_remote *niob,
        ENTRY;
 
        LASSERT(mode == LCK_PR || mode == LCK_PW);
-       LASSERT((obj->ioo_bufcnt > 0 && (niob[0].flags & OBD_BRW_SRVLOCK)) ==
+       LASSERT((obj->ioo_bufcnt > 0 &&
+                (niob[0].rnb_flags & OBD_BRW_SRVLOCK)) ==
                lustre_handle_is_used(lh));
+
        if (lustre_handle_is_used(lh))
                tgt_extent_unlock(lh, mode);
        EXIT;
@@ -1945,7 +1948,7 @@ int tgt_brw_write(struct tgt_session_info *tsi)
                        sizeof(*remote_nb))
                RETURN(err_serious(-EPROTO));
 
-       if ((remote_nb[0].flags & OBD_BRW_MEMALLOC) &&
+       if ((remote_nb[0].rnb_flags & OBD_BRW_MEMALLOC) &&
            (exp->exp_connection->c_peer.nid == exp->exp_connection->c_self))
                memory_pressure_set();
 
@@ -2071,7 +2074,7 @@ skip_transfer:
 
                /* set per-requested niobuf return codes */
                for (i = j = 0; i < niocount; i++) {
-                       int len = remote_nb[i].len;
+                       int len = remote_nb[i].rnb_len;
 
                        nob += len;
                        rcs[i] = 0;
index 9fbaf50..1d82f5a 100644 (file)
@@ -854,9 +854,9 @@ check_niobuf_remote(void)
 {
        BLANK_LINE();
        CHECK_STRUCT(niobuf_remote);
-       CHECK_MEMBER(niobuf_remote, offset);
-       CHECK_MEMBER(niobuf_remote, len);
-       CHECK_MEMBER(niobuf_remote, flags);
+       CHECK_MEMBER(niobuf_remote, rnb_offset);
+       CHECK_MEMBER(niobuf_remote, rnb_len);
+       CHECK_MEMBER(niobuf_remote, rnb_flags);
 
        CHECK_DEFINE_X(OBD_BRW_READ);
        CHECK_DEFINE_X(OBD_BRW_WRITE);
index 3537bcf..ba7a1ab 100644 (file)
@@ -1912,18 +1912,18 @@ void lustre_assert_wire_constants(void)
        /* Checks for struct niobuf_remote */
        LASSERTF((int)sizeof(struct niobuf_remote) == 16, "found %lld\n",
                 (long long)(int)sizeof(struct niobuf_remote));
-       LASSERTF((int)offsetof(struct niobuf_remote, offset) == 0, "found %lld\n",
-                (long long)(int)offsetof(struct niobuf_remote, offset));
-       LASSERTF((int)sizeof(((struct niobuf_remote *)0)->offset) == 8, "found %lld\n",
-                (long long)(int)sizeof(((struct niobuf_remote *)0)->offset));
-       LASSERTF((int)offsetof(struct niobuf_remote, len) == 8, "found %lld\n",
-                (long long)(int)offsetof(struct niobuf_remote, len));
-       LASSERTF((int)sizeof(((struct niobuf_remote *)0)->len) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct niobuf_remote *)0)->len));
-       LASSERTF((int)offsetof(struct niobuf_remote, flags) == 12, "found %lld\n",
-                (long long)(int)offsetof(struct niobuf_remote, flags));
-       LASSERTF((int)sizeof(((struct niobuf_remote *)0)->flags) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct niobuf_remote *)0)->flags));
+       LASSERTF((int)offsetof(struct niobuf_remote, rnb_offset) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct niobuf_remote, rnb_offset));
+       LASSERTF((int)sizeof(((struct niobuf_remote *)0)->rnb_offset) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct niobuf_remote *)0)->rnb_offset));
+       LASSERTF((int)offsetof(struct niobuf_remote, rnb_len) == 8, "found %lld\n",
+                (long long)(int)offsetof(struct niobuf_remote, rnb_len));
+       LASSERTF((int)sizeof(((struct niobuf_remote *)0)->rnb_len) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct niobuf_remote *)0)->rnb_len));
+       LASSERTF((int)offsetof(struct niobuf_remote, rnb_flags) == 12, "found %lld\n",
+                (long long)(int)offsetof(struct niobuf_remote, rnb_flags));
+       LASSERTF((int)sizeof(((struct niobuf_remote *)0)->rnb_flags) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct niobuf_remote *)0)->rnb_flags));
        LASSERTF(OBD_BRW_READ == 0x01, "found 0x%.8x\n",
                OBD_BRW_READ);
        LASSERTF(OBD_BRW_WRITE == 0x02, "found 0x%.8x\n",