]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd: Clean up endian handling
authorUlrich Weigand <ulrich.weigand@de.ibm.com>
Mon, 16 Sep 2019 15:21:01 +0000 (17:21 +0200)
committerUlrich Weigand <ulrich.weigand@de.ibm.com>
Wed, 18 Sep 2019 11:33:59 +0000 (13:33 +0200)
Replace remaining uses of __le16/__le32/__le64 in contexts that are
not relevant to code generation, or where objects are only used locally
and do not require endian swaps.

Also, remove unnecessary calls to le16/32/64_to_cpu.

This change is a no-op on all architectures.

Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
src/osd/PrimaryLogPG.cc
src/osd/mClockOpClassSupport.cc

index eb06312d0a7581dd01078ff500ea348254fc07b4..3f954328c84407da7cea93226d68c43054d9f047 100644 (file)
@@ -4832,10 +4832,10 @@ struct FillInVerifyExtent : public Context {
   uint64_t size;
   OSDService *osd;
   hobject_t soid;
-  __le32 flags;
+  uint32_t flags;
   FillInVerifyExtent(ceph_le64 *r, int32_t *rv, bufferlist *blp,
                     std::optional<uint32_t> mc, uint64_t size,
-                    OSDService *osd, hobject_t soid, __le32 flags) :
+                    OSDService *osd, hobject_t soid, uint32_t flags) :
     r(r), rval(rv), outdatap(blp), maybe_crc(mc),
     size(size), osd(osd), soid(soid), flags(flags) {}
   void finish(int len) override {
@@ -4951,7 +4951,7 @@ struct C_ChecksumRead : public Context {
   C_ChecksumRead(PrimaryLogPG *primary_log_pg, OSDOp &osd_op,
                 Checksummer::CSumType csum_type, bufferlist &&init_value_bl,
                 std::optional<uint32_t> maybe_crc, uint64_t size,
-                OSDService *osd, hobject_t soid, __le32 flags)
+                OSDService *osd, hobject_t soid, uint32_t flags)
     : primary_log_pg(primary_log_pg), osd_op(osd_op),
       csum_type(csum_type), init_value_bl(std::move(init_value_bl)),
       fill_extent_ctx(new FillInVerifyExtent(&read_length, &osd_op.rval,
@@ -5163,7 +5163,7 @@ struct C_ExtentCmpRead : public Context {
 
   C_ExtentCmpRead(PrimaryLogPG *primary_log_pg, OSDOp &osd_op,
                  std::optional<uint32_t> maybe_crc, uint64_t size,
-                 OSDService *osd, hobject_t soid, __le32 flags)
+                 OSDService *osd, hobject_t soid, uint32_t flags)
     : primary_log_pg(primary_log_pg), osd_op(osd_op),
       fill_extent_ctx(new FillInVerifyExtent(&read_length, &osd_op.rval,
                                             &read_bl, maybe_crc, size,
@@ -5481,7 +5481,7 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
       }
     }
 
-    // TODO: check endianness (__le32 vs uint32_t, etc.)
+    // TODO: check endianness (ceph_le32 vs uint32_t, etc.)
     // The fields in ceph_osd_op are little-endian (according to the definition in rados.h),
     // but the code in this function seems to treat them as native-endian.  What should the
     // tracepoints do?
@@ -6353,9 +6353,8 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
       result = 0;
       {
        tracepoint(osd, do_osd_op_pre_create, soid.oid.name.c_str(), soid.snap.val);
-        int flags = le32_to_cpu(op.flags);
        if (obs.exists && !oi.is_whiteout() &&
-           (flags & CEPH_OSD_OP_FLAG_EXCL)) {
+           (op.flags & CEPH_OSD_OP_FLAG_EXCL)) {
           result = -EEXIST; /* this is an exclusive create */
        } else {
          if (osd_op.indata.length()) {
index 22416e064f46c5e2e35485b024d675a9c9903e4f..49cad6ced58e25b6a1193f1ef9e16dc4b90d15f3 100644 (file)
@@ -85,13 +85,9 @@ namespace ceph {
       if (osd_op_type_t::client_op != type) {
        return type;
       } else {
-       // get_header returns ceph_msg_header type, ceph_msg_header
-       // stores type as unsigned little endian, so be sure to
-       // convert to CPU byte ordering
        std::optional<OpRequestRef> op_ref_maybe = op.maybe_get_op();
        ceph_assert(op_ref_maybe);
-       __le16 mtype_le = (*op_ref_maybe)->get_req()->get_header().type;
-       __u16 mtype = le16_to_cpu(mtype_le);
+       __u16 mtype = (*op_ref_maybe)->get_req()->get_header().type;
        if (rep_op_msg_bitset.test(mtype)) {
          return osd_op_type_t::osd_rep_op;
        } else {