]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/Transaction: do not use anonymous aggregate with member having ctor 35197/head
authorKefu Chai <kchai@redhat.com>
Fri, 22 May 2020 11:22:28 +0000 (19:22 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 27 May 2020 04:35:11 +0000 (12:35 +0800)
use a single `hint` to replace `hint_type` and `alloc_hint_flags` in
the anonymous union.

this helps to address the compile error reported by GCC-10

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/os/Transaction.cc
src/os/Transaction.h
src/os/bluestore/BlueStore.cc
src/os/filestore/FileStore.cc
src/os/kstore/KStore.cc
src/os/memstore/MemStore.cc

index 89a0eb0cb5a50860226c922bc21f860d843e43d4..af82da3406dd1b79e2ebf75da853e3d583973b40 100644 (file)
@@ -259,7 +259,7 @@ void Transaction::dump(ceph::Formatter *f)
       {
        using ceph::decode;
         coll_t cid = i.get_cid(op->cid);
-        uint32_t type = op->hint_type;
+        uint32_t type = op->hint;
         f->dump_string("op_name", "coll_hint");
         f->dump_stream("collection") << cid;
         f->dump_unsigned("type", type);
@@ -503,7 +503,7 @@ void Transaction::dump(ceph::Formatter *f)
         ghobject_t oid = i.get_oid(op->oid);
         uint64_t expected_object_size = op->expected_object_size;
         uint64_t expected_write_size = op->expected_write_size;
-        uint32_t alloc_hint_flags = op->alloc_hint_flags;
+        uint32_t alloc_hint_flags = op->hint;
         f->dump_string("op_name", "op_setallochint");
         f->dump_stream("collection") << cid;
         f->dump_stream("oid") << oid;
index fe4f25313febda18048719198ca1fb14a12ba17f..00e9fc470510c0342e5572a1c9bf0ac63c621b66 100644 (file)
@@ -169,14 +169,7 @@ public:
     ceph_le32 dest_cid;
     ceph_le32 dest_oid;               //OP_CLONE, OP_CLONERANGE
     ceph_le64 dest_off;               //OP_CLONERANGE
-    union {
-       struct {
-         ceph_le32 hint_type;          //OP_COLL_HINT
-       } __attribute__ ((packed));
-       struct {
-         ceph_le32 alloc_hint_flags;   //OP_SETALLOCHINT
-       } __attribute__ ((packed));
-    } __attribute__ ((packed));
+    ceph_le32 hint;                   //OP_COLL_HINT,OP_SETALLOCHINT
     ceph_le64 expected_object_size;   //OP_SETALLOCHINT
     ceph_le64 expected_write_size;    //OP_SETALLOCHINT
     ceph_le32 split_bits;             //OP_SPLIT_COLLECTION2,OP_COLL_SET_BITS,
@@ -1025,7 +1018,7 @@ public:
     Op* _op = _get_next_op();
     _op->op = OP_COLL_HINT;
     _op->cid = _get_coll_id(cid);
-    _op->hint_type = type;
+    _op->hint = type;
     encode(hint, data_bl);
     data.ops = data.ops + 1;
   }
@@ -1259,7 +1252,7 @@ public:
     _op->oid = _get_object_id(oid);
     _op->expected_object_size = expected_object_size;
     _op->expected_write_size = expected_write_size;
-    _op->alloc_hint_flags = flags;
+    _op->hint = flags;
     data.ops = data.ops + 1;
   }
 
index 8e10a4476927746a1b8b8d79d08e9a303c7ecb58..1fdca1f7f70b88b708e08fc72994c357fcc05b46 100644 (file)
@@ -12514,7 +12514,7 @@ void BlueStore::_txc_add_transaction(TransContext *txc, Transaction *t)
 
     case Transaction::OP_COLL_HINT:
       {
-        uint32_t type = op->hint_type;
+        uint32_t type = op->hint;
         bufferlist hint;
         i.decode_bl(hint);
         auto hiter = hint.cbegin();
@@ -12745,7 +12745,7 @@ void BlueStore::_txc_add_transaction(TransContext *txc, Transaction *t)
        r = _set_alloc_hint(txc, c, o,
                            op->expected_object_size,
                            op->expected_write_size,
-                           op->alloc_hint_flags);
+                           op->hint);
       }
       break;
 
index 008948d78287f07b28121b13e4f8b7676f981a14..92539a9320bd98ea87905a1350ee076fab6512f3 100644 (file)
@@ -3019,7 +3019,7 @@ void FileStore::_do_transaction(
     case Transaction::OP_COLL_HINT:
       {
         const coll_t &cid = i.get_cid(op->cid);
-        uint32_t type = op->hint_type;
+        uint32_t type = op->hint;
         bufferlist hint;
         i.decode_bl(hint);
         auto hiter = hint.cbegin();
index 8534a7ccff262c3da660722bf742fe60d5f3b8c5..f1a9caa0bbee848498cc15887d9e13db74c052a5 100644 (file)
@@ -2226,7 +2226,7 @@ void KStore::_txc_add_transaction(TransContext *txc, Transaction *t)
 
     case Transaction::OP_COLL_HINT:
       {
-        uint32_t type = op->hint_type;
+        uint32_t type = op->hint;
         bufferlist hint;
         i.decode_bl(hint);
         auto hiter = hint.cbegin();
@@ -2465,7 +2465,7 @@ void KStore::_txc_add_transaction(TransContext *txc, Transaction *t)
       {
         uint64_t expected_object_size = op->expected_object_size;
         uint64_t expected_write_size = op->expected_write_size;
-       uint32_t flags = op->alloc_hint_flags;
+       uint32_t flags = op->hint;
        r = _setallochint(txc, c, o,
                          expected_object_size,
                          expected_write_size,
index e6a7240bff029e3e0ff968f6984a7e032b6cd74b..69cef7e96ebc7374f76c9c2ee5a80d90d582bc46 100644 (file)
@@ -800,7 +800,7 @@ void MemStore::_do_transaction(Transaction& t)
     case Transaction::OP_COLL_HINT:
       {
         coll_t cid = i.get_cid(op->cid);
-        uint32_t type = op->hint_type;
+        uint32_t type = op->hint;
         ceph::buffer::list hint;
         i.decode_bl(hint);
         auto hiter = hint.cbegin();